[root@lowsend netcat-0.7.1]# nc -t -L 10.0.0.11:22 -n
-v -v -p 8099 Listening on any address 8099 |
-t |
This setups a TCP tunnel |
-L |
This is for the actual forwarding, the syntax is the
server:port. The server is the server which has the port you want to
forward |
-n |
Do not do any host resolving |
-v |
Be verbose, twice for more |
-p |
this is the port netcat must listen on for connections |
[root@localhost root]# ssh -p 8099 bob@10.0.0.50 bob@10.0.0.50's password: [bob@syplh bob]$ ifconfig eth0 Link encap:Ethernet HWaddr 00:10:5A:32:1A:61 inet addr:10.0.0.11 Bcast:10.0.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:63897 errors:3 dropped:0 overruns:0 frame:5 TX packets:45977 errors:0 dropped:0 overruns:0 carrier:0 collisions:254 txqueuelen:100 RX bytes:16639255 (15.8 Mb) TX bytes:7038322 (6.7 Mb) Interrupt:9 Base address:0xe880 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:7430 errors:0 dropped:0 overruns:0 frame:0 TX packets:7430 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:576104 (562.6 Kb) TX bytes:576104 (562.6 Kb) |
[root@localhost sandbox]# nc -l -t -n -p 1234 >
./file.txt |
[root@lowsend sandbox]# cat ./file.txt 1 2 3 12 23 34 [root@lowsend sandbox]# cat ./file.txt | nc -c -n -t -v -v 192.168.10.80 1234 192.168.10.80 1234 open Total received bytes: 0 Total sent bytes: 15 [root@lowsend sandbox]# |
[root@localhost sandbox]# cat ./file.txt 1 2 3 12 23 34 [root@localhost sandbox]# |
[root@lowsend sandbox]# tar -c ./netcat-0.7.1 | nc -t
-c -n -v -v -l -p 1234 Listening on any address 1234 |
[root@localhost sandbox]# nc -t 10.0.0.50 1234 >
./nc.tar [root@localhost sandbox]# tar -tf ./nc.tar ./netcat-0.7.1/ ./netcat-0.7.1/m4/ ./netcat-0.7.1/m4/lib-link.m4 ./netcat-0.7.1/m4/inttypes_h.m4 | <lotsa files> | ./netcat-0.7.1/Makefile ./netcat-0.7.1/config.h ./netcat-0.7.1/stamp-h1 |
[root@lowsend sandbox]# tar -c ./netcat-0.7.1 | gzip -9
| ssh 192.168.10.80 "cat - > nc.tar.gz" |
[root@localhost root]# gzip -v -t nc.tar.gz nc.tar.gz: OK [root@localhost root]# cat ./nc.tar.gz | gzip -d | tar -t ./netcat-0.7.1/ ./netcat-0.7.1/m4/ ./netcat-0.7.1/m4/lib-link.m4 ./netcat-0.7.1/m4/inttypes_h.m4 ./netcat-0.7.1/m4/lcmessage.m4 | <lotsa files> | ./netcat-0.7.1/Makefile ./netcat-0.7.1/config.h ./netcat-0.7.1/stamp-h1 |
[root@lowsend netcat-0.7.1]# ./configure
CFLAGS=-DGAPING_SECURITY_HOLE && make && make install [root@lowsend sandbox]# nc -c -n -t -v -v -l -e "vmstat 3 3" -p 4567 Listening on any address 4567 |
[root@localhost root]# nc -t -n 10.0.0.50 4567 procs memory swap io system cpu r b w swpd free buff cache si so bi bo in cs us sy id 0 0 0 0 17452 55236 54332 0 0 0 0 2 5 0 0 2 0 0 0 0 17452 55236 54332 0 0 0 3 111 6 1 2 97 0 0 0 0 17452 55236 54332 0 0 0 2 109 6 1 1 97 [root@localhost root]# |