'Cannot find Ether class from scapy module
I keep getting an error that says the Ether() method is not defined in my script. I'm using python 2.7 and the arprequest and arpresponse variables are inside a function inside of a class. I'm following along with a tutourial and it is the exact same code. There is also a a project with the same code in it https://github.com/OsandaMalith/ARP-Spoofer/blob/master/arp.py (Line 171)
from scapy import *
arprequest = Ether(dst='ff:ff:ff:ff:ff:ff')/ARP(pdst=ip+str(i), hwdst='ff:ff:ff:ff:ff:ff')
arpresponse = srp1(arprequest, timeout=2, verbose=0)
Traceback (most recent call last):
File "skivy.py", line 96, in <module>
MITMtool().run()
File "/usr/lib/python2.7/dist-packages/kivy/app.py", line 824, in run
runTouchApp()
File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 487, in runTouchApp
EventLoop.window.mainloop()
File "/usr/lib/python2.7/dist-packages/kivy/core/window/window_sdl2.py", line 539, in mainloop
self._mainloop()
File "/usr/lib/python2.7/dist-packages/kivy/core/window/window_sdl2.py", line 300, in _mainloop
EventLoop.idle()
File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 330, in idle
self.dispatch_input()
File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 315, in dispatch_input
post_dispatch_input(*pop(0))
File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 281, in post_dispatch_input
wid.dispatch('on_touch_up', me)
File "_event.pyx", line 699, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:6856)
File "/usr/lib/python2.7/dist-packages/kivy/uix/behaviors.py", line 163, in on_touch_up
self.dispatch('on_release')
File "_event.pyx", line 695, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:6815)
File "_event.pyx", line 1168, in kivy._event.EventObservers.dispatch (kivy/_event.c:11690)
File "_event.pyx", line 1052, in kivy._event.EventObservers._dispatch (kivy/_event.c:10730)
File "/usr/lib/python2.7/dist-packages/kivy/lang.py", line 1465, in custom_callback
exec(__kvlang__.co_value, idmap)
File "<string>", line 28, in <module>
File "skivy.py", line 77, in ARPscan
arprequest = Ether(dst='ff:ff:ff:ff:ff:ff')/ARP(pdst=ip+str(i), hwdst='ff:ff:ff:ff:ff:ff')
NameError: global name 'Ether' is not defined
Solution 1:[1]
The import is incorrect, it should be from the all
module.
from scapy.all import *
If you want a direct import Ether
is in scapy.layers.l2
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | John Keyes |