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

Exception in snifferthread when creating L2listen #6

Open
jeremiahrex opened this issue May 13, 2019 · 2 comments
Open

Exception in snifferthread when creating L2listen #6

jeremiahrex opened this issue May 13, 2019 · 2 comments

Comments

@jeremiahrex
Copy link

After a registration is successfully confirmed, a sniffer thread is set up which creates a socket that listens for the appropriate ARP and TCP traffic. However something goes wrong when passing the compiled BPF filter code to setsockopt.

Exception in thread Thread-5: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/home/jerry/.local/lib/python2.7/site-packages/sleepproxy/sniff.py", line 18, in run self._sniff() File "/home/jerry/.local/lib/python2.7/site-packages/sleepproxy/sniff.py", line 24, in _sniff sock = conf.L2listen(type=ETH_P_ALL, filter=self._filterexp, iface=self._iface) File "/home/jerry/.local/lib/python2.7/site-packages/scapy/arch/linux.py", line 454, in __init__ attach_filter(self.ins, filter, iface) File "/home/jerry/.local/lib/python2.7/site-packages/scapy/arch/linux.py", line 141, in attach_filter sock.setsockopt(socket.SOL_SOCKET, SO_ATTACH_FILTER, bp) File "<string>", line 1, in setsockopt error: [Errno 22] Invalid argument

Running lubuntu 16.04.6 LTS on a Macmini G4.

I have confirmed that the BPF filters are being correctly generated in scapy. I suspect that it is a similar issue to secdev/scapy#842.

@kfix
Copy link
Owner

kfix commented May 18, 2019

which kernel package / version are you running?

@jeremiahrex
Copy link
Author

These are the packages I've installed with pip:
cffi (1.12.3) dnspython (1.16.0) gevent (1.4.0) greenlet (0.4.15) netifaces (0.10.9) pip (8.1.1) scapy (2.4.2) SleepProxyServer (0.1)

So after verifying everything up to the internals of scapy I tried following the "legacy" code path in scapy/common.py and behold, it worked properly. I got a different error later on though (AttributeError: who_has). So I think that is further evidence in the direction that SleepProxyServer is fine and it's scapy changes that are causing the issue. Looks like they changed how they were using the Python ctypes, perhaps > V2.

I also tried this with a virtual machine using the same distro/kernel version on a VirtualBox on my x86-64 machine. Still get the same error as in #5 and run into the same error later with who_has.

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

2 participants