好奇的探索者,理性的思考者,踏实的行动者。
Table of Contents:
use the command tcpdump -D
to see which interfaces are available for capture
# -c 数量 -nn不进行域名解析
tcpdump -i any -c5 -nn
[S]:SYN,表示开始连接
[.]:没有标记,一般是确认
[P]:PSH,表示数据推送
[F]:FIN,表示结束连接
[R] :RST,表示重启连接
Protocol
tcpdump -i any -c5 icmp
Host Port
tcpdump -i any -c5 -nn host 54.204.39.132 port 80
tcpdump -i any -c5 -nn "port 80 and (src 192.168.122.98 or dst 54.204.39.132)"
tcpdump provides two additional flags: -X
to print content in hex, and ASCII or -A to print the content in ASCII
This is helpful for troubleshooting issues with API calls, assuming the calls are using plain HTTP. For encrypted connections, this output is less useful.
# 写入 -w
tcpdump -i any -c10 -nn -w webserver.pcap port 80
# 查看 -r
tcpdump -nn -r tcpdump.txt
This command saves the output in a file named webserver.pcap. The .pcap extension stands for "packet capture" and is the convention for this file format.
You can also use any of the filters we've discussed to filter the content from the file, just as you would with real-time data