gpt4 book ai didi

python - scapy 中嗅探功能的过滤器无法正常工作

转载 作者:IT王子 更新时间:2023-10-29 00:07:46 25 4
gpt4 key购买 nike

看来sniff函数的filter没有正常工作

我正在使用以下过滤器执行嗅探

a=sniff(count=1,filter="tcp and host 192.168.10.55 and port 14010")

但有时 sniff 会捕获这样的 UDP 数据包:

>>> a=sniff(count=1,filter="tcp and host 192.168.10.55 and port 14010")
>>> a
<Sniffed: TCP:0 UDP:1 ICMP:0 Other:0>

有时 sniff 捕获带有错误端口的 TCP 数据包:

>>> a=sniff(count=1,filter="tcp and host 192.168.10.55 and port 14010")
>>> a
<Sniffed: TCP:1 UDP:0 ICMP:0 Other:0>
>>> a[0]
<Ether dst=00:26:55:cb:3b:10 src=00:22:64:55:c8:89 type=0x800 |<IP version=4L ihl=5L tos=0x10 len=92 id=8683 flags=DF frag=0L ttl=64 proto=tcp chksum=0x9484 src=192.168.1.71 dst=192.168.1.133 options=[] |<TCP sport=ssh dport=1874 seq=350107599 ack=2484345720 dataofs=5L reserved=0L flags=PA window=254 chksum=0x846b urgptr=0 options=[] |<Raw load="yn\x01\x9d\xfca\xc9V-8\x18|\xc4\t\xf1\xc4\xd8\xd3\xc6\x95E\x19'h\xc0\x89\xf1\x08g\xa3\x9a\xa9\xf51RF\xc2\x1f\xe5a\xac\x83M\xc9\x0b\x80\x85\x1b\xcf\xb6f\xcc" |>>>>

有时 sniff 会捕获一个 ARP 数据包,如下所示:

>>> a=sniff(count=1,filter="tcp and host 192.168.10.55 and port 14010")
>>> a
<Sniffed: TCP:0 UDP:0 ICMP:0 Other:1>
>>> a[0]
<Ether dst=ff:ff:ff:ff:ff:ff src=00:22:07:2c:53:97 type=0x806 |<ARP hwtype=0x1 ptype=0x800 hwlen=6 plen=4 op=who-has hwsrc=00:22:07:2c:53:97 psrc=192.168.1.178 hwdst=ff:ff:ff:ff:ff:ff pdst=192.168.1.179 |<Padding load='\x00\x07\x00\x00\x00\x00\x00\x00p\x00\x00\x00\x00\x00\x01\x14\x00\x00' |>>>

我的过滤器中是否遗漏了什么?我怎样才能避免这个问题?

最佳答案

我遇到了相同或相似的问题 - 嗅探过滤器不起作用。

安装 tcpdump 解决了我的问题。

关于python - scapy 中嗅探功能的过滤器无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30095701/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com