Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update http_proxy_server.py #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AndreC10002
Copy link

Update that prevents the HTTP Proxy from really proxying, returning a dummy content instead.

Update that prevents the HTTP Proxy from really proxying, returning a dummy content instead.
@AndreC10002
Copy link
Author

Sorry, the function should actually look like this instead or the connection with the requesting party will remain open:

        def dataReceived(self, data):
            _q_s.logs.info({'server': 'http_proxy_server', 'action': 'connection', 'src_ip': self.transport.getPeer().host,

'src_port': self.transport.getPeer().port, 'dest_ip': _q_s.ip, 'dest_port': q_s.port})
with suppress(Exception):
ip = self.resolve_domain(data)
if ip:
#factory = ClientFactory()
#factory.CustomProtocolParent
= self
#factory.protocol = CustomProtocolChild
#reactor.connectTCP(ip, 80, factory)
dummy_response = b"HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nHello world!!!\r\n"
self.transport.write(dummy_response)

                self.transport.loseConnection()

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant