Page 3 of 3
Re: Adding SOCKS support for SAB
Posted: November 16th, 2011, 4:24 am
by exussum
sander wrote:FWIW: the smallest SOCKS server on Linux / Ubuntu is this:
You have to type your local login password. And that's it: your SOCKS server is running! (Well, you must have ssh server installed and running).
To test that your SOCKS server is running, you can set your webbrowser's SOCKS setting to 127.0.0.1 and port 1080. It works for my Chrome.
And this way I was able to run the SOCKS-pached version of SABnzbd. Although technically interesting, I don't see a good reason to have SOCKS in SABnzbd; AFAIK, SOCKS is used on corporate networks. On such corporate networks, I would say using SABnzbd is "not done".
PS: If you have a login somewhere on some remote *ix system, you can use that system as a SOCKS too: just type "ssh -D 1080
[email protected]". The SOCKS server will be local, and will tunnel the traffic to / through that remoteserver. So the SOCKS proxy server is a tunnel from your own machine via the remote server to Internet.
Keep using 127.0.0.1 and 1080 as your SOCKS settings in Chrome, and Chrome will use the remoserver.com as SOCKS proxy ... check with
http://whatismyipaddress.com/ or
http://test-ipv6.com/
Yeah thats how i set up Socks servers. Usually without the interactive console either (-N) so just the tunnel is set up
Socks is useful for a few reasons with compression enabled i can download faster than the native connection (usually only about 10% or so)
With news in the UK of BT starting to block nzb providing websites, They may go after speed restricting the newsgroup providers, Socks lets you tunnel just sab traffic as as far as your ISP is concerned your just connecting to the SSH server.
Im gonna do the Socks patch soon see how well it works
Re: Adding SOCKS support for SAB
Posted: November 16th, 2011, 4:41 am
by sander
exussum wrote:
With news in the UK of BT starting to block nzb providing websites, They may go after speed restricting the newsgroup providers, Socks lets you tunnel just sab traffic as as far as your ISP is concerned your just connecting to the SSH server.
Im gonna do the Socks patch soon see how well it works
Ah, interesting point: SOCKS from your home Internet connection as a VPN against nosy governments and other organizations. And the SOCKS-proxy-provider is then your SSH-provider (at least, that's how I tested it). Interesting for a high-tech audience, not the mainstream SABnzbd users.
Do you know if/how you can instruct the SSH-SOCKS-setup to ask for a SOCKS-authentication?
Re: Adding SOCKS support for SAB
Posted: November 16th, 2011, 4:46 am
by sander
PS: instead of making SABnzbd (or any other app) SOCKS-enabled, I believe it's also possible to "SOCKSify" any application by starting it up by socksify. However, I tried 'socksify', and it gave an ugly error.
Re: Adding SOCKS support for SAB
Posted: November 16th, 2011, 11:55 am
by f00b4r
"SOCKSifying" is, by experience, not that effective and usually leeds to app crash... even with the "patch" I gave earlier there is somme issues: for example if you loose network connectivity while downloading (Wifi, etc) then Sab will just stop downloading unless you restart it.
Re: Adding SOCKS support for SAB
Posted: November 16th, 2011, 3:09 pm
by exussum
sander wrote:
Do you know if/how you can instruct the SSH-SOCKS-setup to ask for a SOCKS-authentication?
You mean each time you connect ? Could try something like this
http://bent.latency.net/bent/git/goto-s ... nnect.html
I just use SSH auth when setting the port up.
VPS gives SSH access and can be gotten really cheap at lowendbox.com Ive got one for $20 a year 1000GB a month transfer.
Re: Adding SOCKS support for SAB
Posted: November 16th, 2011, 3:28 pm
by sander
exussum wrote:
VPS gives SSH access and can be gotten really cheap at lowendbox.com Ive got one for $20 a year 1000GB a month transfer.
Wow! Can you give an URL for that VPS-provider? I just got a VPS for 5 US$ per month with 125 GB limit ...
Re: Adding SOCKS support for SAB
Posted: November 16th, 2011, 3:46 pm
by exussum
They change each month with voucher codes
On the front page atm is
CheapVPS Blowout
64MB memory
10GB storage
500GB/month data transfer
$10/Year (+$1 setup fee, coupon code LEBNOV01)
with Cripperz Prodigy
My stack right now has nginx + mysql + php sitting at 30mb - though very little load is on the http server - its all tunnelling
If you want more memory etc with a more reliable host
yourdomaingoeshere
512MB memory, 20GB storage and 1000GB/month data for $40.60/year. If annual payment is not your thing, there’s also LEB10 that gives you 10% off on monthly plans
$5 a month for that in the US is crazy - US bandwidth is really cheap
Re: Adding SOCKS support for SAB
Posted: June 26th, 2012, 3:27 pm
by derdigge
crk wrote:
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
BTW a Socks5 improves my speed from ~110 mbit to ~240 which isnt the End of my Connection, so i think Socks5 support would be a nice
feature for many other users. Now iam not able to use proxycap un my ubuntu box.
So i changed the newswrapper.py like this :
Code: Select all
----------------------------------------------------------------SNIP--------------------------------------------------------------
class NNTP(object):
def __init__(self, host, port, info, sslenabled, nw, user=None, password=None, block=False, write_fds=None):
assert isinstance(nw, NewsWrapper)
self.host = host
self.port = port
self.nw = nw
self.blocking = block
self.error_msg = None
if not info:
if block:
info = GetServerParms(host, port)
else:
raise socket.error(errno.EADDRNOTAVAIL, "Address not available - Check for internet or DNS problems")
af, socktype, proto, canonname, sa = info[0]
if sslenabled and _ssl:
# Some users benefit from SSLv2 not being capped.
ssl_type = sabnzbd.cfg.ssl_type.get()
if ssl_type == 'v2':
ctx = _ssl.Context(_ssl.SSLv2_METHOD)
elif ssl_type == 'v3':
ctx = _ssl.Context(_ssl.SSLv3_METHOD)
else:
ctx = _ssl.Context(_ssl.SSLv23_METHOD)
self.sock = SSLConnection(ctx, socket.socket(af, socktype, proto))
elif sslenabled and not _ssl:
logging.error(Ta('Error importing OpenSSL module. Connecting with NON-SSL'))
self.sock = socks.socksocket(af, socktype, proto)
self.sock.setproxy(socks.PROXY_TYPE_SOCKS5,"1.1.0.248",1080)
else:
self.sock = socks.socksocket(af, socktype, proto)
self.sock.setproxy(socks.PROXY_TYPE_SOCKS5,"1.1.0.248",1080)
----------------------------------------------------------------SNIP--------------------------------------------------------------
1.1.0.248 is just for local testing
But i get an Error launching sabnzbd :
Code: Select all
service sabnzbdplus restart
* SABnzbd+ binary newsgrabber: not running
* Starting SABnzbd+ binary newsgrabber Traceback (most recent call last):
File "/usr/bin/sabnzbdplus", line 66, in <module>
import sabnzbd
File "/usr/share/sabnzbdplus/sabnzbd/__init__.py", line 65, in <module>
from sabnzbd.nzbqueue import NzbQueue
File "/usr/share/sabnzbdplus/sabnzbd/nzbqueue.py", line 40, in <module>
import sabnzbd.downloader
File "/usr/share/sabnzbdplus/sabnzbd/downloader.py", line 32, in <module>
from sabnzbd.newswrapper import NewsWrapper, request_server_info
File "/usr/share/sabnzbdplus/sabnzbd/newswrapper.py", line 173
self.sock.setproxy(socks.PROXY_TYPE_SOCKS5,"1.1.0.248",1080)
^
IndentationError: unexpected indent
I am pretty sure i missunderstood the instructions. Iam also absolute not famialar with phyton.
But i can provide an highspeed socks5(Gbit) for testing your pretty-shiny new sabnzbd release :].
Can someone Help me with an "quick" solution?
Thanks!
derdigge
Re: Adding SOCKS support for SAB
Posted: June 26th, 2012, 4:05 pm
by sander
The line "self.sock.setproxy..." should start exactly under the / a previous line.
Re: Adding SOCKS support for SAB
Posted: June 27th, 2012, 9:42 pm
by derdigge
sander wrote:The line "self.sock.setproxy..." should start exactly under the / a previous line.
Thanks for your Reply!
Sorry the / ? where do you mean please?
Re: Adding SOCKS support for SAB
Posted: June 28th, 2012, 12:47 am
by sander
derdigge wrote:sander wrote:The line "self.sock.setproxy..." should start exactly under the / a previous line.
Thanks for your Reply!
Sorry the / ? where do you mean please?
You have
Code: Select all
elif sslenabled and not _ssl:
logging.error(Ta('Error importing OpenSSL module. Connecting with NON-SSL'))
self.sock = socks.socksocket(af, socktype, proto)
self.sock.setproxy(socks.PROXY_TYPE_SOCKS5,"1.1.0.248",1080)
else:
self.sock = socks.socksocket(af, socktype, proto)
self.sock.setproxy(socks.PROXY_TYPE_SOCKS5,"1.1.0.248",1080)
... which is in Python not syntactically correct. It should be:
Code: Select all
elif sslenabled and not _ssl:
logging.error(Ta('Error importing OpenSSL module. Connecting with NON-SSL'))
self.sock = socks.socksocket(af, socktype, proto)
self.sock.setproxy(socks.PROXY_TYPE_SOCKS5,"1.1.0.248",1080)
else:
self.sock = socks.socksocket(af, socktype, proto)
self.sock.setproxy(socks.PROXY_TYPE_SOCKS5,"1.1.0.248",1080)
Do you see the difference? More spaces, so that the lines are lined up.
NB: I have not checked the code itself for you. I'm just reacting to the pyhon error message you posted.
Re: Adding SOCKS support for SAB
Posted: November 16th, 2013, 5:23 pm
by yoblin
In case anyone stumbles across this thread, I've found sshuttle to be the solution I needed on Linux:
sudo apt-get install sshuttle
sshuttle -r my_username@my_vps.com:22 97.141.89.0/21 -v —no-latency-control -D
This will only forward traffic intended for that netmask. You don't even need to restart.
Do a 'whois' on the domain name you want to connect to in order to get their IP block, and use a netmask calculator (
http://easycalculation.com/other/subnet ... ulator.php) to get the correct mask for the command.
Hope that helps someone!
Re: Adding SOCKS support for SAB
Posted: November 16th, 2013, 6:07 pm
by sander
@yoblin:
Cool! Thanks for sharing.
BTW: "fatal: '\xe2\x80\x94no-latency-control' is not a valid IP subnet format" ... I think your one-liner should read --no-latency-control
Re: Adding SOCKS support for SAB
Posted: January 3rd, 2014, 12:33 am
by chris0478
Hi Folks,
I want to use SABnzb with TOR. So I'm running a SOCKS5 proxy on localhost at port 9050. The suggestion with sshuttle wont work for TOR SOCKS... I must have done something wrong while editing the newswrapper.py. I got:
Code: Select all
Traceback (most recent call last):
File "SABnzbd.py", line 66, in <module>
import sabnzbd
File "/opt/SABnzbd-0.7.16/sabnzbd/__init__.py", line 73, in <module>
from sabnzbd.nzbqueue import NzbQueue
File "/opt/SABnzbd-0.7.16/sabnzbd/nzbqueue.py", line 41, in <module>
import sabnzbd.downloader
File "/opt/SABnzbd-0.7.16/sabnzbd/downloader.py", line 33, in <module>
from sabnzbd.newswrapper import NewsWrapper, request_server_info
File "/opt/SABnzbd-0.7.16/sabnzbd/newswrapper.py", line 181
elif sslenabled and not _ssl:
^
IndentationError: unindent does not match any outer indentation level
Could anyone post the full newswrapper.py Maybe also with ssl support?
Best regards
Christian