コード例 #1
0
ファイル: hxsocks.py プロジェクト: v3aqb/fwlite
 def __init__(self, hxsServer, ctimeout=4, parentproxy=None):
     basesocket.__init__(self)
     if not isinstance(hxsServer, ParentProxy):
         hxsServer = ParentProxy(hxsServer, hxsServer)
     self.hxsServer = hxsServer
     self.timeout = ctimeout
     if parentproxy and not isinstance(parentproxy, ParentProxy):
         parentproxy = ParentProxy(parentproxy, parentproxy)
     self.parentproxy = parentproxy
     self.PSK = urlparse.parse_qs(self.hxsServer.parse.query).get('PSK', [''])[0]
     self.method = urlparse.parse_qs(self.hxsServer.parse.query).get('method', [DEFAULT_METHOD])[0].lower()
     self.hash_algo = urlparse.parse_qs(self.hxsServer.parse.query).get('hash', [DEFAULT_HASH])[0].upper()
     self.serverid = (self.hxsServer.username, self.hxsServer.hostname)
     self.cipher = None
     self._data_bak = None
     self.readable = 0
     self.writeable = 0
     self.pooled = 0
     # TODO: send custom headers
     self._http_obfs = self.hxsServer.query.get('obfs', [''])[0] == 'http'
     self._http_header = b'GET / HTTP/1.1\r\n'
     self._http_header += b'Host: %s\r\n' % self.hxsServer.query.get('hostname', ['www.baidu.com'])[0].encode()
     self._http_header += b'User-Agent: %s\r\n' % self.hxsServer.query.get('UA', ['curl/7.18.1'])[0].encode()
     self._http_header += b'Upgrade: websocket\r\nConnection: Upgrade\r\n'
     self._http_header += b'Sec-WebSocket-Key: ' + base64.b64encode(os.urandom(16))
     self._http_header += b'\r\n\r\n'
     self._header_sent = False
     self._header_received = False
コード例 #2
0
 def __init__(self, hxsServer, ctimeout=4, parentproxy=None):
     basesocket.__init__(self)
     if not isinstance(hxsServer, ParentProxy):
         hxsServer = ParentProxy(hxsServer, hxsServer)
     self.hxsServer = hxsServer
     self.timeout = ctimeout
     if parentproxy and not isinstance(parentproxy, ParentProxy):
         parentproxy = ParentProxy(parentproxy, parentproxy)
     self.parentproxy = parentproxy
     self.PSK = urlparse.parse_qs(self.hxsServer.parse.query).get(
         'PSK', [''])[0]
     self.method = urlparse.parse_qs(self.hxsServer.parse.query).get(
         'method', [DEFAULT_METHOD])[0].lower()
     self.hash_algo = urlparse.parse_qs(self.hxsServer.parse.query).get(
         'hash', [DEFAULT_HASH])[0].upper()
     self.serverid = (self.hxsServer.username, self.hxsServer.hostname)
     self.cipher = None
     self._data_bak = None
     self.readable = 0
     self.writeable = 0
     self.pooled = 0
     # TODO: send custom headers
     self._http_obfs = self.hxsServer.query.get('obfs', [''])[0] == 'http'
     self._http_header = b'GET / HTTP/1.1\r\n'
     self._http_header += b'Host: %s\r\n' % self.hxsServer.query.get(
         'hostname', ['www.baidu.com'])[0].encode()
     self._http_header += b'User-Agent: %s\r\n' % self.hxsServer.query.get(
         'UA', ['curl/7.18.1'])[0].encode()
     self._http_header += b'Upgrade: websocket\r\nConnection: Upgrade\r\n'
     self._http_header += b'Sec-WebSocket-Key: ' + base64.b64encode(
         os.urandom(16))
     self._http_header += b'\r\n\r\n'
     self._header_sent = False
     self._header_received = False
コード例 #3
0
ファイル: shadowsocks.py プロジェクト: fengyq/fwlite
 def __init__(self, ssServer=None, ctimeout=1, parentproxy=None, iplist=None):
     basesocket.__init__(self)
     if ssServer and not isinstance(ssServer, ParentProxy):
         ssServer = ParentProxy(ssServer, ssServer)
     self.ssServer = ssServer
     self.timeout = ctimeout
     if parentproxy and not isinstance(parentproxy, ParentProxy):
         parentproxy = ParentProxy(parentproxy, parentproxy)
     self.parentproxy = parentproxy
     self.crypto = None
     self.connected = False
コード例 #4
0
ファイル: sssocket.py プロジェクト: DVSUHZ-g/fwlite
 def __init__(self, ssServer=None, ctimeout=1, parentproxy=None):
     basesocket.__init__(self)
     if ssServer and not isinstance(ssServer, ParentProxy):
         ssServer = ParentProxy(ssServer, ssServer)
     self.ssServer = ssServer
     self.timeout = ctimeout
     if parentproxy and not isinstance(parentproxy, ParentProxy):
         parentproxy = ParentProxy(parentproxy, parentproxy)
     self.parentproxy = parentproxy
     self.crypto = None
     self.connected = False
