Skip to content

Instantly share code, notes, and snippets.

@allanlei allanlei/forward.py
Last active Aug 29, 2015

Embed
What would you like to do?
Twisted portforwarding. Source: http://therning.org/magnus/archives/30
from twisted.internet import reactor
from twisted.protocols import portforward
def server_dataReceived(self, data):
print 'Server received data:', data
portforward.Proxy.dataReceived(self, data)
portforward.ProxyServer.dataReceived = server_dataReceived
def client_dataReceived(self, data):
print 'Client received data:', data
portforward.Proxy.dataReceived(self, data)
portforward.ProxyClient.dataReceived = client_dataReceived
reactor.listenTCP(1080, portforward.ProxyFactory('localhost', 80))
reactor.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.