From 62580eba100d0de805a01aa3760104d90bd95ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BCthe?= Date: Wed, 12 Apr 2023 03:16:15 +0900 Subject: [PATCH] netcat: refresh page (#9926) --- pages/common/nc.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pages/common/nc.md b/pages/common/nc.md index 72a7f7220..2a25f2d23 100644 --- a/pages/common/nc.md +++ b/pages/common/nc.md @@ -1,13 +1,9 @@ # nc > Netcat is a versatile utility for working with TCP or UDP data. -> More information: . +> More information: . -- Listen on a specified port and print any data received: - -`nc -l {{port}}` - -- Connect to a certain port: +- Establish a TCP connection: `nc {{ip_address}} {{port}}` @@ -15,18 +11,26 @@ `nc -w {{timeout_in_seconds}} {{ipaddress}} {{port}}` +- Scan the open TCP ports of a specified host: + +`nc -v -z {{ip_address}} {{port}}` + +- Listen on a specified TCP port and print any data received: + +`nc -l {{port}}` + - Keep the server up after the client detaches: `nc -k -l {{port}}` -- Keep the client up even after EOF: +- Listen on a specified UDP port and print connection details and any data received: -`nc -q {{timeout}} {{ip_address}}` - -- Scan the open ports of a specified host: - -`nc -v -z {{ip_address}} {{port}}` +`nc -u -l {{port}}` - Act as proxy and forward data from a local TCP port to the given remote host: `nc -l {{local_port}} | nc {{hostname}} {{remote_port}}` + +- Send a HTTP request: + +`echo -e "GET / HTTP/1.1\nHost: {{hostname}}\n\n" | nc {{hostname}} 80`