-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArpWarning (1).py
40 lines (36 loc) · 1 KB
/
ArpWarning (1).py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#elior klein 329843999
#avram harrar 324215458
from scapy.all import *
import sys,subprocess
arpcom=subprocess.Popen(["ip neigh show",">>","listarp"],stdin="PIPE",stdout="PIPE",stderr="PIPE",)
stdout,stderr=arpcom.communicate()
myfile=open("listarp")
mylines=myfile.readlines()
mylist=[]
for i in mylines:
mylist.append(i)
mylist=mylist[2:]
counter=[]
i=0
for line in mylist:
mymac=line.split(" ")[1]
for line1 in mylist:
mac=line1.split(" ")[1]
if mac == mymac:
counter[i]+=1
i+=1
for count in counter:
if count>=2:
print("you are in arp attack")
while True:
myDict = {}
for pkt in sniff('arp',count='50'):
if myDict[pkt[Ether].src] is None:# NUll?
myDict[pkt[Ether].src] = 1
else:
myDict[pkt[Ether].src] += 1
for key,value in myDict:
if value >= 20:
print("the MAC %s is spoofing your IP".format(key))
sleep(5)
# We had some issues installing the virtual machines so we had no way to check if the code works