/
Menus.py
161 lines (138 loc) · 5.52 KB
/
Menus.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import sys,os,socket,Generation,Connectivity,Stress
import InternalInformation as Internal
import Core as Core
from colorama import init,Fore
from os import execle
init(autoreset=True)
#Menu Lists
MainMenu = [" 1) Packet Generation | Generate Network Traffic"," 2) Connectivity Menu | Ensure Connectivity", " 3) Stress Testing Menu | Test Network Limit's"]
GenerationMenu = [" 1) HTTP | Generate HHTP Traffic"," 2) DHCP | Generate DHCP Traffic"," 3) DNS | Generate DNS Traffic"]
ConnectivityMenu = [" 1) Ping Simple | Check basic connectivity", " 2) Ping Advanced | check basic connectivity with custom parameters"," 3) Tracert | Show each """""hop" towards the target"""]
StressMenu = [" 1) UDP Flooder | Test Port Flooding"]
ConfirmedLocalIP = ''
def DisplayLocalInformationPanel():
Internal.CollectInformationPanelInformation()
print("===============================")
#Formatting Hostname
if Internal.HostName == "Error Obtaining HostName":
print("Hostname: " + Fore.RED + "{Internal.HostName}")
else:
print("Hostname: " + str(Internal.HostName))
#Formatting LocalIP
if Internal.LocalIP == "Error Obtaining LocalIP":
print("Local IP:" + Fore.RED + "{Internal.LocalIP}")
else:
ConfirmedLocalIP = str(Internal.LocalIP)
print("Local IP: " + str(Internal.LocalIP))
#Formatting IPV4
if Internal.GlobalIPV4 == "Error Obtaining IPV4":
print("Global IPV4: " + Fore.RED + "{Internal.GlobalIPV4}")
else:
print("Global IPV4: " + str(Internal.GlobalIPV4))
#Formatting IPV6
if Internal.GlobalIPV6 == "Error Obtaining IPV6":
print("Global IPV6: " + Fore.RED + str(Internal.GlobalIPV6))
else:
print("Global IPV6: " + str(Internal.GlobalIPV6))
print("===============================")
def PrintMainMenu():
print(*MainMenu, sep="\n")
Selection = (input("\nSynapse> "))
try:
if Selection == "exit":
quit()
elif Selection == "reload":
Core.ClearScreen()
os.execl(sys.executable, sys.executable, *sys.argv)
else:
Selection = (int(Selection))
if Selection == 1:
SelectedMenu = (GenerationMenu)
SelectedInput = "Synapse Connectivity> "
SelectMenu(MainMenu,GenerationMenu)
# conselection()
elif Selection == 2:
SelectedMenu = (ConnectivityMenu)
SelectedInput = "Synapse Connectivity> "
SelectMenu(MainMenu,ConnectivityMenu)
# stressselection()
elif Selection == 3:
SelectedMenu = (StressMenu)
SelectedInput = "Synapse Stress> "
SelectMenu(MainMenu,StressMenu)
else:
print("Error Selection Not Valid")
except:
SelectMenu(MainMenu,MainMenu)
def PrintGenerationMenu():
Selection = input("\nGeneration Menu > ")
try:
if Selection == "exit":
#print("Spacer")
SelectMenu(GenerationMenu,MainMenu)
elif Selection == "reload":
Core.ClearScreen()
os.execl(sys.executable, sys.executable, *sys.argv)
else:
Selection = (int(Selection))
if Selection == 1:
Generation.HTTPGen()
elif Selection == 2:
Generation.DHCPGen()
elif Selection == 3:
Generation.DNSGen()
except:
SelectMenu(GenerationMenu,GenerationMenu)
def PrintConnectivityMenu():
Selection = input("\nConnectivity Menu > ")
try:
if Selection == "exit":
#print("Spacer")
SelectMenu(ConnectivityMenu,MainMenu)
elif Selection == "reload":
Core.ClearScreen()
os.execl(sys.executable, sys.executable, *sys.argv)
else:
Selection = (int(Selection))
if Selection == 1:
Connectivity.SimplePingGen()
elif Selection == 2:
Connectivity.AdvancedPingGen()
elif Selection == 3:
Connectivity.TracertGen()
except:
SelectMenu(ConnectivityMenu,ConnectivityMenu)
print("Exception")
def PrintStressMenu():
Selection = input("\nStress Menu > ")
try:
if Selection == "exit":
#print("Spacer")
SelectMenu(StressMenu,MainMenu)
elif Selection == "reload":
Core.ClearScreen()
os.execl(sys.executable, sys.executable, *sys.argv)
else:
Selection = (int(Selection))
if Selection == 1:
Stress.UDPFlooderGen()
except:
SelectMenu(StressMenu,StressMenu)
def SelectMenu(CurrentMenu,SelectedMenu):
for i in CurrentMenu:
Core.RemoveLine()
Core.RemoveLine()
Core.RemoveLine()
# print(SelectedMenu, sep="\n")
SelectMenu = str(SelectedMenu)
if str(SelectMenu) == str(MainMenu):
PrintMainMenu()
elif str(SelectMenu) == str(GenerationMenu):
print(*GenerationMenu, sep="\n")
PrintGenerationMenu()
elif str(SelectMenu) == str(ConnectivityMenu):
print(*ConnectivityMenu, sep="\n")
PrintConnectivityMenu()
elif str(SelectMenu) == str(StressMenu):
print(*StressMenu, sep="\n")
PrintStressMenu()