Netcat—like so many hacker tools—was created to be a network analysis tool.
Developed by a fellow only known as "Hobbit," he gave away this tool to the IT community without compensation, but has received scores of accolades. Thanks, Hobbit!
As such, you can use it to open up TCP and UDP connections between two machines over any port your heart desires.
It can be used as,
port scanning tool, similar to nmap
leaving an open backdoor for the hacker
Banner grabbing
Raw connections
Webserver interaction
File transfers.
Netcat commands
Open kali linux
nc –h
As you can see, the basic syntax for netcat is the following.
To connect to another machine: nc options host IP address port or nc [ip address][port]
To listen for inbound connections: nc -l -p port
Netcat raw connection
Once we have a TCP connection to a web server, we can use netcat to grab the banner of the web server to identify what web serving software the victim is running.
Banner grabbing is a technique to retrieve this information about a particular service on an open port and can be used during a penetration test for performing a vulnerability assessment.
Service banners are often used by system administrators for inventory taking of systems and services on the network.
The service banners identify the running service and often the version number too
Bullet Three
Web server interaction
Netcat can also be used to interact with webservers by issuing HTTP requests. With the following .command we can grab the banner of the web service running on Kali Linux
Nc [ip of Target] [port: 80]
HEAD / HTTP/1.0
Banner Grabbing
Port Scan
> nc –nvz ip of Target machine 1-100
If you find open port and wants to connect
> nc Host/Target ip port
By default it scans the TCP ports. For UDP, you can use > nc -nvz -u ip port
File Trasnfering
If you Want to Transfer the File/Script then you can use it like,
In Computer A type : >
cat somethin | nc -l -p [port]//At the receiving end
In Computer B type :>
nc ip.Reciver [port] > somethin //At the sending end
Text Transfering/Chat
If you Want to share message/chat then you can use it like,
In Computer A type : > nc -l -p [port] //At the receiving end