3 ms·
netcat + ssh's -R and -L = unstoppable ssh -D is also awesome for when you need a quick http tunnel. Another trick I picked up is basically: nc -l [port] |
by yan 17y ago
netcat + ssh's -R and -L = unstoppable
ssh -D is also awesome for when you need a quick http tunnel.
Another trick I picked up is basically:
nc -l [port] | named_pipe | nc [other_host] [port]
That will tunnel things between two netcat instances, effectively setting up a tunnel. Replace 'named_pipe' with a shell and you have a quick and dirty remote shell.
- boundlessdreamz 17y agoCan you explain this further. There are three machines A,B,C A can connect to B and B can connect to C but A cannot connect to C How can netcat/ssh be used to forward a port on B such that when A connects to that it connects to C [on a specific port]. basically B acts as a proxy.
- yan 17y agoThis is from memory so take it with a grain of salt: 2048 is the port you're forwarding. Machine B: machine_b$ mkfifo /tmp/tunn machine_b$ nc -k -l 2048 < /tmp/tunn | nc [machine_c] 2048 > /tmp/tunn & You should now have a working tunnel. Everything sent to B on 2048 will be sent to C:2048