Closed hlherrera closed 9 years ago
Since you are only trying to forward one port you can try to use the "--no-socks" option.
Also for SSH you need to use the "-s" option
sudo python proxy.py -u http://myhost.url -l 10400 -r 22 --no-socks -s
Then you would be able to connect with: ssh localhost -p 10400
Also, could you please share some info about your version of python and the host os/kernel version so I can try to debug the issue.
OS/Kernel - Linux Mint 17 Qiana (GNU/Linux 3.13.0-24-generic i686) Python 2.7. sudo python proxy.py -u http://myhost.url -l 10400 -r 22 --no-socks -s In the client, I ran the command above and I had the same error. Later when I try to connect to SSH, I have:
debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 Here it spend long time waiting and then... ssh_exchange_identification: Connection closed by remote host
I pushed some changes that will get rid of the error. Update your copy and give it another go with the same options.
Let me know how it goes
Sorry I didnt pull. I ran in the client:
sudo python proxy.py -u http://myhost.url -l 10400 -r 22 --no-socks -s Everything ok. Because I want to connect to port 22. Later in another console I type: ssh -vvv localhost -p 10400 And I have the following output... OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to localhost [127.0.0.1] port 10400. debug1: Connection established. debug1: identity file /home/angeloty/.ssh/id_rsa type -1 debug1: identity file /home/angeloty/.ssh/id_rsa-cert type -1 debug1: identity file /home/angeloty/.ssh/id_dsa type -1 debug1: identity file /home/angeloty/.ssh/id_dsa-cert type -1 debug1: identity file /home/angeloty/.ssh/id_ecdsa type -1 debug1: identity file /home/angeloty/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/angeloty/.ssh/id_ed25519 type -1 debug1: identity file /home/angeloty/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.
And it take a long time for response.
Strange issue, looks like the connection is made.
I'll try to debug it further and I'll let you know
Edit: Looks like more of an ssh error, how does your server ssh log look (/var/log/auth.log) when you try to connect?
Error is mine. The problem is that I was connected through ssh to a remote computer and I start the server and keep alive the connection in my ssh. Later when a I try to connect with :
ssh localhost -p 10400
The ssh didn't respond. I solved running the webserver phisically in my home computer, not starting it through ssh connection. Thanks.
If I want to make a connection through a proxy. Is this the client command should be executed?
sudo python proxy.py -u http://webserver.com/ -l 10400 -r 22 -x proxyip:3128 -A user:passwd --no-socks -s
You don't need to put the user name and password on the command line, just use -A and it will ask you for both.
This option is still experimental so let me know how it goes :)
I was trying to connect to a server through http proxy server.
python proxy.py -u http://phpworksnow.info/ -l 10400 -r 22 -x http://proxyname:port -A --no-socks -s ...
I've the server running in url http://phpworksnow.info outside the proxy(squid). I had an exception, when I wrote my proxy password:
Password: [+] Spawning keep-alive thread Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 763, in run self.__target(_self.args, _self.__kwargs) File "/home/hermes/Tunna/lib/TunnaClient.py", line 275, in Threaded_request resp = self.HTTPreq(url) File "/home/hermes/Tunna/lib/TunnaClient.py", line 248, in HTTPreq f=opener.open(urllib2.Request(_kargs)) File "/usr/lib/python2.7/urllib2.py", line 410, in open response = meth(req, response) File "/usr/lib/python2.7/urllib2.py", line 523, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python2.7/urllib2.py", line 448, in error return self._call_chain(_args) File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) HTTPError: HTTP Error 403: Forbidden
[+] Checking for proxy: False
That error was by blocked url pattern for my proxy. I changed in settings 127.0.0.1 to localhost and works. How can I do socks proxy? I need to configure my firefox to surf through a socks proxy
That's easy, just: python proxy.py -u http://url/ -l 8080
And set up Firefox to use a socks 4a proxy on localhost 8080
I have a corporative http proxy that block my (out-in)bound connections, only permits connection through ports 80 and 443. I have a server in Internet, outside my restricted LAN. The proxy needs authentication. I need to surf any site in the internet since my work computer. What command I should to use?
In that case I guess that you should use it as before just remove the -s,-r and --no-socks option. Eg.
python proxy.py -u http://phpworksnow.info/ -l 8080 -x http://proxyname:port -A
And set Firefox to connect at localhost 8080
I need to make a SOCKS proxy in my WorkPC to tunnel connection over http to my HomePC. When I try to connect to server I have an error. Im trying to connect my work pc with my home pc. In my HomePC:
In my Work PC:
Exception in thread SocketServer: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 763, in run self.__target(_self.args, *_self.__kwargs) File "/home/hermes/Tunna/lib/SocksServer.py", line 29, in run wrapper_channel, address = self.server.accept() File "/usr/lib/python2.7/socket.py", line 202, in accept sock, addr = self._sock.accept() error: [Errno 11] Resource temporarily unavailable
[+] Socket Connected To SocksProxy Exception: {'socket': <socket._socketobject object at 0x7f0a088c2d00>, 'ip': '127.0.0.1', 'SocksThread': <Thread(SocketServer, stopped daemon 139681086818048)>, 'socks': True, 'running': 1, 'port': '22'} [Errno 107] Transport endpoint is not connected
In my client I have opened the port 10400. [+] Checking for proxy: True [+] Starting Socket Server [S] Fri Dec 12 16:32:08 2014 Server Starts - localhost:10400. ...