-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenumero.py
More file actions
108 lines (87 loc) · 2.67 KB
/
enumero.py
File metadata and controls
108 lines (87 loc) · 2.67 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env python3
import os
import subprocess
import sys
import time
global ip_addresses
global work_directory
global interface
global header
ip_addresses = "10.11.1.1/24"
work_directory = "/root/OSCP/Labs"
interface = "tap0"
header = """
___ _ __ _ _ _ __ ___ ___ _ __ ___
/ _ \ '_ \| | | | '_ ` _ \ / _ \ '__/ _ \
| __/ | | | |_| | | | | | | __/ | | (_) |
\___|_| |_|\__,_|_| |_| |_|\___|_| \___/
"""
def host_discovery():
subprocess.run('clear')
print("""
{}
""".format(header))
# Run command and put output in file
with open("{}/arp_scan".format(work_directory), "w+") as f:
output = subprocess.run(["arp-scan", ip_addresses, "-I", interface], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
f.write("{}: arp-scan {} -I {}\n\n".format(time.ctime(), ip_addresses, interface))
f.write(output.stdout.decode("utf-8"))
# Process file and add output into report
with open("{}/arp_scan".format(work_directory), "r") as f:
print(f)
def main_menu():
subprocess.run('clear')
option = True
while option:
print("""
{}
IP Addresses = {}
Work Directory = {}
1. Complete enumeration
2. Configure
3. Exit
""".format(header, ip_addresses, work_directory))
option = input(" Select option: ")
if option == "1":
host_discovery()
elif option == "2":
configure()
elif option == "3":
exit()
elif option != "":
print("\n Error: Please select a valid option")
def configure():
subprocess.run('clear')
option = True
while option:
print("""
{}
IP Addresses = {}
Work Directory = {}
1. Set IP Addresses
2. Set Working Directory
3. Go back
""".format(header, ip_addresses, work_directory))
option = input(" Select option: ")
if option == "1":
global ip_addresses
ip_addresses = input("\n IP addresses: ")
configure()
elif option == "2":
global work_directory
work_directory = input("\n Work directory: ")
work_directory = "/root/OSCP/Labs/"
configure()
elif option == "3":
main_menu()
elif option != "":
print("\n Error: Please select a valid option")
def exit():
subprocess.run('clear')
print("""
{}
Goodbye!
""".format(header))
sys.exit()
if __name__ == "__main__":
main_menu()