Exemplo n.º 1
0
    def __init__(self):
        threading.Thread.__init__(self)

        print "OmenServer starting..."

        self.config_init()
        self.key = hashlib.sha256(self.key).digest()

        # Socket Setup
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.sock.bind(("", self.port))
        self.sock.listen(5)
        # Client Setup
        self.descriptors = [self.sock]
        self.clients = {}
        self.client_id = 0

        print "OmenServer started on port {0}".format(self.port)
        print "OmenControlServer starting..."
        self.control_server = OmenControlServer(self.admin_port, self.key,
                                                self.admin_key, self,
                                                self.admin_max_users)

        self.control_server.start()
        print "OmenControlServer started on port {0}".format(self.admin_port)
Exemplo n.º 2
0
class OmenServer(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)

        print "OmenServer starting..."

        self.config_init()
        self.key = hashlib.sha256(self.key).digest()

        # Socket Setup
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.sock.bind(("", self.port))
        self.sock.listen(5)
        # Client Setup
        self.descriptors = [self.sock]
        self.clients = {}
        self.client_id = 0

        print "OmenServer started on port {0}".format(self.port)
        print "OmenControlServer starting..."
        self.control_server = OmenControlServer(self.admin_port, self.key,
                                                self.admin_key, self,
                                                self.admin_max_users)

        self.control_server.start()
        print "OmenControlServer started on port {0}".format(self.admin_port)

    def config_init(self):
        self.config = ConfigParser.ConfigParser()

        try:
            self.config.read("{0}\\OmenConfig.cfg".format(os.getcwd()))
        except IOError, e:
            print "WARNING: ERROR READING CONFIG FILE\n{0}\nUSING DEFAULT!".format(
                e)
            self.key = "samplekey"
            self.port = 9001
            self.admin_port = 9002
            self.admin_max_users = 5
            self.admin_key = "password"

        self.key = ConfigSectionMap(self.config, "Encryption")["aes_key"]
        self.port = int(ConfigSectionMap(self.config, "Network")["port"])
        self.admin_port = int(
            ConfigSectionMap(self.config, "Network")["admin_port"])
        self.admin_max_users = int(
            ConfigSectionMap(self.config, "Admin")["admin_max_users"])
        self.admin_key = (ConfigSectionMap(self.config, "Admin")["admin_key"])
Exemplo n.º 3
0
    def __init__(self):
        threading.Thread.__init__(self)

        print "OmenServer starting..."

        self.config_init()
        self.key = hashlib.sha256(self.key).digest()

        # Socket Setup
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.sock.bind(("", self.port))
        self.sock.listen(5)
        # Client Setup
        self.descriptors = [self.sock]
        self.clients = {}
        self.client_id = 0

        print "OmenServer started on port {0}".format(self.port)
        print "OmenControlServer starting..."
        self.control_server = OmenControlServer(self.admin_port, self.key,
                                            self.admin_key, self, self.admin_max_users)

        self.control_server.start()
        print "OmenControlServer started on port {0}".format(self.admin_port)
Exemplo n.º 4
0
class OmenServer(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)

        print "OmenServer starting..."

        self.config_init()
        self.key = hashlib.sha256(self.key).digest()

        # Socket Setup
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.sock.bind(("", self.port))
        self.sock.listen(5)
        # Client Setup
        self.descriptors = [self.sock]
        self.clients = {}
        self.client_id = 0

        print "OmenServer started on port {0}".format(self.port)
        print "OmenControlServer starting..."
        self.control_server = OmenControlServer(self.admin_port, self.key,
                                            self.admin_key, self, self.admin_max_users)

        self.control_server.start()
        print "OmenControlServer started on port {0}".format(self.admin_port)

    def config_init(self):
        self.config = ConfigParser.ConfigParser()

        try:
            self.config.read("{0}\\OmenConfig.cfg".format(os.getcwd()))
        except IOError, e:
            print "WARNING: ERROR READING CONFIG FILE\n{0}\nUSING DEFAULT!".format(e)
            self.key = "samplekey"
            self.port = 9001
            self.admin_port = 9002
            self.admin_max_users = 5
            self.admin_key = "password"

        self.key = ConfigSectionMap(self.config, "Encryption")["aes_key"]
        self.port = int(ConfigSectionMap(self.config, "Network")["port"])
        self.admin_port = int(ConfigSectionMap(self.config, "Network")["admin_port"])
        self.admin_max_users = int(ConfigSectionMap(self.config, "Admin")["admin_max_users"])
        self.admin_key = (ConfigSectionMap(self.config, "Admin")["admin_key"])