Kail tutorial (9)-Tcpdump

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 #读取文件中的信息将第三项不重复显示出来

Insert picture description here


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

Insert picture description here

-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----- 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进制显示出来

Insert picture description here
Insert picture description here

Advanced filter

tcp packet header structure:
Insert picture description here
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.
Insert picture description here

Process documentation

tool:

  • drade
  • Keepnote
  • truecrypt: encryption software
Published 28 original articles · Likes0 · Visits 900

Guess you like

Origin blog.csdn.net/weixin_43876557/article/details/104610611