Home 0P3N Blog Netcat Tool: 5 Most Common Usage with Examples
Ready to Start Your Career?
Create Free Account
Jithin Aby Alexs profile image
By: Jithin Aby Alex
March 22, 2018

Netcat Tool: 5 Most Common Usage with Examples

By: Jithin Aby Alex
March 22, 2018
Jithin Aby Alexs profile image
By: Jithin Aby Alex
March 22, 2018
Netcat is one of the most powerful and useful tool for testing and debugging the network and protocol connectivity.Though administrators use this tool for troubleshooting purposes, the attackers may use this for malicious intentions such as establishing a connectivity, transferring files, scanning ports etc.Netcat can act as in client-server mode as well. This tool is available for both Windows and Linux.Lets go through the five most common usage of netcat commands.1) Check whether the port is Open.For checking TCP ports :-#nc -v <IP or Domain name> <port number>Eg: nc -v www.jaacostan.com 80For checking UDP ports:-#nc -vu www.jaacostan.com 53  //where "u" in "-uv" represents UDP.2) For doing Port Scans#nc -vzu <IP or Website> <port range>eg:#nc -vz www.jaacostan.com 100-200for scanning the opened UDP ports,#nc -vzu www.jaacostan.com 100-200 //where "u" in "-uzv" represents UDP.3) Netcat as Client-Server.Once netcat is installed on a system whose IP is 192.168.1.10,#nc -l 4444 // executing this command will open up a port listening on 4444.from another machine, establish a connection with the server.#nc 192.168.1.10 4444.4) Transfer a file/data.On the server, open a port 4444.#nc -l 4444 > output // any data receives on this port will be saved on a file named as "output"From the client, send contents of the file "jaa".#cat jaa | nc 192.168.1.10 44445) Bind a program to a port and access it.Bind a program, here CMD to the port number 4444.#nc -nlvp 4444 -e cmd.exeestablish a connection with the server on port 4444.#nc -nv 192.168.1.10 4444This will open up a CMD prompt of server from the client machine.Note: The IP and Domains specified here are only for illustration purposes.I hope this is informative and let me know  your comments and suggestions.
Schedule Demo

Build your Cybersecurity or IT Career

Accelerate in your role, earn new certifications, and develop cutting-edge skills using the fastest growing catalog in the industry