• Stars
    star
    278
  • Rank 148,454 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rapid SSH Proxy

rsp

rsp

Rapid SSH Proxy. Like ssh -ND, but much faster.

rsp is a SSH client which implements SOCKS5 proxy feature of SSH protocol. Key feature of this implementation is use of multiple connections to overcome downsides of multiplexing many tunneled TCP connections in single SSH session. Multiple sessions are not limited with TCP window size of single connection and packet loss does not affect all tunneled connections at once. In order to cut latency of connection establishment rsp maintains pool of steady connections, which replenished with configurable rate.


❤️ ❤️ ❤️

You can say thanks to the author by donations to these wallets:

  • ETH: 0xB71250010e8beC90C5f9ddF408251eBA9dD7320e
  • BTC:
    • Legacy: 1N89PRvG1CSsUk9sxKwBwudN6TjTPQ1N8a
    • Segwit: bc1qc0hcyxc000qf0ketv4r44ld7dlgmmu73rtlntw

Features

  • High speed as compared to conventional OpenSSH client.
  • Cross-platrorm (Windows, Linux, macOS and other Unix-like systems).
  • Zero-setup required for server. rsp can be used right away with any SSH server.
  • Self-sufficient: doesn't require OpenSSH on client side to operate.
  • SOCKS5 remote DNS support.
  • Connection establishment latency hidden from user with asynchronous connection pool.
  • Connection establishment rate limit guards user from being threated as SSH flood.
  • Supports transparent mode of operation (Linux only), which means rsp can be used on Linux gateway to wrap traffic of entire network seamlessly.

Performance

Tested with Debian 9 server through 100Mbps connection. Round trip time to server is 128 ms, average packet loss is about 0.5%.

Client is a Linux desktop (Fedora 30, Python 3.7.3, OpenSSH 8.0p1).

OpenSSH rsp
Speedtest - OpenSSH Speedtest - rsp

Installation

From PyPI

pip3 install rsp

From source

Run in a source directory:

pip3 install .

