-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtcpdump_usage.txt
55 lines (52 loc) · 1.55 KB
/
tcpdump_usage.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# 参数详解 https://danielmiessler.com/study/tcpdump/#gs.z4ct9co
# 输出详解http://packetpushers.net/masterclass-tcpdump-interpreting-output/
#-vvv verbose ,-X hex raw output, -nn don't show protocol name, -i any interface, -A output ascii
#tcpdump -vv -X -AAA -nn -i any -F filter
#-n 不显示端口对应协议
#-nn 不显示端口名和域名
# -S 绝对 tcp 序列号
# -t,-tttt 人类可读时间
# -F 过滤表达式文件
# -c 抓几个包
#read from capture:
#tcpdump -r dat
#
#write raw packet:
#tcpdump -w dat
#
#list all device that could be captured:
#tcpdump -D
#
#man pcap-filter
#
#src port 18080 && (tcp || ip || ip6 || arp || udp || rarp) && (dst 127.0.0.1 || src 10.73.56.250)
#(tcp || ip || ip6 || arp || udp || rarp) && (dst 127.0.0.1 || src 10.73.56.250)
#
#18080端口的tcp流量
#dst port 18080 && tcp
#
#和主机baidu的通信
#host baidu.com
#
#指定端口区域
#src or dst portrange 10000-20000
#
#ftp 协议端口和数据端口,名字见:/etc/services
#port ftp or ftp-data
#
#捕获syn,但是localhost的syn不要
#tcp[tcpflags] & tcp-syn != 0 and not dst host 127.0.0.1
#其他语法:
#tcp[tcpflags] & tcp-syn
#tcp[tcpflags] & tcp-ack
#tcp[tcpflags] & tcp-fin
#
#从ip数据报第二个字节开始,提取2个字节的bits(默认提取一个字节).
#这个是ip数据报的头部长度字段值
#ip[2:2] > 576
port 18080 && tcp
#过滤 rst 包
#tcpdump -i any -vvv -tttt -n 'tcp[13] & 4 = 4' and dst port 3422
#抓 http 包
#tcpdump -i any -A -s 0 -c 1000 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'