Пример #1
0
import struct
import subprocess
import sys
import time
import threading
if sys.platform != 'win32':
  import fcntl
from ifaceconfiglib import cfg

# -------------------------------------------------------------------
# CONFIGURATION (set values from config file)
# -------------------------------------------------------------------

SECRET = cfg.get('main', 'secret')
HOME_PATH_ON_VM = cfg.get('main', 'home_path')
BIND_PORT = cfg.getInt('main', 'bind_port')
TERMINAL_CMD = cfg.get('main', 'terminal_cmd')
REMOTE_IP_LIST = eval(cfg.get('main', 'remote_ip_list'))

CMDS={
    "iface-info"    : "CMD_iface_info", # Returns some info.
    "iface-ping"    : "CMD_ping",       # Returns "pong"
    "iface-openurl" : "CMD_openurl",    # Opens http or https url.
    "iface-l-cmd"   : "CMD_l_cmd",      # Spawns a linux console.
    "translate-path": "CMD_translate_path", # Translates path.
    }

LOG_LEVEL = LOG_DEBUG
# -------------------------------------------------------------------
# End of constants / configs.
# -------------------------------------------------------------------
Пример #2
0
import threading
from ifaceconfiglib import cfg 

# Constants for debug level in CONFIGURATION section.
LOG_ERROR   =  0
LOG_WARNING =  1
LOG_INFO    =  3
LOG_VERBOSE =  5
LOG_DEBUG   = 10

# -------------------------------------------------------------------
# CONFIGURATION (set values from config file)
# -------------------------------------------------------------------

SECRET = cfg.get('main', 'secret')
BIND_PORT = cfg.getInt('main', 'bind_port')
 
LOG_LEVEL = LOG_INFO

# -------------------------------------------------------------------
# End of constants / configs.
# -------------------------------------------------------------------

if len(SECRET) == 0:
  print "This is your time running Windows/Linux iface. You first need to set "
  print "some things up before you can use it."
  print "Please open iface.cfg and set needed values."
  sys.exit(1)

# -------------------------------------------------------------------
# Log function.