Adding socks5 support to python-irclib
I was playing with IRC and Proxyes a few weeks ago, and I found out that python’s irclib didn’t support them!
It took me like a minute or so to fix it, just overloading socket with socksocket, you can have a look at my fork in github
try:
import socks, os
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5,
os.getenv('proxy_addr'), os.getenv('proxy_port'))
socket.socket = socks.socksocket
except:
pass
So, basically I try importing socks and setting up a default proxy, socks5 (sorry, I haven’t considered socks4 on there), with the environment variables proxy_addr and proxy_port as addr and port.
To use it, you’ll have to get a libirc-based application (there’s a bot included that might be a start) and, before starting it, define proxy_addr and proxy_port
proxy_addr=127.0.0.1; proxy_port=1080; python my_python-irclib_based_foo
Enjoy =)


