2014-03-03 14:22:40 +04:00
|
|
|
# nc
|
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
> Reads and writes tcp or udp data.
|
2014-03-03 14:22:40 +04:00
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Listen on a specified port:
|
2014-03-03 14:22:40 +04:00
|
|
|
|
|
|
|
`nc -l {{port}}`
|
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Connect to a certain port (you can then write to this port):
|
2014-03-03 14:22:40 +04:00
|
|
|
|
|
|
|
`nc {{ip_address}} {{port}}`
|
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Set a timeout:
|
2014-03-03 14:22:40 +04:00
|
|
|
|
|
|
|
`nc -w {{timeout_in_seconds}} {{ipaddress}} {{port}}`
|
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Serve a file:
|
2014-03-03 14:22:40 +04:00
|
|
|
|
2016-07-22 23:24:06 +03:00
|
|
|
`nc -l {{port}} < {{file}}`
|
2014-03-03 14:22:40 +04:00
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Receive a file:
|
2014-03-03 14:22:40 +04:00
|
|
|
|
2016-07-22 23:24:06 +03:00
|
|
|
`nc {{ip_address}} {{port}} > {{file}}`
|
2014-03-08 06:37:44 +04:00
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Server stay up after client detach:
|
2014-03-08 06:37:44 +04:00
|
|
|
|
|
|
|
`nc -k -l {{port}}`
|
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Client stay up after EOF:
|
2014-03-08 06:37:44 +04:00
|
|
|
|
|
|
|
`nc -q {{timeout}} {{ip_address}}`
|
2016-06-13 06:54:36 +03:00
|
|
|
|
|
|
|
- Port scanning:
|
|
|
|
|
|
|
|
`nc -v -z {{ip_address}} {{port}}`
|
|
|
|
|
|
|
|
- Proxy and port forwarding:
|
|
|
|
|
2016-07-22 23:24:06 +03:00
|
|
|
`nc -l {{port}} | nc {{hostname}} {{port}}`
|