🔗
Networking concepts
  • Introduction
  • DNS
    • Introduction
    • DNS query
  • SSH
    • Introduction
    • Basics
    • SSH tunneling
      • Direct SSH tunnel
      • Reverse SSH tunnel
      • Dynamic SSH tunnel
    • SSH public key authentication
    • Port forwarding with virtual interface
    • sshd
    • scp/sftp
  • 🔫Networking tools
    • configuration & information
      • ip
      • netstat/netsh
      • ifconfig/ipconfig/iwconfig
      • arp
      • route
      • ps
      • ss
      • lsof
      • pgrep
      • nmcli
      • Information about services/processes & PID
    • monitoring & troubleshooting
      • ping
      • tracert/traceroute
      • mtr
      • iperf3
    • domain information
      • dig/nslookup
      • whois
      • host
    • capture & analysis
      • tcpdump
      • ngrep
      • wireshark
    • firewall & security
      • iptables
      • nft
    • services
      • dnsmasq
      • hostapd
      • RDP/VNC
      • ngrok
      • networking.service
      • NetworkManager.service
      • nginx
      • apache
      • nfs
    • miscellaneous
      • cURL
      • wget
      • netwox
      • netcat
      • openssl
      • socat
      • ftp
      • smbclient
    • proxy & tunneling
      • proxychains
    • Programming/scripting
      • Python
      • C
  • 🤩Interesting concepts
    • Simple tips & tricks
    • Network hole punching
    • SSH Over HTTPS
  • Network ports & services cheat sheet
    • 20/21/tcp ~ ftp
    • 22/tcp ~ ssh
    • 23/tcp ~ telnet
    • ...
  • For-fun projects
    • Raspberry pi + Windows machine experiments
Powered by GitBook
On this page
  • Basic command to listen on a TCP/UDP port:
  • Connect to TCP/UDP server at a port
  1. Networking tools
  2. miscellaneous

netcat

Listen, connect, ...

Basic command to listen on a TCP/UDP port:

TCP

$ nc -l -p <port>
$ nc -lp <port> # or simply

# eg. listen on local address TCP port 8000
$ nc -lp 8000

UDP

$ nc -u -l -p <port>
$ nc -ulp <port>

# eg. listen on local address UDP port 8000
$ nc -ulp 8000

Flags:

  1. -l: listen mode, for inbound connects

  2. -p: local port number

  3. -u: UDP mode

Connect to TCP/UDP server at a port

Connect to a TCP server:

$ nc <address> <port>

# eg. connect to TCP server at 88.88.88.88 port 8000
$ nc 88.88.88.88 8000

Connect to a UDP server:

$ nc -u <address> <port> 

# eg. connect to UDP server at 88.88.88.88 port 8000
$ nc -u 88.88.88.88 8000

PreviousnetwoxNextopenssl

Last updated 6 months ago

🔫
nc(1): arbitrary TCP/UDP connections/listens - Linux man page
Logo