コード例 #5
0
ファイル: sssocket.py プロジェクト: v3aqb/fwlite
 def __init__(self, ssServer=None, ctimeout=1, parentproxy=None):
     basesocket.__init__(self)
     if ssServer and not isinstance(ssServer, ParentProxy):
         ssServer = ParentProxy(ssServer, ssServer)
     self.ssServer = ssServer
     self.timeout = ctimeout
     if parentproxy and not isinstance(parentproxy, ParentProxy):
         parentproxy = ParentProxy(parentproxy, parentproxy)
     self.parentproxy = parentproxy
     self.crypto = None
     self.__ota = False
     self._ota_chunk_idx = 0
     self.connected = False
     # TODO: send custom headers
     self._http_obfs = self.ssServer.query.get('obfs', [''])[0] == 'http'
     self._http_obfs_host = self.ssServer.query.get('hostname', ['www.baidu.com'])[0]
     self._http_obfs_ua = self.ssServer.query.get('UA', ['curl/7.18.1'])[0]
     self._header_received = False
コード例 #6
0
ファイル: hxsocks.py プロジェクト: dalian3164/fwlite
 def __init__(self, hxsServer, ctimeout=4, parentproxy=None):
     basesocket.__init__(self)
     if not isinstance(hxsServer, ParentProxy):
         hxsServer = ParentProxy(hxsServer, hxsServer)
     self.hxsServer = hxsServer
     self.timeout = ctimeout
     if parentproxy and not isinstance(parentproxy, ParentProxy):
         parentproxy = ParentProxy(parentproxy, parentproxy)
     self.parentproxy = parentproxy
     self.PSK = urlparse.parse_qs(self.hxsServer.parse.query).get('PSK', [''])[0]
     self.method = urlparse.parse_qs(self.hxsServer.parse.query).get('method', [DEFAULT_METHOD])[0].lower()
     self.hash_algo = urlparse.parse_qs(self.hxsServer.parse.query).get('hash', [DEFAULT_HASH])[0].upper()
     self.serverid = (self.hxsServer.username, self.hxsServer.hostname)
     self.cipher = None
     self._data_bak = None
     self.readable = 0
     self.writeable = 0
     self.pooled = 0
コード例 #7
0
ファイル: hxsocks.py プロジェクト: s265925/fwlite
 def __init__(self, hxsServer=None, ctimeout=4, parentproxy=None):
     basesocket.__init__(self)
     if hxsServer and not isinstance(hxsServer, ParentProxy):
         hxsServer = ParentProxy(hxsServer, hxsServer)
     self.hxsServer = hxsServer
     self.timeout = ctimeout
     if parentproxy and not isinstance(parentproxy, ParentProxy):
         parentproxy = ParentProxy(parentproxy, parentproxy)
     self.parentproxy = parentproxy
     if self.hxsServer:
         self.PSK = urlparse.parse_qs(self.hxsServer.parse.query).get('PSK', [''])[0]
         self.method = urlparse.parse_qs(self.hxsServer.parse.query).get('method', [default_method])[0].lower()
         self.serverid = (self.hxsServer.username, self.hxsServer.hostname)
     self.cipher = None
     self.connected = 0
     # value: 0: request not sent
     #        1: request sent, no server response received
     #        2: server response received
     self._data_bak = None
コード例 #8
0
ファイル: sssocket.py プロジェクト: FlyOverGFW/fwlite
 def __init__(self, ssServer=None, ctimeout=1, parentproxy=None):
     basesocket.__init__(self)
     if ssServer and not isinstance(ssServer, ParentProxy):
         ssServer = ParentProxy(ssServer, ssServer)
     self.ssServer = ssServer
     self.timeout = ctimeout
     if parentproxy and not isinstance(parentproxy, ParentProxy):
         parentproxy = ParentProxy(parentproxy, parentproxy)
     self.parentproxy = parentproxy
     self.crypto = None
     self.__ota = False
     self._ota_chunk_idx = 0
     self.connected = False
     # TODO: send custom headers
     self._http_obfs = self.ssServer.query.get('obfs', [''])[0] == 'http'
     self._http_obfs_host = self.ssServer.query.get('hostname',
                                                    ['www.baidu.com'])[0]
     self._http_obfs_ua = self.ssServer.query.get('UA', ['curl/7.18.1'])[0]
     self._header_received = False
コード例 #9
0
 def __init__(self, hxsServer=None, ctimeout=4, parentproxy=None):
     basesocket.__init__(self)
     if hxsServer and not isinstance(hxsServer, ParentProxy):
         hxsServer = ParentProxy(hxsServer, hxsServer)
     self.hxsServer = hxsServer
     self.timeout = ctimeout
     if parentproxy and not isinstance(parentproxy, ParentProxy):
         parentproxy = ParentProxy(parentproxy, parentproxy)
     self.parentproxy = parentproxy
     if self.hxsServer:
         self.PSK = urlparse.parse_qs(self.hxsServer.parse.query).get(
             'PSK', [''])[0]
         self.method = urlparse.parse_qs(self.hxsServer.parse.query).get(
             'method', [default_method])[0].lower()
         self.serverid = (self.hxsServer.username, self.hxsServer.hostname)
     self.cipher = None
     self.connected = 0
     # value: 0: request not sent
     #        1: request sent, no server response received
     #        2: server response received
     self._data_bak = None