Netcat

Netcat can be found in the following repos:

  • Debian: as ncat
  • Arch: as part of nmap

Transferring files

On the destination:

user@reciever ~/Downloads> nc -l -p 31234 > mk_docker.py < /dev/null

Why pipe stdout to /dev/null? Good question, let’s quote @martinwguy on superuser.com.

“Because netcat both reads stdin and writes stdout simultaneously, sending anything read from stdin out to the network and printing anything received from the network on stdout. The < /dev/null ensures that, when the received file has completed, netcat doesn’t sit there indefinitely waiting for input from the console (which it shouldn’t be reading anyway!) and also ensures that it doesn’t gobble up any input that may be available from the terminal, such as you typing the next command you wanted to run.”

- martinwguy | Commented Jan 4, 2013 at 7:18

On the source:

user@sender ~/Downloads> cat mk_docker.py | ncat <ip_addr> 31234