Tcpdump
tcpdump does not add corresponding parameters and only captures the first 68 bytes of each data by default.
tcpdump -h #查看相应的参数
#常用命令
tcpdump -i 指定接口 -s 指定抓取数据包大小 -w 将内容保存到该文件
tcpdump -i 指定接口 tcp port 22 :指定抓取tcp协议22端口的数据包 #抓包筛选器
tcpdump -r 文件名 #将刚抓到的数据包数据包读取出来
tcpdump -r -A 文件名 #以ASII码形式把包里面内容显示出来
tcpdump -r -X 文件名 #以16进制形式把包里面内容显示出来
Display filter:
-n #不对包中的ip地址做域名解析,就以ip形式显示出来
eg:
tcpdump -n -r http.cap|awk '{print $3}' |sort -u #读取文件中的信息将第三项不重复显示出来
Filter the source or destination address.
eg:
tcpdump -n -r src host 145.254.160.237 -r http.cap #只显示数据包的来源主机ip是145.254.160.237
tcpdump -n -r dst host 145.254.160.237 -r http.cap #只显示数据包的目标主机ip是145.254.160.237
-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----- Screen port number
eg:
tcpdump -n port 53 -r http.cap #筛选端口号为53的数据包信息
tcpdump -n tcp port 53 -r http.cap #筛选tcp协议端口号为53的数据包信息
tcpdump -n udp port 53 -r http.cap #筛选udp协议端口号为53的数据包信息
tcpdump -n -X udp port 53 -r http.cap #筛选udp协议端口号为53的数据包信息以16进制显示出来
Advanced filter
tcp packet header structure:
want to view the label:
tcpdump -A -m 'tcp[13]=24' -r http.cap #凡是第14个字节是ack+puh的都显示出来
Based on this feature, you can filter any value anywhere in the packet.
Process documentation
tool:
- drade
- Keepnote
- truecrypt: encryption software