在升级我的linux操作系统之前,python2.7中的scapy中的嗅探功能工作正常。
from scapy.all import *
client_mac="c4:3d:c7:8f:03:19"
wlan_mac="00:c0:ca:6d:ac:fa"
sniff(iface="mon0",prn=packet_callback,filter="(ether dst "+client_mac+" and ether src "+wlan_mac+") or (ether src "+client_mac+" and ether dst "+wlan_mac+")")
升级后,我在 python2.7 中再次运行我的脚本,并从 scapy 收到以下消息
WARNING: No route found for IPv6 destination :: (no default route?)
tcpdump: WARNING: eth0: no IPv4 address assigned
如何让 scapy 嗅探正确的接口?
我尝试conf.iface="mon0"
在上面添加嗅探功能,但仍然没有成功。
使用ifconfig -a
我得到以下内容
eth0 Link encap:Ethernet HWaddr 00:25:22:e9:b1:28
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:720 (720.0 B) TX bytes:720 (720.0 B)
mon0 Link encap:UNSPEC HWaddr 00-C0-CA-6D-AC-FA-3A-30-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:635 errors:0 dropped:638 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:192290 (187.7 KiB) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 00:c0:ca:6d:ac:fa
inet addr:192.168.1.7 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2c0:caff:fe6d:acfa/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:866 errors:0 dropped:0 overruns:0 frame:0
TX packets:811 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:385790 (376.7 KiB) TX bytes:99505 (97.1 KiB)