2014-03-03 10:22:40 +00:00
|
|
|
# nc
|
|
|
|
|
2019-02-16 17:15:04 +00:00
|
|
|
> Netcat is a versatile utility for working with TCP or UDP data.
|
2019-06-04 10:00:06 +01:00
|
|
|
> More information: <https://nmap.org/ncat>.
|
2014-03-03 10:22:40 +00:00
|
|
|
|
2019-02-16 17:15:04 +00:00
|
|
|
- Listen on a specified port and print any data received:
|
2014-03-03 10:22:40 +00:00
|
|
|
|
2019-02-24 15:47:41 +00:00
|
|
|
`nc -l {{port}}`
|
2014-03-03 10:22:40 +00:00
|
|
|
|
2020-12-30 13:57:11 +00:00
|
|
|
- Connect to a certain port:
|
2014-03-03 10:22:40 +00:00
|
|
|
|
|
|
|
`nc {{ip_address}} {{port}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Set a timeout:
|
2014-03-03 10:22:40 +00:00
|
|
|
|
|
|
|
`nc -w {{timeout_in_seconds}} {{ipaddress}} {{port}}`
|
|
|
|
|
2020-12-30 13:58:06 +00:00
|
|
|
- Keep the server up after the client detaches:
|
2014-03-08 02:37:44 +00:00
|
|
|
|
|
|
|
`nc -k -l {{port}}`
|
|
|
|
|
2020-12-30 13:58:06 +00:00
|
|
|
- Keep the client up even after EOF:
|
2014-03-08 02:37:44 +00:00
|
|
|
|
|
|
|
`nc -q {{timeout}} {{ip_address}}`
|
2016-06-13 04:54:36 +01:00
|
|
|
|
2019-02-16 17:15:04 +00:00
|
|
|
- Scan the open ports of a specified host:
|
2016-06-13 04:54:36 +01:00
|
|
|
|
|
|
|
`nc -v -z {{ip_address}} {{port}}`
|
|
|
|
|
2019-02-16 17:15:04 +00:00
|
|
|
- Act as proxy and forward data from a local TCP port to the given remote host:
|
2016-06-13 04:54:36 +01:00
|
|
|
|
2019-02-16 17:15:04 +00:00
|
|
|
`nc -l {{local_port}} | nc {{hostname}} {{remote_port}}`
|