Netcat is a utility that is able to write and read data across tcp and udp network connections using tcp/ip protocol suite.
Features:
- Port scanner
- Banner grabbing
- Port listener
- Port redirection
- As a backdoor
- File/Data transfer
listen for inbound: nc -l -p port [-options] [hostname] [port]
Options:
port numbers can be individual or ranges: lo-hi [inclusive];
hyphens in port names must be backslash escaped (e.g. 'ftp\-data')
Experiments:
checking for open port
nc -vn 192.168.93.129 22nc -vn 192.168.93.129 25
wireshark explains, how netcat says open on port 22
wireshark explains, how netcat says connect closed or filtered
netcat as a port scanner
nc -vvnz -w 1 192.168.93.129 21 - 25
scanning on udp port
nc -vvnzu -w 1 192.168.93.129 65 - 69
making a chat room
client sied: nc -lp 53
server side: nc 192.168.93.129 53
sending image to remote host
sending
netcat supports IPv6 as well
client
nc -6 localhost 2389
server
nc -6 -l 2389
launching remote shell
client
nc -lp 5000 -e /bin/bash
server
nc 192.168.233.208 5000
Basic information about port opened/closed/filtered
* "connected to server_ip" = if connection is successful
* "connection timeout" = if the port is blocked by firewall
* "connection refused" = if the service is down/not listening on specific port, but port is reachable
The message 'connection refused' has two main causes:
* nothing is listening on IP:Port you are trying to connect
* the port is blocked by a firewall