Earlier quoted context omitted.
Netcat is seriously awesome, and still exists very much under the radar of a lot of people. I've used to to copy files around the planet, the datacenter, and the lab. It excels at doing things "right now". If I have a terminal window open on a server in France and one in the US; then I can easily move that file. However, If I have to move my body to the target location before I can copy the file it doesn't work as we…
I would like to know if there are any advantages to use nc instead of scp ?
Target PC opens a port and starts listening (outputting to file)
Sending machine establishes a connection to the listening port, and starts copying the file.
Example (hide a file transfer as DNS traffic)
Listening computer:
nc -l -u -p 53 > output.file
Sending computer: cat original.file > nc -u [destination ip address] 53
In this case you'd be dumb not to encrypt the file before transit. And as I mentioned already make sure you have a hash of the original.You can also use TCP. These are sneaky/simple ways to move files around. Downside: You need to poke a hole in a firewall, but options exist for that too.
ssh/scp downside: You need an account on target PC to connect to. nc downside: you need an open port on the listening PC.