Used on the victim machine.Ĭonnect to a given IP address on port 443 executing the /bin/bash command. Used on the attacker machine.Ĭonnect to a given IP address on port 443 executing the bash shell. Listen for incoming connection on port 443.
This method is normally preferred as it is less likely to be blocked by firewall or antivirus software because these normally lock down incoming connections but not outgoing ones. In a reverse shell, the attacker host listens for incoming connections and the target machine connects to it. In penetration testing, Netcat is often used to establish reverse or bind shell with a target machine and therefore gain remote access to the machine. Redirect content of a “file.txt” file to a specified IP address on port 443. Listen for incoming connections and redirect out put to a “file.txt” file. Netcat can also be used to transfer files over a network between machines. This can be performed by establishing a simple connection to the service. Services often have a banner that is displayed when establishing a connection, Banner Grabbing is used to gather information about a service or its version. The options are ”4” (SOCKS 4), ”5” (SOCKS 5) and ”connect” (HTTPS). Use to specify the proxy protocol to be used. If the port is not specified, the well-known port for the proxy protocol is used. Used to connect to a target using a proxy. Used to specify a delay between when data is sent and when it is received. Performs a port scan against a given host and port or port range. Used to specify a timeout period in seconds, after which, if the connection is still in idle, it is closed.
This has been removed in newer versions of Netcat. Used to specify a command to execute when the connection is established. Used to specify a binary to execute when the connection is established. Used to specify the port to communicate with or to listen on. The tools has a number of flags that can be used, these are the main ones: Flagĭo not resolve IP addresses when establishing a connection. In penetration testing, Netcat is often used to establish a reverse/bind shell with a target machine, transfer files over a network or interact with certain services such as FTP or SMTP. It is often referred to as a networking Swiss army knife as it can be used to carry out various task. Netcat is a networking tool used to send and receive data over a TCP/UDP network connection.