Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOCKS5 Authentication doesn't work. #293

Closed
Rui-Santos opened this issue Jan 25, 2015 · 13 comments
Closed

SOCKS5 Authentication doesn't work. #293

Rui-Santos opened this issue Jan 25, 2015 · 13 comments

Comments

@Rui-Santos
Copy link

I can't seem to open any website when using a SOCKS5 proxy with username:password auth.
I know Firefox doesn't support it, but you guys don't mention such limitation on your docs, that I've seen at least.

@laurentj
Copy link
Owner

Firefox supports socksv5. And the support of sockv5 with password is on the way.

you guys don't mention such limitation on your docs

Well, since SlimerJS is running on top of Firefox/Xulrunner, it's easy to guess that it have all features of Firefox, but also all of its limitation. Isn't it?

@Rui-Santos
Copy link
Author

No worries, I patched xulrunner with this patch here: https://bug122752.bugzilla.mozilla.org/attachment.cgi?id=8496443 on top of this branch https://github.com/mozilla/gecko-dev/tree/GECKO331_2014110614_RELBRANCH and also patched the slConfiguration.jsm file inside omni.ja to write the proxy auth to the prefs.js file.
Apart from the 40 minutes it took to compile xulrunner, it was pretty easy. And it works pretty well!

@laurentj
Copy link
Owner

Your patch on SlimerJs will be welcomed ;-)

@Rui-Santos
Copy link
Author

I don't see the point on patching slimerjs with the 2 lines I added to the slConfiguration.jsm. It only works with a modified xulrunner compiled after applying the patch I linked. Probably the only branch where that patch can be applied cleanly is the one I linked. I'm not capable of porting the patch to newer releases of mozilla and keep the fork updated. I wish I could.

But here is the simple patch.
https://github.com/laurentj/slimerjs/blob/master/src/modules/slConfiguration.jsm#L196

Services.prefs.setIntPref('network.proxy.socks_port', this.proxyPort);
+Services.prefs.setCharPref('network.proxy.socks_password', this.proxyAuthPassword);
+Services.prefs.setCharPref('network.proxy.socks_username', this.proxyAuthUser);
Services.prefs.setIntPref('network.proxy.type',1);

@g0morra
Copy link

g0morra commented Mar 4, 2015

I use proxychains-ng, it supports authentication with socks. I just slotted it into the launcher script I use that configures the profile directory, timezone etc.

If you want to defeat ip detection via flash sockets then you have to run a transparent proxy across all the traffic coming out of your instance. Neither socks nor http proxies are respected by flash for socket connections.

@Rui-Santos
Copy link
Author

The tests I've made using "socksifiers" showed a significant hit in performance, resource and speedwise. And I'm not really trying to avoid proxy detection, anyway.

@g0morra
Copy link

g0morra commented Mar 5, 2015

I would tend to agree but proxychains-ng (which is a rewrite of the venerable proxychains and is a fair bit newer than the rest of the well known proxifiers) has worked really well for me. I'm not suggesting chaining multiple proxies, that's always going to be hopeless for performance. However proxychains-ng works great if you are using a high quality socks or http proxy and there is no appreciable difference compared to using the native Mozilla proxy settings. You can generate the config file that sets the proxy at run time and pass it to your proxychains-ng for each corresponding Slimer instance. I don't know how it would go if you were trying to download huge files, but for general surfing type behaviour it works great. For example with good proxies (not free trash) I've racked up Youtube views using proxychains-ng (flash sockets blocked with the flash mms.cfg file, so you're forcing flash to go through your proxy). If you record the session using ffmpeg you can see the video streaming just fine so the performance is certainly not terrible. Most of your waiting time with an http client is spent waiting for slow http requests to finish anyway, rather than pushing bits through the proxy software itself.

I actually always put all my proxies (both socks and http) through proxychains-ng instead of using the built in Slimer proxy settings, both because it simplifies my launcher script and it also takes care of those few tricky edge cases where you can detect the real IP via javascript if your proxy is set inside the browser rather than your IP being changed by something further down the line. If maintaining your IP is crucial for your use case then you're probably better off with a proxying solution outside the browser.

If you use Windows or Mac there is also a really good paid app called Proxifier (although you can get it for free if you hunt around a bit). It works with socks or http/s proxies and you can set up rules so different apps (e.g. different instances of Slimer) use different proxies. The config file that sets all the proxy rules is just xml so you can easily script generate it. What is really good is that it sets up your socks or http proxies like transparent proxies, catching all your traffic, meaning flash socket traffic will go through your socks proxy and not know any better. Proxifier also proxies websockets perfectly, even with http proxies, which normally break on websockets, depending on proxy and the websocket protocol being used. It's much easier than trying to setup a transparent forwarding proxy with squid etc. to catch all your outgoing traffic. Unfortunately it's a gui app so it won't scale or work so well on a server, and it's not available for Linux or Freebsd.

@Rui-Santos
Copy link
Author

I'm running hundreds of slimerjs/phantomjs instances, each one with its own profile/cookies-file and proxy. I will try your solution also, see if it fits in my workflow. I only use headless ubuntu/centos servers, so Proxifier is out.

@Rui-Santos
Copy link
Author

Just give an update, g0morra is right. I started using proxychains-ng with auto generated proxychains-$PROFILE.conf and it works wonderfully.

@wskorodecki
Copy link
Contributor

I just saw that the code from https://bug122752.bugzilla.mozilla.org/attachment.cgi?id=8496443 patch is already present in Firefox 46.0.1 source code and additionally I implemented #525 which should be enough to work with SOCKS5 Authentication. Can someone confirm that it works?

@laurentj
Copy link
Owner

laurentj commented Oct 6, 2016

Could someone test the current nightly with a socks5 proxy?

@laurentj laurentj removed the wontfix label Oct 6, 2016
@moeenuddin
Copy link

I am trying to setting proxy, in phantomjs it works, while, with same commandline parameters used in slimerjs, its not! Any helpful tip!

--proxy=xx.proxy.net:port --proxy-auth=usrname:wards

@laurentj
Copy link
Owner

@moeenuddin please do not comment in issues that are not related to your problem (or if it is a problem related to socks5, well, you can see it is not already tested..). Please follow guidelines to fill an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants