Python SocketServer.ThreadingTCPServer.__init__() Examples

The following are 30 code examples of SocketServer.ThreadingTCPServer.__init__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module SocketServer.ThreadingTCPServer , or try the search function .
Example #1
Source File: proxy.py    From xbmc with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, settings):
        """ Initialisation of the Proxy TCP server """
        self._s = settings  # Make settings available to the RequestHandler

        from socket import socket, AF_INET, SOCK_STREAM
        sock = socket(AF_INET, SOCK_STREAM)

        while True:
            try:
                sock.bind(('127.0.0.1', 0))
                _, port = sock.getsockname()
                sock.close()
                ThreadingTCPServer.__init__(self, ('127.0.0.1', port), ProxyHTTPD)
                self.port = port  # Save the current binded port
                break
            except:
                pass 
Example #2
Source File: __init__.py    From nightmare with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, host="", port=COBRASSL_PORT, sslVerify = False, sslKey = None, sslCert = None):
        CobraDaemon.__init__(self, host=host, port=COBRASSL_PORT)
        sslContext = OpenSSL.SSL.Context(OpenSSL.SSL.SSLv3_METHOD)

        if verbose: print "SSL: Setting up SSL (daemon)"

        try:
            if sslVerify:
                setSslVerify(sslContext)

            setSslKey(sslContext, sslKey)
            setSslCert(sslContext, sslCert)
            sslContext.check_privatekey()

            ssock = OpenSSL.SSL.Connection(sslContext, self.socket)
            ssock.set_connect_state()
            self.socket = ssock
        except:
            raise "SSL: SSL setup failed" 
Example #3
Source File: test_logging.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def __init__(self):
        SpecificLevelFilter.__init__(self, GARRULOUS)

#
#   Now, let's demonstrate filtering at the logger. This time, use a filter
#   which excludes SOCIABLE and TACITURN messages. Note that GARRULOUS events
#   are still excluded.
# 
Example #4
Source File: config.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, config):
        self.config = ConvertingDict(config)
        self.config.configurator = self
        # Issue 12718: winpdb replaces __import__ with a Python function, which
        # ends up being treated as a bound method. To avoid problems, we
        # set the importer on the instance, but leave it defined in the class
        # so existing code doesn't break
        if type(__import__) == types.FunctionType:
            self.importer = __import__ 
Example #5
Source File: config.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, rcvr, hdlr, port):
            super(Server, self).__init__()
            self.rcvr = rcvr
            self.hdlr = hdlr
            self.port = port
            self.ready = threading.Event() 
Example #6
Source File: config.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
                     handler=None, ready=None):
            ThreadingTCPServer.__init__(self, (host, port), handler)
            logging._acquireLock()
            self.abort = 0
            logging._releaseLock()
            self.timeout = 1
            self.ready = ready 
Example #7
Source File: config.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, config):
        self.config = ConvertingDict(config)
        self.config.configurator = self 
Example #8
Source File: config.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def __init__(self, config):
        self.config = ConvertingDict(config)
        self.config.configurator = self
        # Issue 12718: winpdb replaces __import__ with a Python function, which
        # ends up being treated as a bound method. To avoid problems, we
        # set the importer on the instance, but leave it defined in the class
        # so existing code doesn't break
        if type(__import__) == types.FunctionType:
            self.importer = __import__ 
Example #9
Source File: config.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, rcvr, hdlr, port):
            super(Server, self).__init__()
            self.rcvr = rcvr
            self.hdlr = hdlr
            self.port = port
            self.ready = threading.Event() 
Example #10
Source File: config.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, config):
        self.config = ConvertingDict(config)
        self.config.configurator = self 
Example #11
Source File: config.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
                     handler=None, ready=None):
            ThreadingTCPServer.__init__(self, (host, port), handler)
            logging._acquireLock()
            self.abort = 0
            logging._releaseLock()
            self.timeout = 1
            self.ready = ready 
Example #12
Source File: config.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, rcvr, hdlr, port):
            super(Server, self).__init__()
            self.rcvr = rcvr
            self.hdlr = hdlr
            self.port = port
            self.ready = threading.Event() 
Example #13
Source File: config.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, config):
        self.config = ConvertingDict(config)
        self.config.configurator = self 
