Posts tagged ‘proxy’

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.

NTLM HTTP authentication proxy

I was looking around for a way to get a Python SOAP client to access a web service hosted in such a way that NTLM authentication was needed. Lacking any indication of built in support in SOAPpy to handle this I turned to trusted old Google. I found this, a small NTLM HTTP authentication proxy written in Python.

Configuration was a breeze, After putting in the domain (NT_DOMAIN) and the user (USER), skipping password (PASSWORD) since it can be done interactively it didn’t quite work. I had to tweak the values for LM_PART, NT_PART, and NTLM_FLAGS, setting them to 1, 1, and 07820000 respecitvely.

I performed my testing downloading the WSDL file using wget.