You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "scapy_file.py", line 197, in run
packets = sniff(iface=["wlan0","wlan1","wlan2","wlan3"], prn=callback, store=0)
File "/root/.local/share/virtualenvs/myenv/lib/python3.8/site-packages/scapy/sendrecv.py", line 1264, in sniff
sniffer._run(*args, **kwargs)
File "/root/.local/share/virtualenvs/myenv/lib/python3.8/site-packages/scapy/sendrecv.py", line 1128, in _run
sniff_sockets[L2socket(type=ETH_P_ALL, iface=iface,
File "/root/.local/share/virtualenvs/myenv/lib/python3.8/site-packages/scapy/arch/linux.py", line 501, in init
set_promisc(self.ins, self.iface)
File "/root/.local/share/virtualenvs/myenv/lib/python3.8/site-packages/scapy/arch/linux.py", line 181, in set_promisc
mreq = struct.pack("IHH8s", get_if_index(iff), PACKET_MR_PROMISC, 0, b"")
File "/root/.local/share/virtualenvs/myenv/lib/python3.8/site-packages/scapy/arch/linux.py", line 401, in get_if_index
return int(struct.unpack("I", get_if(iff, SIOCGIFINDEX)[16:20])[0])
File "/root/.local/share/virtualenvs/myenv/lib/python3.8/site-packages/scapy/arch/common.py", line 65, in get_if
return ioctl(sck, cmd, struct.pack("16s16x", iff.encode("utf8")))
AttributeError: 'list' object has no attribute 'encode'
Brief description
Basic sniff capture using multiple interfaces.
When passing a list (or dict) of interfaces, Scapy raises an exception (see below).
See 'Related resources' for probable cause/fix.
Environment
Scapy version: 2.4.5
Python version: 3.8.5
Operation System: Ubuntu 20.04.2.0 Desktop
How to reproduce
packets = sniff(iface=["wlan0", "wlan1", "wlan2", "wlan3"], prn=callback, store=0)
Actual result
Expected result
Expecting sniff to begin.
Related resources
Source probably related to this issue:
sendrecv.py - line 1111 to line 1128
Since I don't use a custom L2 socket, I simply commented out line 1111 to 1113 and used the default L2 socket:
L2socket = conf.L2listen
Proper fix probably involves looping through list items to instance an L2socket.
The text was updated successfully, but these errors were encountered: