Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sniff fails when the iface parameter is a list #3232

Closed
aliawa opened this issue May 27, 2021 · 2 comments
Closed

sniff fails when the iface parameter is a list #3232

aliawa opened this issue May 27, 2021 · 2 comments
Assignees

Comments

@aliawa
Copy link

aliawa commented May 27, 2021

Please see next comment for bug description

@aliawa
Copy link
Author

aliawa commented May 27, 2021

sniff fails when the iface parameter is a list e.g. iface=["eth1", "eth2"]

Environment:
Scapy version: 2.4.5
Python version: 3.6.9
Operating System: Ubuntu 18.04.5 LTS

How to reproduce:
start sniff like sniff(iface=["eth1","eth2"], prn=lambda x: x.summary())

Actual result

>>>  sniff(iface=["eth1","eth2"], prn=lambda x:x.summary())
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/user1/ali-pan-154892/my_python3/lib/python3.6/site-packages/scapy/sendrecv.py", line 1263, in sniff
    sniffer._run(*args, **kwargs)
  File "/home/user1/ali-pan-154892/my_python3/lib/python3.6/site-packages/scapy/sendrecv.py", line 1128, in _run
    **karg)] = iface
  File "/home/user1/ali-pan-154892/my_python3/lib/python3.6/site-packages/scapy/arch/linux.py", line 501, in __init__
    set_promisc(self.ins, self.iface)
  File "/home/user1/ali-pan-154892/my_python3/lib/python3.6/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 "/home/user1/ali-pan-154892/my_python3/lib/python3.6/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 "/home/user1/ali-pan-154892/my_python3/lib/python3.6/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'

Expected result:
it should start sniffer on eth1 and eth2

@guedou
Copy link
Member

guedou commented May 27, 2021

It is a duplicate of #3191. Please reopen the issue if it is not correct

@guedou guedou closed this as completed May 27, 2021
@p-l- p-l- self-assigned this May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants