def main(options, args):

    if options.CA:
        if options.port != None:
            runca(options.port)
        else:
            print("-p is required to run ca")
            exit(0)

    elif options.server:
        if (options.port != None) and (options.caIP !=
                                       None) and (options.caPort != None):
            runServer(options.port, options.caIP, options.caPort)

        else:
            print("-p is required to run server")
            exit(0)
    elif options.client:
        if (options.serverIP != None) and (options.serverPort != None) and (
                options.caIP != None) and (options.caPort != None):
            runClient(options.serverIP, options.serverPort, options.caIP,
                      options.caPort)

        else:
            print("-i -j -k -l options are required to run client")
            exit(0)
示例#2
0
def main():
    type_of_host = sys.argv[1]
    # Port number that RxP's UDP-based socket will bind to (Odd for server, even for client)
    portNumber = int(sys.argv[2])
    # IP of NetEmu
    netEmu_IP = sys.argv[3]
    # NetEmu's port number
    netEmu_Port = sys.argv[4]

    if type_of_host == "client":
        client.runClient(portNumber, netEmu_IP, netEmu_Port)
    elif type_of_host == "server":
        server.runServer(portNumber, netEmu_IP, netEmu_Port)
    else:
        print("Invalid request. Please try again.")
        sys.exit()
示例#3
0
    def editconfig(self, supplier):
        updateType = ['enabled', 'max', 'min', 'user', 'passwd', 'file', 'url', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'times']
        with open("config.yml", 'r') as cfg: # open config to populate certain areas of the GUI
            config = yaml.load(cfg, Loader=yaml.FullLoader)
            cfg.close()

        for value in updateType:
            if value in ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']:
                try:
                    selfval = eval("self." + value)
                    if config['suppliers'][self.supplier]['days'][value] is not selfval:
                        updateStr = "CNFED ['suppliers']['"+self.supplier+"']['days']['"+value+"'] "+str(selfval)
                        client.runClient(ipaddr="192.168.1.99", args=updateStr)
                except:
                   None
            elif value is 'times':
                self.times.sort()
                if config['suppliers'][self.supplier]['times'] != self.times:
                    updateStr = "CNFED ['suppliers']['"+self.supplier+"']['times'] ['"+self.times[0]+"'"
                    for t in range(1, len(self.times)):
                        updateStr += ",'" + self.times[t] + "'"
                    updateStr += "]"
                    client.runClient(ipaddr="192.168.1.99", args=updateStr)
            else:
                try:
                    selfval = eval("self." + value)
                    if config['suppliers'][self.supplier][value] is not selfval:
                        updateStr = "CNFED ['suppliers']['"+self.supplier+"']['"+value+"'] "+str(selfval)
                        result = client.runClient(ipaddr="192.168.1.99", args=updateStr)
                except:
                   None
        client.runClient(ipaddr="192.168.1.99", args="UPDATE")
示例#4
0
runs = 1
headless = False
trackevents = False
host = ''
username = ''
password = ''
duration = 0
connection_string = ''

#get the response
postreqdata = json.loads(os.environ['req'])
#postreqdata = json.loads(open(os.environ['req']).read())
#response = open(os.environ['res'], 'w')

#red the required paramsd
runs = postreqdata['runs']
headless = postreqdata['headless']
trackevents = postreqdata['trackevents']
host = postreqdata['host']
username = postreqdata['username']
password = postreqdata['password']
duration = postreqdata['duration']
connection_string = postreqdata['connection_string']

#acknowledge the params
print("runs {0}, headless: {1}, trackevents: {2}, host: {3}, username: {4}, duration: {5}, connection_string: {6}".format(runs, headless, trackevents, host, username, duration, connection_string))
print("starting client...")

#start the cient
client.runClient(int(runs), bool(int(headless)),  bool(int(trackevents)), host, username, password, int(duration), connection_string)
示例#5
0
import sys, string, os, yaml
import client

with open("config.yml", 'r') as cfg:
    config = yaml.load(cfg, Loader=yaml.FullLoader)

client.runClient("192.168.1.93")
示例#6
0
import server
import client

s = server.runServer()
c = client.runClient()
s.startApp(c, 'weaver')