I'm working on a program that automatically scans the local network using ARP requests on a Raspberry Pi 3. The code works fine on my computer, but when I try to run it on my Raspberry Pi, it fails with the following error:
File "/usr/local/lib/python2.7/dist-packages/scapy/base_classes.py",
line 241, in __getattr__
raise AttributeError(attr)
AttributeError: who_has
The code that raises this error is as follows:
from scapy import *
result, unanswered = sr(ARP(op=ARP.who_has, psrc="192.168.0.79", pdst="192.168.0.1"), timeout=3)
I've also encountered the same problem (I'm using scapy 2.4.4
), so here is another solution that might work for some of you:
I've just solved it by coding op="who-has"
instead of op=ARP.who_has
.
from scapy import *
result, unanswered = sr(ARP(op="who-has", psrc="192.168.0.79", pdst="192.168.0.1"), timeout=3)
The error was caused because my RPi had a different version of scapy installed and, for some reason, it would not uninstall that version. After resetting my RPi completely and installing the correct version of scapy (2.3.3), the code now runs fine.
Thank you Foon for pointing me in the right direction.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.