0

just wanted to see if there’s a way to resolve a warning i get in pyCharm.

Currently watching Learn python & ethical hacking from scratch: Using Scapy To Create an ARP Request.

When using

import scapy.all as scapy 
arpRequest = scapy.ARP()

I’m receiving a warning ( the program runs, but the warning is of course annoying)

Warning:

Cannot find reference 'ARP' in 'all.py'

Any ideas?

pythomatic
  • 647
  • 4
  • 13

4 Answers4

1

Best practice is to use the scapy submodules from here in the fashon of from scapy.layers.l2 import ARP, Ether.

However, I do find that method quite annoying and not very beginner friendly as you are constantly trawling the docs.

I would recomend using Visual Studio Code with pipenv. From my expierence, its pretty similar to Pycharm and you can use import scapy.all as scapy without any errors

Rochie
  • 23
  • 6
0

Had the same issue, this is fixed by providing the full path instead of using scapy.all

try the following

from scapy.layers.l2 import ARP

from scapy.layers.l2 import Ether

Mario Rojas
  • 136
  • 1
  • 7
0

For others learning this same course, Apart from the scapy.all import, use from scapy.layers.l2 import ARP, Ether.

In summary, you should have the imports like this

import scapy.all as scapy
from scapy.layers.l2 import ARP, Ether

From the above, rather than writing scapy.ARP and scapy.Ether, simply write ARP and Ether respectively. Install scapy from pycharm terminal using. pip install scapy

To know your broadcast address, use the command route -n then replace IP with the value.

If running the script on the Linux terminal and you get a permissionError, run like this

sudo python3 <nameofthefile>.py
PM 77-1
  • 12,933
  • 21
  • 68
  • 111
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 21 '22 at 13:23
-2

I run this with a Linux terminal and it gave me the same error. Then I used "python3 example.py" instead of using just "python example.py"

Then the code works. I think this might help with your issue.

#python #arp #scapy #arping