Howto add SOCKS support to SABnzbd+
For this short howto I'm using the latest version.
1. Download and install the socksipy python package and install it (
http://socksipy.sourceforge.net/ or repository debian "apt-get install python-socksipy" ). Make sure that the lib is put in the python shared folder.
2. Fix the authentification bug in socksipy. This is needed if you are going to use socks proxy with authentification.
In case of installation via repository just search for the socks.py (find / -name "socks.py")
socks.py line 190
replace
Code: Select all
self.sendall("\x01" + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.proxy[5])) + self.__proxy[5])
with
Code: Select all
self.sendall("\x01" + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.__proxy[5])) + self.__proxy[5])
3. Edit /sabnzbd/newswrapper.py
where: line 166 after the else branch
desc: change the object from socket to socks and the method from socket to socksipys socksocket which receives the same arguments
todo:
replace
Code: Select all
self.sock = socket.socket(af, socktype, proto)
with
Code: Select all
self.sock = socks.socksocket(af, socktype, proto)
where: Underneath last insert
desc: Setup proxy connection for object "sock". This one is for authentification with socks5. To use socks4, http and socks4a please read the manual.
todo:
insert
Code: Select all
self.sock.setproxy(socks.PROXY_TYPE_SOCKS5,"IP_OR_DOMAIN",PORT,True,"USERNAME","PASSWORD")
Or - if authentification is not needed, just take:
Code: Select all
self.sock.setproxy(socks.PROXY_TYPE_SOCKS5,"IP_OR_DOMAIN",PORT)
where: import section (line 20-30)
desc: Make the script use socksipy.
todo:
Add new line, for example after line 20
That's it. Now you can connect to server. You can check servers in server setup.
Currently, f00b4r is working on a SSL connection implementation. Time will tell .. weekend will bring
