scapy.error.Scapy_Exception: No /dev/bpf handle is available !
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 !
Did you launch Scapy as root?
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
Did you launch Scapy as root?
Please reopen if you ran Scapy as root and have the same problem.