Netcat as tools in examples part1


NetcatNet cat is very usefull tool file transfer and port scan .

File transer
As server file
If you wont share file from serwer

Server (ip 192.167.1.68)


tar c /home/jacek | nc -q 20 -l - p 6111

-l – start as server mode localhost on port 6111
-q 20 How many time his waiting after having seen an end of file in standard input

Client/Receiver (192.167.1.55)


nc -w 20  192.167.1.68 6111 > myhome.tar


And you can also clone partition with dd
server(receiver 192.168.1.62)

nc -l -p 101 | dd of /dev/sda

Sender

dd id=/dev/sda | nc 192.168.1.62 101


Normal File trensfer
Listener (ip 192.168.1.101


nc -vv -l 1234 > PLIK.mov

Client send file

nc 192.168.1.101 1234 < PLIK.mov

I am here show you how to perform port scanning method with nc
To scan for a TCP port 22

nc -zv 192.168.1.101

To scan for a UDP port 22

nc -zuv 192.168.1.101


To scan a range of UDP port 1-1000


nc -zuv 192.168.1.101 1-1000

Simple Proxy
Route witch container

mkfifo prox1

nc -l -p 80 0<proxy1 | nc www.ftims.pl  80 1>proxy1 

Uplod photo files from camera on port

while [ 1 ]; do streamer -o /var/plot.png; nc -l 1717 < /var/plot.png; done

or from print screen

while true; do import -window root /tmp/image.png; nc -vv -l -p 101 < /tmp/image.png; done

Leave a comment