Snawoot / rsp

Rapid SSH Proxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Diverse errors in output!

ykh opened this issue · comments

Hi,
I have an issue that I don't have any idea about the reasons!

This is a part of the output:

2023-10-15 00:50:20 INFO     SocksListener: Client ('127.0.0.1', 59164) connected
2023-10-15 00:50:20 ERROR    SocksListener: Connection handler stopped with exception: Incorrect protocol version
Traceback (most recent call last):
  File "/home/yaser/.local/lib/python3.10/site-packages/rsp/sockslistener.py", line 150, in handler
    cmd, dst_addr, dst_port = await self._socks_prologue(reader, writer)
  File "/home/yaser/.local/lib/python3.10/site-packages/rsp/sockslistener.py", line 66, in _socks_prologue
    raise BadVersion("Incorrect protocol version")
rsp.sockslistener.BadVersion: Incorrect protocol version
2023-10-15 00:50:20 INFO     SocksListener: Client ('127.0.0.1', 59164) disconnected
2023-10-15 00:50:20 INFO     SocksListener: Client ('127.0.0.1', 59170) connected
2023-10-15 00:50:21 ERROR    SocksListener: Connection handler stopped with exception: Incorrect protocol version
Traceback (most recent call last):
  File "/home/yaser/.local/lib/python3.10/site-packages/rsp/sockslistener.py", line 150, in handler
    cmd, dst_addr, dst_port = await self._socks_prologue(reader, writer)
  File "/home/yaser/.local/lib/python3.10/site-packages/rsp/sockslistener.py", line 66, in _socks_prologue
    raise BadVersion("Incorrect protocol version")
rsp.sockslistener.BadVersion: Incorrect protocol version
2023-10-15 00:50:21 INFO     SocksListener: Client ('127.0.0.1', 59170) disconnected
2023-10-15 00:50:21 INFO     SocksListener: Client ('127.0.0.1', 50658) disconnected
2023-10-15 00:50:21 INFO     SocksListener: Client ('127.0.0.1', 59186) connected
2023-10-15 00:50:21 ERROR    SocksListener: Connection handler stopped with exception: Incorrect protocol version
Traceback (most recent call last):
  File "/home/yaser/.local/lib/python3.10/site-packages/rsp/sockslistener.py", line 150, in handler
    cmd, dst_addr, dst_port = await self._socks_prologue(reader, writer)
  File "/home/yaser/.local/lib/python3.10/site-packages/rsp/sockslistener.py", line 66, in _socks_prologue
    raise BadVersion("Incorrect protocol version")
rsp.sockslistener.BadVersion: Incorrect protocol version
2023-10-15 00:50:21 INFO     SocksListener: Client ('127.0.0.1', 59186) disconnected
2023-10-15 00:50:22 WARNING  SSHPool: Pool exhausted. Dispatching connection directly to waiter!
2023-10-15 00:50:23 INFO     SocksListener: Client ('127.0.0.1', 50674) disconnected
2023-10-15 00:50:23 INFO     SocksListener: Client ('127.0.0.1', 59196) connected

In most of time, I haven't had any incoming data (download)!

The command that I use:
rsp -L root SERVER_IP 22 -p 2021 -P PASSWORD -n 50

Hi!

It is likely you're trying to use rsp with proxy client software connecting to it via SOCKS4 protocol. It's not supported, use SOCKS5. E.g. set SOCKS5 proxy type in your browser settings.

Thank you @Snawoot for the clue and quick response.
I've checked it.
I use Switchy Omega Proxy extension for Chrome.

I've checked the protocol, and it uses SOCKS5.

image

Is there any possible clue do you think that I could check?

I see configured port in browser extension is 2020 while you run rsp with iption -p 2021. Maybe there is some mismatch?

Sorry, was my mistake that screenshot and command weren't in sync. I'm using 2020 port for both of them.

Okay, look. Here is a fragment of code which causes error "Incorrect protocol version".

    async def _socks_prologue(self, reader, writer):
        ver = await reader.readexactly(1)
        if ver != b'\x05':
            raise BadVersion("Incorrect protocol version")

So, first byte in the connection from client has to be 0x05 which is an indication of protocol version 5. For some reason client which is connecting sends something else. I can't tell why it is happening, but you may try to use Wireshark to dump that communication between server and client to see what garbage browser sends.

Thanks.
Also, maybe I could debug it! Is there any doc about how to build and run it in my own local?

@ykh There is Makefile which contains pretty much all operations which I used to develop this.

Basically all you want is to change source and run just make to install your working copy into venv. And then run app like this: venv/bin/rsp.

I got it, thanks.