nc <options> <hostname> <port>
- Basic syntax for establishing a Netcat connection.
Example: nc example.com 80
A comprehensive cheat sheet for Netcat, covering essential commands, options, and usage examples for various networking tasks.
Example: |
Example: |
Example: |
Example: |
Example: |
Example: |
Example: |
Example: |
|
Sending File: |
|
Receiving File: |
|
Example (Sender): |
|
Example (Receiver): |
|
Serving static content with Netcat:
This will serve |
Alternative (more verbose) example:
|
Victim (Listening): |
|
Attacker (Connecting): |
|
Explanation: |
The victim listens and pipes the shell to the attacker, who is also listening. |
|
Listen mode, for inbound connections. |
|
Specify the port number. |
|
Use UDP instead of default TCP. |
|
Verbose mode. |
|
Numeric-only IP addresses, no DNS. |
|
Timeout for connection attempts. |
|
Keep listening after client disconnects (multiple connections). |
|
Execute a program after connection. |
|
Execute command via sh after connection. |
|
Source port number. |
|
Source IP address. |
Netcat lacks built-in encryption, making it vulnerable to eavesdropping and man-in-the-middle attacks. Data transmitted is in plain text. |
Using Netcat to create reverse shells can introduce significant security risks if not properly secured. Attackers can gain unauthorized access to systems. |
Ensure that Netcat is used within a secure and trusted network to minimize the risk of unauthorized access and data breaches. |
Use Netcat in conjunction with encryption tools like |
Implement strong authentication mechanisms to verify the identity of connecting parties. |
Apply firewall rules and access control policies to restrict Netcat usage to authorized users and networks. |
Regularly audit Netcat usage and network traffic to detect and prevent unauthorized activities. |
Consider using more secure alternatives like
|