tcpdump 实用实例

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

监视指定网络接口的数据包

tcpdump -i eth1 //默认监听eth0


监视指定主机的数据包

获取主机收到和发出的所有数据包

tcpdump host ip或hostname


打印helios 与 hot 或者与 ace 之间通信的数据包

tcpdump host helios and \( hot or ace \)


截获主机210.27.48.1 和主机210.27.48.2 或210.27.48.3的通信

tcpdump host 210.27.48.1 and \( 210.27.48.2 or 210.27.48.3 \)


打印ace与任何其他主机之间通信的IP数据包, 但不包括与helios之间的数据包

tcpdump ip host ace and not helios


获取主机210.27.48.1除了和主机210.27.48.2之外所有主机通信的ip包

tcpdump ip host 210.27.48.1 and ! 210.27.48.2


截获主机hostname发送的所有数据

tcpdump -i eth0 src host hostname


监视所有送到主机hostname的数据包

tcpdump -i eth0 dst host hostname


监视指定主机和端口的数据包

获取主机210.27.48.1接收或发出的telnet包

tcpdump tcp port 23 and host 210.27.48.1


tcpdump与wireshark

tcpdump tcp -i eth1 -t -s 0 -c 100 and dst port ! 22 and src net 192.168.1.0/24 -w ./target.cap

(1)tcp: ip icmp arp rarp 和 tcp、udp、icmp这些选项等都要放到第一个参数的位置,用来过滤数据报的类型

(2)-i eth1 : 只抓经过接口eth1的包

(3)-t : 不显示时间戳

(4)-s 0 : 抓取数据包时默认抓取长度为68字节。加上-S 0 后可以抓到完整的数据包

(5)-c 100 : 只抓取100个数据包

(6)dst port ! 22 : 不抓取目标端口是22的数据包

(7)src net 192.168.1.0/24 : 数据包的源网络地址为192.168.1.0/24

(8)-w ./target.cap : 保存成cap文件,方便用ethereal(即wireshark)分析


摘抄自 http://www.cnblogs.com/ggjucheng/archive/2012/01/14/2322659.html

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值