Esempio n. 1
0
            def dataReceived(self, data):
                _q_s.logs.info([
                    "servers", {
                        'server': 'http_proxy_server',
                        'action': 'connection',
                        'ip': self.transport.getPeer().host,
                        'port': self.transport.getPeer().port
                    }
                ])
                try:
                    ip = self.resolve_domain(data)
                    if ip:
                        factory = ClientFactory()
                        factory.CustomProtocolParent_ = self
                        factory.protocol = CustomProtocolChild
                        reactor.connectTCP(ip, 80, factory)
                    else:
                        self.transport.loseConnection()

                    if self.client:
                        self.client.write(data)
                    else:
                        self.buffer = data
                except:
                    pass
Esempio n. 2
0
            def dataReceived(self, data):
                try:
                    ip = self.resolve_domain(data)
                    if ip:
                        factory = ClientFactory()
                        factory.CustomProtocolParent_ = self
                        factory.protocol = CustomProtocolChild
                        reactor.connectTCP(ip, 80, factory)
                    else:
                        self.transport.loseConnection()

                    if self.client:
                        self.client.write(data)
                    else:
                        self.buffer = data
                except:
                    pass