tcpdump简单使用

来源:互联网 发布:淘宝茶叶排名 编辑:程序博客网 时间:2024/05/29 17:32

tcpdump简单使用


简单示例

tcpdump tcp port 8888 and host 12.23.34.100 -w ./target.captcpdump host 12.23.34.100 && 12.23.34.101 -S 0 -w ./target.cap

参数解释

tcpdump tcp -i eth1 -t -s 0 -c 100 and dst port ! 22 and src net 192.168.1.0/24 -w ./target.cap
  • -i eth1 : 只抓经过接口eth1的包
  • -t : 不显示时间戳
  • -s 0 : 抓取数据包时默认抓取长度为68字节。加上-S 0 后可以抓到完整的数据包
  • -c 100 : 只抓取100个数据包
  • dst port ! 22 : 不抓取目标端口是22的数据包
  • src net 192.168.1.0/24 : 数据包的源网络地址为192.168.1.0/24
  • -w ./target.cap : 保存成cap文件,方便用ethereal(即wireshark)分析
0 0