[Network] Linux Telnet & Netcat (nc) – 測試TCP/UDP工具

Intro

Netcat (nc)

Telnet


Telnet

簡單用於測試TCP連線

$ telnet www.example.com 80
GET /path/to/file.html HTTP/1.1
Host: www.example.com
Connection: close

Netcat (nc)

TCP/UDP讀寫工具,測試UDP利器

在埠25建立內容未加工過的連接(類似telnet):

$  nc mail.server.net 25

利用零模式I/O(參數 -z)檢查192.168.0.1的UDP埠(參數 -u)80-90是否開啟:

$ nc -vzu 192.168.0.1 80-81

測試UDP,透過發送訊息

$ nc -vu example.com 443
Connection to example.com port 443 [udp/https] succeeded!

接收端可利用 tcpdump 來監控接收訊息

tcpdump -i any 'udp && port 22'

Leave a Reply

Your email address will not be published. Required fields are marked *