Esempio n. 1
0
def postProxySettings():
    config = {}
    netConfig = {}
    err = ""
    #try:
    config['Operation'] = 'Proxy'
    config['Interface'] = request.form.get('intInt')
    config['Roletype'] = request.form.get('networkRole')
    config['Encryption'] = request.form.get('encryption')
    config['Capture'] = request.form.get('captureMode')
    config['Bind'] = request.form.get('targetIp')
    config['Port'] = request.form.get('targetPort')
    confLib.writeConfig(config, 'proxy')

    netConfig = config
    netConfig['ExternalInterface'] = request.form.get('extInt')
    netConfig['InternalInterface'] = config['Interface']
    confLib.writeInterfacesFile(netConfig, 'proxy')
    #confLib.writeProxyConfig(config)
    confLib.updateConfig(config, 'armore')
    #except:
    #    err = "Unable to set Proxy config"
    #    print("Error writing config:", sys.exc_info()[0])

    dComLib.addToFlash(err)
    
    return redirect(url_for("settings.settings"))
Esempio n. 2
0
def _selectAlertSound():
    path = selectFileDialog('Alert Sound')
    if not path:
        return
    if not audioFileIsValid(path):
        showMessage('Selected file is not audio file.')
        _selectAlertSound()
        return
    setAlertSoundPath(path)
    writeConfig('Audio', 'AlertSoundPath', path)
Esempio n. 3
0
def _selectPathOfExileDirectory():
    path = selectDirectoryDialog('Path of Exile')
    if not path:
        return
    if not poeDirectoryIsValid(path):
        showMessage(
            'Invalid directory. Are you sure this is Path of Exile directory?')
        _selectPathOfExileDirectory()
        return
    writeConfig('Main', 'PathOfExileDirectoryPath', path)
Esempio n. 4
0
	def setValue(self, key, value):
		### set new value
		setKey = key + "_set"
		value = round(value,1)

		if hasattr(self, setKey) and isinstance(value, float):
			setattr(self, setKey, value)
			config.writeConfig(self.section, setKey, str(value))
			logging.info("new min {0} for '{1}' to {2}".format(key,self.name,value))
			self.check(key)
			return self.section,key,value
		else:
			logging.info("attribute {0} does not exist for '{1}'".format(key,self.name))
			return False
Esempio n. 5
0
def postPassiveSettings():
    config = {}
    err = ""
    try:
        config['Operation'] = 'Passive'
        config['Monitored_Interface'] = request.form.get('monInt')
        confLib.writeConfig(config, 'passive')
        confLib.updateConfig(config, 'armore')
    except:
        err = "Unable to set Passive Mode settings"

    dComLib.addToFlash(err)

    return redirect(url_for("settings.settings"))
Esempio n. 6
0
 def save_camera_options(self):
     try:
         config.camera_port = int(self.camera_port_entry.get())
         config.camera = self.variable1.get()
         config.file_type = self.variable2.get()
     except ValueError:
         top = Toplevel()
         top.iconbitmap('plantIcon.ico')
         top.title("Error...")
         msg = Message(master=top, text="Error! Please enter only numbers!")
         msg.pack()
     finally:
         if self.control.debug:
             config.printConfig()
         config.writeConfig()
Esempio n. 7
0
	def save_camera_options(self):
		try:
			config.camera_port = int(self.camera_port_entry.get())
			config.camera = self.variable1.get()
			config.file_type = self.variable2.get()
		except ValueError:
			top = Toplevel()
			top.iconbitmap('plantIcon.ico')
			top.title("Error...")
			msg = Message(master=top, text="Error! Please enter only numbers!")
			msg.pack()
		finally:
			if self.control.debug:
				config.printConfig()
			config.writeConfig()
Esempio n. 8
0
 def savesettings(self):
     try:
         #set the config vars
         config.length = float(self.length_entry.get())
         config.speed = float(self.velocity_input.get())
         #connect with robot
         self.control.setPort(int(self.port_entry.get()))
         self.control.setBaud(int(self.baud_entry.get()))
         self.control.openConnection()
     except ValueError:
         top = Toplevel()
         top.iconbitmap('plantIcon.ico')
         top.title("Error...")
         msg = Message(master=top, text="Error! Please enter only numbers!")
         msg.pack()
     finally:
         if debug.debug:
             config.printConfig()
         config.writeConfig()
         self.toplevel.destroy()
Esempio n. 9
0
	def savesettings(self):
		try:
			#set the config vars
			config.length = float(self.length_entry.get())
			config.speed = float(self.velocity_input.get())
			#connect with robot
			self.control.setPort(int(self.port_entry.get()))
			self.control.setBaud(int(self.baud_entry.get()))
			self.control.openConnection()
		except ValueError:
			top = Toplevel()
			top.iconbitmap('plantIcon.ico')
			top.title("Error...")
			msg = Message(master=top, text="Error! Please enter only numbers!")
			msg.pack()
		finally:
			if debug.debug:
				config.printConfig()
			config.writeConfig()
			self.toplevel.destroy()
