-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront_end.py
278 lines (210 loc) · 14.5 KB
/
front_end.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
from tkinter import Tk
from tkinter import *
from tkinter import ttk
from tkinter import font
from tkinter import messagebox
from tkinter import filedialog
import selenium.common.exceptions
from back_end import *
# #from back_end import port_scanner_report, is_error_from_url_entry
# from back_end import check_redirect_https
# from back_end import port_scanner
def command_portscanCheckbutton(): # LabelFrame for portscan comes up if checkbutton clicked, and destroys otherwise
global portscandetailsLabelframe
global from_portscanEntry_Variable, to_portscanEntry_Variable
if variable_portscanCheckbutton.get() == 0: # If the portscan checkbutton is unselected, do:
portscandetailsLabelframe.destroy()
elif variable_portscanCheckbutton.get() == 1: # If the portscan checkbutton is selected, do:
messagebox4portscan = messagebox.showwarning("Port Scan", "Please note that port scanning takes long time.\n"
"Input your port scan range wisely")
portscandetailsLabelframe = LabelFrame(master=optionsFrame, text="Because You Selected PortScan", font="tlwg_typist")
portscandetailsLabelframe.grid(row=3, column=0, sticky=W, pady=25)
### Label and Entry for: Port Scan "From:"
from_portscanLabel = Label(master=portscandetailsLabelframe, text="From:")
from_portscanLabel.grid(row=4, column=1)
from_portscanEntry_Variable = IntVar(value=1)
from_portscanEntry = Entry(master=portscandetailsLabelframe, textvariable=from_portscanEntry_Variable)
from_portscanEntry.grid(row=4, column=2)
# Label and Entry or: Port Scan "To"
to_portscanLabel = Label(master=portscandetailsLabelframe, text="To:")
to_portscanLabel.grid(row=6, column=1)
to_portscanEntry_Variable = IntVar(value=1)
to_portscanEntry = Entry(master=portscandetailsLabelframe, textvariable=to_portscanEntry_Variable)
to_portscanEntry.grid(row=6, column=2)
def command_spam_bruteforce_Checkbutton(): # Command function for spam bruteforce Checkbutton
global spam_bruteforceLabelframe
if variable_spam_bruteforceCheckbutton.get() == 0: # If spam bruteforce unselected do:
spam_bruteforceLabelframe.destroy()
elif variable_spam_bruteforceCheckbutton.get() == 1: # If spam bruteforce selected do:
def chooseChromeExe():
#global chrome_locationEntry
chrome_exe = filedialog.askopenfile(mode="r", filetypes=[("Executable(.exe)", "*.exe")])
chrome_locationEntry.delete(0,END)
chrome_locationEntry.insert(0, chrome_exe.name)
chrome_locationEntry.config(state=DISABLED)
spam_bruteforceLabelframe = LabelFrame(master=optionsFrame, text="Because you selected 'Spam/Bruteforce Resistance'",
font="tlwg_typist")
spam_bruteforceLabelframe.grid(row=3, column=1, sticky=E, columnspan=5, pady=25)
### Widgets defined for when Spam/Bruteforce Checkbutton is clicked
# Label and Entry for the username/email existing in the system that would be used to bruteforce
username2useLabel = Label(master=spam_bruteforceLabelframe, text="Existing username/email to use:")
username2useLabel.grid(row=0, column=1, padx=25)
global username2useEntry
username2useEntry = Entry(master=spam_bruteforceLabelframe)
username2useEntry.grid(row=0, column=2, padx=25)
# Label for text: Please select which ELEMENT and enter the ELEMENT value you would like to utilise
element_valueLabel = Label(master=spam_bruteforceLabelframe, font="freemono",
text="Please select which ELEMENT and enter the ELEMENT value you would like to utilise:")
element_valueLabel.grid(row=1, column=1, pady=15, columnspan=4)
# Definition of variables for username, password, login Variable
global usernameVariable, passwordVariable, loginVariable
global usernameEntry, passwordEntry, loginEntry
usernameVariable = IntVar(value=0)
passwordVariable = IntVar(value=0)
loginVariable = IntVar(value=0)
# Username/Email Text Field
usernameLabel = Label(master=spam_bruteforceLabelframe, text="Username/Email:", font="tlwg_typist")
usernameLabel.grid(row=2, column=1)
# Username/Email 'name' Element Radiobutton
name_usernameRadio = Radiobutton(master=spam_bruteforceLabelframe, text="By Name", variable=usernameVariable,
value=1)
name_usernameRadio.grid(row=2, column=2)
# Username/Email 'css selector' Element Radiobutton
css_selector_usernameRadio = Radiobutton(master=spam_bruteforceLabelframe, text="By CSS Selector",
variable=usernameVariable, value=2)
css_selector_usernameRadio.grid(row=2, column=3)
# Username/Email Entry Box to receive either name/css selector input
usernameEntry = Entry(master=spam_bruteforceLabelframe)
usernameEntry.grid(row=2, column=4, padx=20)
# Password Text Field
passwordLabel = Label(master=spam_bruteforceLabelframe, text="Password:", font="tlwg_typist")
passwordLabel.grid(row=3, column=1)
# Password 'name' Element Radiobutton
name_passwordRadio = Radiobutton(master=spam_bruteforceLabelframe, text="By Name", variable=passwordVariable,
value=1)
name_passwordRadio.grid(row=3, column=2)
# Password 'css selector' Element Radiobutton
css_selector_passwordRadio = Radiobutton(master=spam_bruteforceLabelframe, text="By CSS Selector",
variable=passwordVariable, value=2)
css_selector_passwordRadio.grid(row=3, column=3)
# Entry Entry Box to receive either name/css selector input
passwordEntry = Entry(master=spam_bruteforceLabelframe)
passwordEntry.grid(row=3, column=4, padx=20)
# Login Button Field
loginField = Label(master=spam_bruteforceLabelframe, text="Login:", font="tlwg_typist")
loginField.grid(row=6, column=1)
# Login 'name' Element Radiobutton
name_loginRadio = Radiobutton(master=spam_bruteforceLabelframe, text="By Name", variable=loginVariable,
value=1)
name_loginRadio.grid(row=6, column=2)
# Login 'css selector' Element Radiobutton
css_selector_loginRadio = Radiobutton(master=spam_bruteforceLabelframe, text="By CSS Selector",
variable=loginVariable, value=2)
css_selector_loginRadio.grid(row=6, column=3)
# Login Entry Box to receive either name/css selector input
loginEntry = Entry(master=spam_bruteforceLabelframe)
loginEntry.grid(row=6, column=4, padx=20)
# File Dialog to specify location of Chrome/Brave Browser
chrome_locationButton = Button(master=spam_bruteforceLabelframe, text="Browse to Chrome/Brave Browser executable",
command=chooseChromeExe)
chrome_locationButton.grid(row=7, column=1, padx=20)
global chrome_locationEntry
chrome_locationEntry = Entry(master=spam_bruteforceLabelframe, width=70)
chrome_locationEntry.grid(row=7, column=2, padx=20, columnspan=5)
def command_begin_scanButton(): # Command function for BeginScan Button
messagebox.showinfo(title="Cross check URL", message="Please check your URL and ensure the following:\n"
"-- that you are connected to the internet\n"
"-- that the URL is in the form 'www.google.com': with no special characters like '/'\n"
"-- that the specified URL is valid")
save_report = open("VunScan Report.txt", "w")
url = input_websiteEntry.get().strip()
if variable_portscanCheckbutton.get() == 1: # iF PORT scan checkbox is toggled on
save_report.write("Port Scan Report\n-------------------------\n")
save_report.write(port_scanner(url, from_portscanEntry_Variable.get(), to_portscanEntry_Variable.get()))
messagebox.showinfo(title="Success",
message="All process Completed. Please check the 'VunScan Report.txt' for the generated report")
if variable_http_sslCheckbutton.get() == 1:
save_report.write("HTTPs/SSL Presence Report\n----------------------\n")
save_report.write(check_redirect_https(url))
messagebox.showinfo(title="Success",
message="All process Completed. Please check the 'VunScan Report.txt' for the generated report")
if variable_spam_bruteforceCheckbutton.get() == 1:
print("cool")
save_report.write("Spam/Bruteforce Resistance?\n-------------------------\n")
print("spam")
# if usernameVariable.get() == 1: # For USERNAME: 'By Name' radio was selected
# print(usernameEntry.get()+"1")
# elif usernameVariable.get() == 2: # For USERNAME: 'By CSS selector' radio was selected
# print(usernameEntry.get()+"2")
# if passwordVariable.get() == 1: # For PASSWORD: 'By Name' radio was selected
# print(passwordEntry.get()+"1")
# elif passwordVariable.get() == 2: # For PASSWORD: 'By CSS selector' radio was selected
# print(passwordEntry.get()+"2")
# if loginVariable.get() == 1: # For LOGIN: 'By Name' radio was selected
# print(loginEntry.get()+"1")
# elif loginVariable.get() == 2: # For LOGIN: 'By CSS selector' radio was selected
# print(loginEntry.get()+"2")
# try:
ss = brute_force_login_page(input_websiteEntry.get(), username2useEntry.get(), usernameEntry.get(), passwordEntry.get(), loginEntry.get(),
usernameVariable.get(), passwordVariable.get(), loginVariable.get(), chrome_locationEntry.get())
save_report.write(ss)
# except (selenium.common.exceptions.NoSuchWindowException, selenium.common.exceptions.WebDriverException):
# messagebox.showinfo(title="Success",
# message="All process Completed. Please check the 'VunScan Report.txt' for the generated report")
# print("nosuchwindow, driver")
save_report.close()
main_window = Tk() # Creates a GUI window
main_window.title("Website VunScan") # Sets window name for main_window
main_window.iconname('vunscan.exe')
main_window.config(bg="dim gray") # Set general window background
# Font specifications
font_input_textLabel = font.Font(family="FreeMono", name="freemono", weight="bold", size=10,) # font for input_textLabel
font_titleLabel = font.Font(family="Arial", name="arial", weight="bold", size=30) # font for titleLabel
font_spam_bruteforce_elements = font.Font(family="Tlwg Typist", name="tlwg_typist", weight="bold", slant="italic", size=8) # font for bruteforce checkbutton Element Labels
# Label for: Website VunScan
titleLabel = Label(master=main_window, text="Website VunScan", relief=FLAT, bg="dim gray", fg="dark slate gray", font="arial", anchor=CENTER)
titleLabel.grid(row=5, column=5, columnspan=100, pady=20)
# Label for: Input the website you will like to use to run VunScan below
input_textLabel = Label(master=main_window, text="Input the website you will like to VunScan below:", bg="dim gray",
font="freemono")# Description label for entry box below
input_textLabel.grid(row=10, column=5, ipady=15, columnspan=100 )
# Entry for accepting website URL
input_websiteEntry = Entry(master=main_window,) # Entry widget for inputing website URL
input_websiteEntry.grid(row=15, column=5, pady=5, padx=15, sticky=EW, columnspan=100)
# Sepearator that seperates input part from options to scan part
input_optionsSeperator = ttk.Separator(master=main_window, orient=HORIZONTAL)
input_optionsSeperator.grid(row=20, column=5, columnspan=100, sticky=EW, pady=35)
# Label for: Choose which scan to perform:
input_optionsLabel = Label(master=main_window, text="Choose which scan to perform:", bg="dim gray", font="freemono",) # Label description for options to scan chooser
input_optionsLabel.grid(row=25, column=5, columnspan=100, pady=20)
# Frame to host all 3 scan options
optionsFrame = Frame(master=main_window, bg="dim gray")
optionsFrame.grid(row=30, column=5, columnspan=100, padx=20)
# Port Scan checkbutton variable
variable_portscanCheckbutton = IntVar(master=main_window)
# Port Scan checkbutton
options_portscanCheckbutton = Checkbutton(master=optionsFrame, text="Port Scan", bg="dim gray",
variable=variable_portscanCheckbutton, command=command_portscanCheckbutton,)
options_portscanCheckbutton.grid(row=0, column=0)
# HTTP/SSH Presence IntVariable
variable_http_sslCheckbutton = IntVar(master=main_window)
# HTTP/SSL Presence checkbutton
options_http_sslCheckbutton = Checkbutton(master=optionsFrame, text="HTTP/SSL Presence", bg="dim gray", variable=variable_http_sslCheckbutton)
options_http_sslCheckbutton.grid(row=0, column=1)
# Spam/Bruteforce IntVariable
variable_spam_bruteforceCheckbutton = IntVar(master=main_window)
# Spam/Bruteforce checkbutton
options_spam_bruteforceCheckbutton = Checkbutton(master=optionsFrame, text="Spam/Bruteforce Resistance", bg="dim gray",
command=command_spam_bruteforce_Checkbutton, variable=variable_spam_bruteforceCheckbutton)
options_spam_bruteforceCheckbutton.grid(row=0, column=5)
# Separator between options & Begin vunscan button
options_begin_vunscanSeperator = ttk.Separator(master=main_window, orient=HORIZONTAL)
options_begin_vunscanSeperator.grid(row=35, column=5, sticky=EW, pady=35, columnspan=100)
# Button: Begin VunScan
begin_vunscanButton = Button(master=main_window, text="Begin VunScan", bg="dim gray", font="freemono", fg="white",
command=command_begin_scanButton)
begin_vunscanButton.grid(row=40, column=5, pady=40, columnspan=100)
# Status Bar
options_status_barLabel = Label(master=main_window, text="", relief=SUNKEN)
options_status_barLabel.grid(row=45, column=5, columnspan=100, sticky=EW)
main_window.mainloop() # Main loop for main_window