phaethon/kamene

AttributeError: 'module' object has no attribute 'AF_PACKET'

miguelmota opened this issue · 9 comments

trying to run example

>>> p = IP(dst = 'www.somesite.ex') / TCP(dport = 80) / Raw(b'Some raw bytes')
>>> sr(p)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/scapy/sendrecv.py", line 336, in sr
    s = conf.L3socket(filter=filter, iface=iface, nofilter=nofilter)
  File "/Library/Python/2.7/site-packages/scapy/supersocket.py", line 69, in __init__
    self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
AttributeError: 'module' object has no attribute 'AF_PACKET'
$ uname -a
Darwin computer.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

Has there been any progress on this? Since updating to version 0.22 I've been getting this problem on macos. This was not a problem with version 0.21.

Same issue here with Python 3. I've downgraded to 0.21 for now:
pip3 install -I scapy-python3==0.21

+1. Same problem.

Downgrading to 0.21 works for me. I hear BPF should be a viable alternative for OS X.

@miguelmota Your trace includes python/2.7 directory. Scapy3k (scapy-python3 package) works only with python3. Can you confirm that you are using python3?

I will get to a OS X machine later this week to investigate.
If somebody could take 0.21 code and commit by commit forward to find out the commit to blame, it would speed up fixing.

There is some issue with the new CAN layer implementation. Released 0.23 temporary disabling the layer before it is fixed, and this issue should not appear for now unless you enable can layer on OS X manually.

0.23 works for me.

The issue is reoccuring on: Scapy Version 2.4.0.dev58
MacOSX

Sorry for necro-posting, but this SO answer(mentioned by this answer) suggests that BSD-flavour distros use BPF, although the functionality is different. AF_PACKET is only available on UN*X distros, and may not be installed by default either. If this issue is not relevant anymore, please close.