ssh 通过socks5 代理连接

在kali上 nc默认用的是nc.traditional,不支持代理的。
$ ll /bin/nc
lrwxrwxrwx 1 root root 20 Jan 11  2019 /bin/nc -> /etc/alternatives/nc
$ ll /etc/alternatives/nc
lrwxrwxrwx 1 root root 15 Jan  1 12:06 /etc/alternatives/nc -> /bin/nc.traditional
安装支持socks5的nc
$ sudo apt install  netcat-openbsd -y
然后就可以使用ssh通过socks5代理连接了:
ssh [email protected] -o ProxyCommand='nc -X 5 -x 192.168.x.x:1080 %h %p' -p 22 
或者也可以让ssh通过另一个ssh隧道:
ssh [email protected] -o ProxyCommand='ssh -W %h:%p -oPort=22 -oIdentityFile="~/.ssh/key" 11.22.33.44' -p 22
让连111.222.111.222的ssh 外面裹着 11.22.33.44的ssh隧道。

Leave a Reply

Your email address will not be published. Required fields are marked *