Example #14
Source File: config.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
                     handler=None, ready=None):
            ThreadingTCPServer.__init__(self, (host, port), handler)
            logging._acquireLock()
            self.abort = 0
            logging._releaseLock()
            self.timeout = 1
            self.ready = ready 
Example #15
Source File: test_logging.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, host='localhost',
                             port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
                     handler=LogRecordStreamHandler):
        ThreadingTCPServer.__init__(self, (host, port), handler)
        self.abort = False
        self.timeout = 0.1
        self.finished = threading.Event() 
Example #16
Source File: config.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
                     handler=None, ready=None):
            ThreadingTCPServer.__init__(self, (host, port), handler)
            logging._acquireLock()
            self.abort = 0
            logging._releaseLock()
            self.timeout = 1
            self.ready = ready 
Example #17
Source File: config.py    From python-scripts with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, config):
        self.config = ConvertingDict(config)
        self.config.configurator = self
        # Issue 12718: winpdb replaces __import__ with a Python function, which
        # ends up being treated as a bound method. To avoid problems, we
        # set the importer on the instance, but leave it defined in the class
        # so existing code doesn't break
        if type(__import__) == types.FunctionType:
            self.importer = __import__ 
Example #18
Source File: test_logging.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, host='localhost',
                             port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
                     handler=LogRecordStreamHandler):
        ThreadingTCPServer.__init__(self, (host, port), handler)
        self.abort = False
        self.timeout = 0.1
        self.finished = threading.Event() 
Example #19
Source File: config.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
                     handler=None, ready=None):
            ThreadingTCPServer.__init__(self, (host, port), handler)
            logging._acquireLock()
            self.abort = 0
            logging._releaseLock()
            self.timeout = 1
            self.ready = ready 
Example #20
Source File: config.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, config):
        self.config = ConvertingDict(config)
        self.config.configurator = self 
Example #21
Source File: config.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, rcvr, hdlr, port):
            super(Server, self).__init__()
            self.rcvr = rcvr
            self.hdlr = hdlr
            self.port = port
            self.ready = threading.Event() 
Example #22
Source File: config.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
                     handler=None, ready=None):
            ThreadingTCPServer.__init__(self, (host, port), handler)
            logging._acquireLock()
            self.abort = 0
            logging._releaseLock()
            self.timeout = 1
            self.ready = ready 
Example #23
Source File: config.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, config):
        self.config = ConvertingDict(config)
        self.config.configurator = self 
Example #24
Source File: socks5.py    From pysocks with Apache License 2.0 5 votes vote down vote up
def __init__(self, port, auth=False, user_manager=UserManager(), allowed=None):
        ThreadingTCPServer.__init__(self, ('', port), Socks5RequestHandler)
        self.__port = port
        self.__users = {}
        self.__auth = auth
        self.__user_manager = user_manager
        self.__sessions = {}
        self.allowed = allowed 
Example #25
Source File: socks5.py    From pysocks with Apache License 2.0 5 votes vote down vote up
def __init__(self, request, client_address, server):
        StreamRequestHandler.__init__(self, request, client_address, server) 
Example #26
Source File: socks5.py    From pysocks with Apache License 2.0 5 votes vote down vote up
def __init__(self, username, password):
        self.__username = username
        self.__password = password 
Example #27
Source File: socks5.py    From pysocks with Apache License 2.0 5 votes vote down vote up
def __init__(self, remote_server_host, remote_server_port, session):
        self.__proxy_socket = socket(AF_INET, SOCK_STREAM)
        self.__remote_server_host = remote_server_host
        self.__remote_server_port = remote_server_port
        self.__client = session.get_client_socket()
        self.__session = session 
Example #28
Source File: socks5.py    From pysocks with Apache License 2.0 5 votes vote down vote up
def __init__(self, socket1, socket2):
        self._socket1 = socket1
        self._socket2 = socket2
        self.__running = False 
Example #29
Source File: socks5.py    From pysocks with Apache License 2.0 5 votes vote down vote up
def __init__(self, value):
        self.__value = value 
Example #30
Source File: socks5.py    From pysocks with Apache License 2.0 5 votes vote down vote up
def __init__(self, client_socket):
        Session.index += 1
        self.__id = Session.index
        self.__client_socket = client_socket
        self._attr = {}