Windows note: make sure you have Python3 installed and executable locations added into your PATH enviroment variable (it's an option available during install). Also make sure to run install command from Administrator command line.

From Snap Store

Get it from the Snap Store

sudo snap install rsp

Note: in snap version rsp, rsp-trust and rsp-keygen binaries have names rsp.proxy, rsp.trust and rsp.keygen respectively.

Synopsis

Proxy

$ rsp --help
usage: rsp [-h] [-v {debug,info,warn,error,fatal}] [-l FILE]
           [--disable-uvloop] [-a BIND_ADDRESS] [-p BIND_PORT] [-T]
           [-n POOL_SIZE] [-B BACKOFF] [-w TIMEOUT] [-r CONNECT_RATE]
           [-L LOGIN] [-I KEY_FILE] [-P PASSWORD] [-H FILE]
           [--client-version CLIENT_VERSION]
           dst_address [dst_port]

Rapid SSH Proxy

positional arguments:
  dst_address           target hostname
  dst_port              target port (default: 22)

optional arguments:
  -h, --help            show this help message and exit
  -v {debug,info,warn,error,fatal}, --verbosity {debug,info,warn,error,fatal}
                        logging verbosity (default: info)
  -l FILE, --logfile FILE
                        log file location (default: None)
  --disable-uvloop      do not use uvloop even if it is available (default:
                        False)

listen options:
  -a BIND_ADDRESS, --bind-address BIND_ADDRESS
                        bind address (default: 127.0.0.1)
  -p BIND_PORT, --bind-port BIND_PORT
                        bind port (default: 1080)
  -T, --transparent     transparent mode (default: False)

pool options:
  -n POOL_SIZE, --pool-size POOL_SIZE
                        target number of steady connections (default: 30)
  -B BACKOFF, --backoff BACKOFF
                        delay after connection attempt failure in seconds
                        (default: 5)
  -w TIMEOUT, --timeout TIMEOUT
                        server connect timeout (default: 4)
  -r CONNECT_RATE, --connect-rate CONNECT_RATE
                        limit for new pool connections per second (default:
                        0.5)

SSH options:
  -L LOGIN, --login LOGIN
                        SSH login. Default is name of current user (default:
                        None)
  -I KEY_FILE, --identity KEY_FILE
                        SSH private key file. By default program looks for SSH
                        keys in usual locations, including SSH agent socket.
                        This option may be specified multiple times (default:
                        None)
  -P PASSWORD, --password PASSWORD
                        SSH password. If not specified, password auth will be
                        disabled (default: None)
  -H FILE, --hosts-file FILE
                        overrides known_hosts file location (default:
                        /home/user/.rsp/known_hosts)
  --client-version CLIENT_VERSION
                        override client version string (default: None)

Usage examples

Note: host keys must be added to trusted list before proxy operation. See synopsis for rsp-trust utility.

Connect to example.com with SSH on port 22, using default pool size, and accept SOCKS5 connections on port 1080. Authentication is using SSH Agent and username root.

rsp -L root example.com

Connect to example.net with SSH on port 2222, using private key in file proxy_key and username user.

rsp -I proxy_key -L user example.net 2222

Connect to example.com with SSH on port 22, using password and username of current user:

rsp -P MyGoodPassword example.com

Transparent mode

In order to use rsp in transparent mode you should add -T option to command line and redirect TCP traffic to rsp port like this:

iptables -I PREROUTING 1 -t nat -p tcp -s 192.168.0.0/16 '!' -d 192.168.0.0/16 -j REDIRECT --to 1080

In this example it is assumed your local network is covered by prefix 192.168.0.0/16 and rsp is running on it's default port 1080.

NOTE: any application which supposed to accept REDIRECT-ed connection has to listen address on same interface where connection comes from. So, in this example you should also add command line option like -a 192.168.0.1 or -a 0.0.0.0 to rsp command line. Otherwise redirected connection will be refused. See also man iptables-extension for details on REDIRECT action of iptables.

Trust management utility

$ rsp-trust --help
usage: rsp-trust [-h] [-H FILE] dst_address [dst_port]

Rapid SSH Proxy: TOFU key trust utility

positional arguments:
  dst_address           target hostname
  dst_port              target port (default: 22)

optional arguments:
  -h, --help            show this help message and exit

SSH options:
  -H FILE, --hosts-file FILE
                        overrides known_hosts file location (default:
                        /home/user/.rsp/known_hosts)

Usage examples

Get host key from example.com, port 22

rsp-trust example.com

Get host key from example.net, port 2222 and use non-default location of trusted keys file:

rsp-trust -H myhostkeysfile example.net 2222

Key generation utility

$ rsp-keygen --help
usage: rsp-keygen [-h] [-f FILE]
                  [-t {ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-dss}]
                  [-b BITS]

Rapid SSH Proxy: key generation utility

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  output file name (default: proxy_key)
  -t {ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-dss}, --type {ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-dss}
                        key type (default: ssh-ed25519)
  -b BITS, --bits BITS  key type (default: 2048)

Usage examples

Generate SSH key with good default parameters:

rsp-keygen

Private and public key will be saved to proxy_key and proxy_key.pub respectively.

More Repositories

1

opera-proxy

Standalone client for proxies of Opera VPN
Go
418
star
2

hola-proxy

Standalone Hola proxy client
Go
351
star
3

dumbproxy

Dumbest HTTP proxy ever
Go
183
star
4

hisilicon-dvr-telnet

PoC materials for article https://habr.com/en/post/486856/
C
124
star
5

postfix-mta-sts-resolver

Daemon which provides TLS client policy for Postfix via socketmap, according to domain MTA-STS policy
Python
104
star
6

ss-replit

REPL for replit.com to run shadowsocks server with v2ray-plugin
Shell
99
star
7

windscribe-proxy

Standalone client for proxies of Windscribe browser extension
Go
91
star
8

linux-secureboot-kit

Tool for complete hardening of Linux boot chain with UEFI Secure Boot
Shell
65
star
9

nvidia-patch

This patch removes restriction on maximum number of simultaneous NVENC video encoding sessions imposed by Nvidia to consumer-grade GPUs.
Python
44
star
10

steady-tun

Secure TLS tunnel with pool of prepared upstream connections
Go
42
star
11

ssh-tarpit

SSH tarpit that slowly sends an endless banner
Python
32
star
12

bloom

An in-memory bloom filter with persistence and HTTP interface
C
32
star
13

nth-dump

nthLink API client
Go
31
star
14

php-storageless-sessions

Sessions handler which stores session data in HMAC-signed and encrypted cookies
PHP
30
star
15

hola-proxy-list

Fetches free proxy list via Hola browser extension API
Python
28
star
16

myip

Get your external IP address using multiple STUN servers
Makefile
26
star
17

ptw

Pooling TLS Wrapper
Python
22
star
18

pyknock

UDP port knocking suite with HMAC-PSK authentication.
Python
21
star
19

udpierce

Network wrapper which transports UDP packets over multiple TLS sessions
Go
20
star
20

quickcerts

Quick and easy X.509 certificate generator for SSL/TLS utilizing local PKI
Python
17
star
21

udp-over-tls-pool

Network wrapper which transports UDP packets over multiple TLS sessions
Python
16
star
22

chunk-nordic

Yet another TCP-over-HTTP(S) tunnel
Python
16
star
23

firefox-secure-proxy

Standalone wrapper for Firefox Private Network
Python
16
star
24

httptrap

Web-server which produces infinite chunked-encoded responses to slowdown malicious clients
Go
15
star
25

drb-client

Distributed Randomness Beacon client
Python
11
star
26

shadowsocks-platform.sh

Ready-to-use platform.sh deployment of shadowsocks with v2ray-plugin.
Shell
11
star
27

http-tarpit

Web-server which produces infinite chunked-encoded responses
Python
8
star
28

davclean

Backup cleaner from yandex.disk
Python
8
star
29

flight-recorder

Daemon which tracks system crashes and downtime duration
Python
7
star
30

skype-watch

Simple messages watcher for Skype
Python
6
star
31

docker-warp-proxy

Docker image to run Cloudflare Warp in proxy mode
Dockerfile
5
star
32

trusearch

Perform advanced search on unofficial rutracker.org (ex torrents.ru) XML database
Go
5
star
33

passcheck

Securely check list of passwords against HIBP password database
Go
5
star
34

ssh-honeypot

SSH honeypot. Collects used SSH passwords and issued commands into SQLite3 database.
Python
4
star
35

httpierce

Experimental shadowsocks plugin purposed to bypass captive portals of some mobile ISPs.
Go
4
star
36

cuckoo-filter-redis

Set of Lua stored functions implementing Cuckoo Filter backed by Redis.
Lua
4
star
37

particle-detector

webcam particle detector (prototype)
Python
4
star
38

djinni-profile-updater

Automatically updates your profile on djinni.co
Python
3
star
39

winping

Ping implementation which utilizes Windows ICMP API
Python
3
star
40

riak-bucket-export

Exports RIAK bucket to JSON file
Python
3
star
41

lua-trie

Trie implementation in pure Lua capable to build prefixes from iterable sequences
Lua
3
star
42

extip

Go package which retrieves external address IP using STUN servers
Go
3
star
43

python-cli-tool-boilerplate

Boilerplate of python3 package which provides command line tool
Python
3
star
44

workua-cv-updater

Tool which updates your CV on work.ua
Python
3
star
45

terse

Output randomly sampled lines from input stream or file
Go
3
star
46

ra

Simple sunrise and sunset calculator
Go
2
star
47

cfgfs

FUSE filesystem for wrapping configs from database to readable files
Python
2
star
48

qjson

Helper routines for JSON manipulation in Go
Go
2
star
49

imgopt

Multiprocessor image optimizer which keeps track on already optimized files using its hashes
Python
2
star
50

rabotaua-cv-updater

Tool which updates your CV on rabota.ua
Python
2
star
51

wayd

What Are You Doing? - low-effort time tracking
Shell
2
star
52

fbfeed2rss

Facebook feed to RSS gateway
Python
1
star
53

bson2csv

BSON to CSV converter written in C
C
1
star
54

transmission-resync-rutracker

rutracker plugin for transmission-resync
Makefile
1
star
55

httprobe

Simple tool to test HTTP requests
Makefile
1
star
56

go-sshd

Fork of https://src.whiteboxsystems.nl/Whitebox/go-sshd
Go
1
star