Portforwarding using Twisted, Python
This is a very short proxy written in Python using Twisted 1.3. It forwards port 1080 to localhost:80.
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()
Short and sweet, I think.
Close this Window Bookmark and Share This Page
Copy HTML:
If you like this then please subscribe to the RSS Feed.
![[Digg]](http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png)
![[Reddit]](http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png)
Leave a comment