Centos 7.4 系统,使用wireshark 抓包,获取数据包来源IP(生产环境测试可用)

发布于:2023-09-15 ⋅ 阅读:(97) ⋅ 点赞:(0)

1 安装wireshark

   yum install wireshark 

(也可以使用rpm包安装,但是依赖包较多,安装可能需要多一点时间)

2 安装完后,抓取数据包

 tshark -i ens192 -Y "ip.dst == 192.168.120.59 and tcp.dstport == 4006 and frame contains 18912345678" -T fields -e ip.src

该命令将在ens192接口上进行抓包,并使用过滤器"ip.dst == 192.168.120.59 and tcp.dstport == 4006 and frame contains 18912345678"来筛选出满足条件的数据包。最后,使用"-T fields -e ip.src"参数提取源IP地址字段并显示出来。

tshark -i ens192 -Y "ip.dst == 192.168.120.59 and tcp.dstport == 4006 and frame contains \"Tel=18912345678\"" -T fields -e ip.src

备注:shell命令行语法测试及调试过程,

百度了几篇文章,都不行,最后使用网上找的chatgpt网站(www.pomelosai.com),问的ChatGPT,刚开始是说使用tcpdump,试过之后达不到效果,最后试了wireshark可以。

  


网站公告

今日签到

点亮在社区的每一天
去签到