jquast / x84

A python telnet/ssh server for modern terminals. In spirit of classic software such as ami/x, teleguard, renegade, iniquity.
http://x84.readthedocs.org/
Other
373 stars 56 forks source link

add SOCKS5 support for connecting to irc servers via proxy (enhancement) #282

Closed ghost closed 4 years ago

ghost commented 8 years ago

I'd like to run x84 as a TOR hidden service but in order to keep the service hidden AND use IRC I'd need to send the traffic over the TOR proxy. I've tried making this work in every way I can come up with but apparently my foo is too weak.

tracker1 commented 8 years ago

If you set the HTTP_PROXY and HTTPS_PROXY environment variables to the appropriate proxy settings, does it work?

How to tell Python to automatically use the proxy setting

It's worth noting, that you MUST url-encode any special characters as part of your config...

username: someuser@foo.com
password: p@ssw0rd

HTTP_PROXY=http://someuser%40foo.com:p%23ssw0rd@somehost:8181/
HTTPS_PROXY=http://someuser%40foo.com:p%23ssw0rd@somehost:8181/

You can use encodeURIComponent('p#ssw0rd') in your web browser's dev tools, or in a node repl in order to get the encoded values for the username:password.

jquast commented 8 years ago

I'm certain theres a way to use a socks proxy, though it may require a code change. We'll have a look soon, thanks for asking!

ghost commented 8 years ago

Thanks for taking a look. I'll keep hacking at it as well and see what I can come up with. I setup a dev irc server for some testing.

haliphax commented 8 years ago

Python's irclib does not support SOCKS5 proxies, though there is a fork which does. Not sure that we'd go with something that isn't on pypi, though...

https://github.com/XayOn/python-irclib

haliphax commented 8 years ago

@funkbuddha Have you tried the HTTP_PROXY and HTTPS_PROXY environment variables that @tracker1 mentioned in his comment above? I know it works for urlopen, just not sure if it works with the socket code that irclib uses under the covers...