Thursday, June 5, 2014

Transferring files with netcat

On the destination server, set up a listen port by doing nc -l PORT > FILENAME, where PORT is the listen port to connect to, and  FILENAME is the filename you want to have on the destination server. This could be any number, but you probably want it to be >1000 due to Linux rules about ports.

Now on the source server, do

nc IP PORT < FILE, where IP is the ip of the destination server, PORT is the same as above, and FILE is name of the file to transfer.

An example, with IP = 192.168.10.5, PORT = 9001, FILE=backup.iso

Destination:

nc -l 9001 > backup.iso

Source:

nc 192.168.10.5 9001 < backup.iso
http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/

No comments:

Post a Comment