Exemplo 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"))
Exemplo n.º 2
0
def parseArgs():
    parser = argparse.ArgumentParser()
    parser.add_argument('--arch', default='LightCNN')

    parser.add_argument('--gpu', type=str)
    parser.add_argument('--num_workers', type=int)
    parser.add_argument('--epoch', type=int)

    parser.add_argument('--batchSize', type=int)
    parser.add_argument('--cfg', required=True)
    args = parser.parse_args()
    updateConfig(config, args)
    return config
Exemplo n.º 3
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"))
Exemplo n.º 4
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"))
Exemplo n.º 5
0
def createApp():
    """
        Takes No Parameters
        Creates a new Application and adds the appID into config.json
    """
    print "Creating Application"
    try:
        conn = httplib.HTTPSConnection("api.projectoxford.ai")
        conn.request(
            "POST", "/luis/v1.0/prog/apps",
            json.dumps({
                "Name": configData["name"],
                "Description": configData["description"],
                "Culture": configData["culture"]
            }), headers)
        data = conn.getresponse().read()
        configData["appID"] = data.replace("\"", "")
        config.updateConfig(configData)
        conn.close()
        print "Application Created"
    except Exception as e:
        print e
Exemplo n.º 6
0
def parseArgs():
    parser = argparse.ArgumentParser(description='Train the generator.')
    parser.add_argument('--cfg',
                        help='Experiments configure file name.',
                        required=True)

    parser.add_argument('--gpu', type=str, help='gpu ids')
    parser.add_argument('--workers', type=int, help='Number of workers')
    parser.add_argument('--batchSize', type=int)
    parser.add_argument('--epoch', type=int)
    parser.add_argument('--printFreq', type=int, help='print frequency')
    parser.add_argument('--hdim',
                        type=int,
                        help='dimension of the latent code')

    parser.add_argument(
        '--outputPath',
        type=str,
        help='output dir, including logs, model dump and synthetic images etc.'
    )
    args = parser.parse_args()
    updateConfig(config, args)
    return config
Exemplo n.º 7
0
def isWaterEmpty():
	config.updateConfig(GPIO.input(colemeter_pin), "reservoir")
	if (GPIO.input(colemeter_pin)):
		return False
	else:
		return True
Exemplo n.º 8
0
				result_lux = 0
	
			#temperature et humidite

			result_humidite, result_temperature = getHumTemp()
			result_temperature = round(result_temperature,1)
			result_humidite = round(result_humidite,2)
		    	
			#pression et temperature
			time.sleep(1)
			bmp.measure_pressure()
			result_pression = round(int(bmp.pressure/100),1)
			
			etat_ampoule = isAmpouleOn()
			if (isWaterEmpty()) :
				config.updateConfig("Off", "arrosage_auto")
			
			datafile=open('datas.csv', 'a')
			c = csv.writer(datafile)
			moisturefile=open('moistures.csv', 'a')
			csvmoisture = csv.writer(moisturefile)
			c.writerow([time.strftime('%Y/%m/%d %H:%M',time.localtime()), result_lux, result_temperature, result_pression])	
			csvmoisture.writerow([time.strftime('%Y/%m/%d %H:%M',time.localtime()), result_humidite, result_moisture1, result_moisture2, result_moisture3, result_moisture4])
			moisturefile.close()
			datafile.close()
		        minute = time.strftime('%M',time.localtime())
		        minute = int(minute)
			minute= 15 - minute%15
			print "sleep"
			time.sleep(minute*60)