Esempio n. 10
0
def postTransparentSettings():
    config = {}
    err = ""
    try:
        config['Operation'] = 'Transparent'
        config['Interface1'] = request.form.get('brdgInt1')
        config['Interface2'] = request.form.get('brdgInt2')
        config['BridgeIp'] = request.form.get('bridgeIp')
        config['BroadcastIp'] = request.form.get('broadcastIp')
        config['Netmask'] = request.form.get('netmask')
        config['Gateway'] = request.form.get('gateway')
        config['Route'] = request.form.get('route')
        confLib.writeConfig(config, 'transparent')
        confLib.updateConfig(config, 'armore')
    except:
        err = "Unable to set Transparent Mode settings"

    dComLib.addToFlash(err)

    return redirect(url_for("settings.settings"))
Esempio n. 11
0
async def mainConsole(manager, discord):
    stdin, stdout = await aioconsole.get_standard_streams()
    while True:
        await asyncio.sleep(0.1)
        byte = await stdin.readline()
        cmd = byte.decode().strip('\n').split(" ")
        if cmd[0] == '':
            continue
        elif cmd[0] == 'add':
            manager.Add(cmd[1], cmd[2])
        elif cmd[0] == 'del':
            manager.Del(cmd[1])
        elif cmd[0] == 'list':
            manager.List()
        elif cmd[0] == 'send':
            await discord.send_message(cmd[1])
        elif cmd[0] == 'quit' or cmd[0] == 'exit' or cmd[0] == 'q':
            config.writeConfig()
            sys.exit()
        else:
            print('未知的控制台命令')
Esempio n. 12
0
def postArmoreSettings():
    config = {}
    err = ""
    restartFlask = False
    #try:
    config['Operation'] = request.form.get('operationMode')
    config['Management_Interface'] = request.form.get('mgtInt')
    config['Management_IP'] = request.form.get('mgtIp')
    config['Management_Mask'] = request.form.get('mgtMsk')
    config['Internal_Interface'] = request.form.get('intInt')
    config['Internal_IP'] = request.form.get('intIp')
    config['Internal_Mask'] = request.form.get('intMsk')
    config['External_Interface'] = request.form.get('extInt')
    config['External_IP'] = request.form.get('extIp')
    config['External_Mask'] = request.form.get('extMsk')
    restartFlask = confLib.writeConfig(config, 'armore')
    mode = ""
    if config['Operation'] == 'Proxy':
        config['Interface'] = request.form.get('monIntProxy')
        config['Roletype'] = request.form.get('networkRole')
        config['Encryption'] = request.form.get('encryption')
        config['Capture'] = request.form.get('captureMode')
        config['Bind'] = request.form.get('targetIp')
        config['Port'] = request.form.get('targetPort')
        mode = 'proxy'
    if config['Operation'] == 'Passive':
        newKeys = comLib.getKeysByValue(config, request.form.get('monIntPsv'))
        newKey = newKeys[0].split('_')[0]
        config['Monitored_Interface'] = request.form.get('monIntPsv')
        config['Monitored_IP'] = config[newKey + "_IP"]
        config['Monitored_Mask'] = config[newKey + "_Mask"]
        mode = 'passive'
    if config['Operation'] == 'Transparent':
        config['Interface_1'] = request.form.get('brdgInt1')
        config['Interface_2'] = request.form.get('brdgInt2')
        config['Bridge_IP'] = request.form.get('bridgeIp')
        config['Broadcast_IP'] = request.form.get('broadcastIp')
        config['Bridge_Mask'] = request.form.get('netmask')
        config['Bridge_Gateway'] = request.form.get('gateway')
        config['Bridge_CIDR'] = request.form.get('route')
        mode = 'transparent'
    confLib.writeInterfacesFile(config, mode)
    #confLib.updateIpAddrs(config)
    #except:
    #    err = "Unable to get current config"
    #    print("Error writing config:", sys.exc_info()[0])

    dComLib.addToFlash(err)
    
    if restartFlask:
        return redirect(url_for("settings.redirectTo", ip=config["Management_IP"]))
    else:
        return redirect(url_for("settings.settings"))
Esempio n. 13
0
import os
import sys
import json
from screen.screen_time import current_screentime, setScreenTime, tvCommand
from config import writeConfig

config = writeConfig()

try:
    THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
    config_path = "config.json"
    config_path = os.path.join(THIS_FOLDER, config_path)

    with open(config_path, "r") as configfile:
        screen_settings = json.load(configfile)['screen_settings']
except IOError as e:
    sys.exit(e)

#sys.exit("SC-Code ist: " + str(screen_settings['SCREEN_TIME']))

screen_time = setScreenTime(int(screen_settings['SCREEN_TIME']))
print(screen_time)

if not config or not screen_time:
    from datetime import datetime
    import os
    log_path = "../error.log"
    THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
    log_file = os.path.join(THIS_FOLDER, log_path)
    with open(log_file, "w") as f:
        print("[ERROR][" + str(datetime.now()) + "][" +
Esempio n. 14
0
import config

config.printConfig()
config.readConfig()

print "\n"

config.printConfig()
config.speed = 0
config.camera = "Cannon EOS5"
config.writeConfig()

print "\n"
config.printConfig()