Netcat - Intro
Last updated
Last updated
Netcat is a versatile networking utility tool used for reading from and writing to network connections using TCP or UDP protocols. It is often referred to as "Swiss Army Knife" of networking tools. It is widely used for network diagnostics, testing, and various network-related tasks.
Netcat can be used to scan for open ports on a target system, which is useful for discovering running services.
(This will scan the target ip's ports from 1 to 1000)
Netcat can listen on specified ports, making it useful for setting up simple servers or for waiting to receive connections.
(This command listens for incoming connections on port 1234
)
Netcat can transfer files or data between computers over the network.
(This is for receiver's end)
(This is for sender's end)
Netcat can be used to create a simple chat application by connecting two instances of Netcat to each other.
(This is on listener's machine)
(This is on another machine)
Netcat can be used to set up remote shells for getting reverse shell or remote administration for exploitation purposes.
(This is on listener's machine)
(This is on target machine)
The -e
option is used to execute the command /bin/bash
which starts the bash shell after connection establishment.
-l
: Listen mode for inbound connections.
-p
: Local port number to listen on or connect to.
-e
: Program to execute after a connection is established.
-z
: Zero-I/O mode (useful for scanning).
-v
: Verbose mode (provides more information).
-n
: Disable DNS resolution (useful for disabling DNS lookups and speeding up operations)