This week, I picked up the ncat series again and looked at broker mode for transferring files. In my example case, the file was just ASCII and was simple to examine to ensure that no stray bits of the transmission were accidentally stored in the outputfile. But what if the file had been an executable?
Using the --recv-only
and/or --send-only
options ensures that a client or server doesn’t interject any stray packets into the network stream.
Per the Ncat Reference Guide:
--recv-only (Only receive data)
If this option is passed, Ncat will only receive data and will not try to send anything.
--send-only (Only send data)
If this option is passed, then Ncat will only send data and will ignore anything received. This option also causes Ncat to close the network connection and terminate after EOF is received on standard input.
This is really pretty straight forward, but is a handy set of options to point out when transferring files via ncat.