Skip to content

Instantly share code, notes, and snippets.

@gerjantd
Created March 26, 2014 16:36
Show Gist options
  • Save gerjantd/9787538 to your computer and use it in GitHub Desktop.
Save gerjantd/9787538 to your computer and use it in GitHub Desktop.
Bash/nc: netcat as a simple ftp server
DATA TRANSFER
The example in the previous section can be expanded to build a basic data transfer model. Any information input into one end of the connection will be output to the other end, and input and output can be easily captured in order to emulate file trans‐
fer.
Start by using nc to listen on a specific port, with output captured into a file:
$ nc -l 1234 > filename.out
Using a second machine, connect to the listening nc process, feeding it the file which is to be transferred:
$ nc host.example.com 1234 < filename.in
After the file has been transferred, the connection will close automatically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment