-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
74 lines (71 loc) · 2.52 KB
/
run.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
from sniffer import Analyzer
from scan import Scan
def run():
# TODO: argparse
# parser = argparse.ArgumentParser(description="Network Monitoring Script")
#
# parser.add_argument("--sniff", action="store_true", help="Sniff network traffic")
# parser.add_argument("--spoof", action="store_true", help="Spoof network")
# parser.add_argument("--data-transfers", action="store_true", help="Analyze data transfers")
# parser.add_argument("--domains", action="store_true", help="Analyze domains")
#
# args = parser.parse_args()
#
# if args.sniff:
# pass
# elif args.spoof:
# pass
# elif args.data_transfers:
# pass
# elif args.domains:
# pass
# else:
# pass
while (1):
print("\nWatching the network...")
arp = Scan.arp_cache()
# TODO switch to arp_cache
devices: int = len(arp[0])
if devices == 0:
print("No activity detected on the network")
print("--------------\n--------------")
mode: str = input("\n1- Sniffing 2- Spoofing 3- Data transfers 4- Domains 5- ARP cache r- Refresh\n--> ")
try:
if int(mode) == 1:
if devices > 0:
net: str = input("Choose what to sniff: (type 'all' to sniff all) ")
else:
net: str = 'all'
if net.lower() != 'all':
target_mac = arp[0][int(net)]
target_ip = arp[1][target_mac]
print(f"Sniffing {target_ip} {target_mac}...")
Analyzer.sniff(target_ip, target_mac)
else:
print(f"Sniffing all...")
Analyzer.sniff()
if int(mode) == 2:
if devices == 0:
print("Nothing to spoof...")
target_mac = arp[0][int(net)]
net: str = input("Choose what to spoof: ")
target_mac = arp[0][int(net)]
target_ip = arp[1][target_mac]
Analyzer.spoof(target_ip)
exit()
if int(mode) == 3:
Analyzer.speed(plot=True)
exit()
if int(mode) == 4:
Analyzer.domains(plot=True)
exit()
if int(mode) == 5:
Scan.arp_cache()
except:
if mode == 'r':
print("Refreshing...")
else:
print("Wrong entry")
if __name__ == "__main__":
# Scan.arp_cache()
run()