scapy icon indicating copy to clipboard operation
scapy copied to clipboard

scapy.error.Scapy_Exception: No /dev/bpf handle is available !

Open sdtazhangyi opened this issue 7 years ago • 4 comments

Hello everyone. I got some issues when I wanted to send icmp packets via scapy, could you please help me to solve it? My environment:

Mac OS High Sierra 10.13.6 Python 3.7.2 Scapy 2.4.2

This is my code:

from scapy.all import * pkt = IP(dst='8.8.8.8')/ICMP() ping = sr1(pkt,timeout=2)

When I wanted to send icmp packets, I got this error.

Traceback (most recent call last): File "/Users/zy-mac/Desktop/pYTHON/1.py", line 7, in ping = sr1(pkt,timeout=2) File "/Users/zy-mac/Library/Python/3.7/lib/python/site-packages/scapy/sendrecv.py", line 469, in sr1 s = conf.L3socket(promisc=promisc, filter=filter, nofilter=nofilter, iface=iface) # noqa: E501 File "/Users/zy-mac/Library/Python/3.7/lib/python/site-packages/scapy/arch/bpf/supersocket.py", line 58, in init (self.ins, self.dev_bpf) = get_dev_bpf() File "/Users/zy-mac/Library/Python/3.7/lib/python/site-packages/scapy/arch/bpf/core.py", line 98, in get_dev_bpf raise Scapy_Exception("No /dev/bpf handle is available !") scapy.error.Scapy_Exception: No /dev/bpf handle is available !

sdtazhangyi avatar Feb 15 '19 21:02 sdtazhangyi

Did you launch Scapy as root?

guedou avatar Feb 15 '19 22:02 guedou

I have the same problem as well! I used this to install scapy from inside a virtualenv: pip install scapy Python Version: 3.7.2 Pip Version: 19.0.3

lpuv avatar Mar 05 '19 19:03 lpuv

Did you launch Scapy as root?

guedou avatar Mar 05 '19 21:03 guedou

Please reopen if you ran Scapy as root and have the same problem.

p-l- avatar Mar 08 '19 09:03 p-l-