-
Notifications
You must be signed in to change notification settings - Fork 2
/
zmapReporter.py
95 lines (82 loc) · 2.89 KB
/
zmapReporter.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
92
93
94
95
# main wrapper for project
# import all src files
# contains argument parsing, error handling, user messaging, script calling
###
import os
import sys
from src.zscript import *
def runRep():
while True:
try:
p = int(input("\nInput Port Number between 1 and 65535 \nor (-1) to return to main menu: "))
except ValueError:
print("Error: Invalid input")
print("Enter a port between 0 and 65535")
continue
else:
if p == -1: return
elif p < 1 and p > 65535:
print("Error: Invalid input")
print("Enter a port between 1 and 65535")
else:
break
while True:
try:
n = int(input("\nInput Sample Size between 5 and 500 \nor (-1) to return to main menu: "))
except ValueError:
print("Error: Invalid input")
print("Enter a sample size between 5 and 500")
continue
else:
if n == -1: return
elif n < 5 and n > 500:
print("Error: Invalid input")
print("Enter a sample size between 5 and 500")
else:
break
while True:
try:
s = int(input("\nInput Scan Size Small (1), Medium (2), or Large (3) \nor (-1) to return to main menu: "))
except ValueError:
print("Error: Invalid input")
print("Enter a scan size Small (1), Medium (2), or Large (3)")
continue
else:
if s == -1: return
elif s < 1 and p > 3:
print("Error: Invalid input")
print("Enter a scan size Small (1), Medium (2), or Large (3)")
else:
break
zmap_reporter = ZmapReporter(p, n, s)
zmap_reporter.zmap()
zmap_reporter.zgrab_scans()
banner_dfs = zmap_reporter.parse_banners()
zmap_reporter.nmap_scans(banner_dfs)
nmap_dict = zmap_reporter.nmap_parser()
zmap_reporter.plot_outputs(banner_dfs, nmap_dict)
def helpMes():
helpfile=("docs/help.txt")
os.system('cat docs/help.txt')
x = input("Press enter to return to the main menu.\n")
def main():
ex = 0
os.system('mkdir output')
print('\n###############################################')
print("Welcome to ZmapReporter, please make a selection \nfrom the available options in the main menu and press enter.\n")
while ex == 0:
print("Main Menu")
print("Run Reporter (r)")
print("Help (h)")
print("Exit (e)")
inp = input("Selection: ")
if (inp == 'r'):
runRep()
elif (inp == 'h'):
helpMes()
elif (inp == 'e'):
sys.exit(0)
else:
print("Error: Invalid input\n")
if __name__ == "__main__":
main()