-
Notifications
You must be signed in to change notification settings - Fork 2
/
gui.py
59 lines (48 loc) · 1.97 KB
/
gui.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
from tkinter import *
import tkinter.messagebox as tkMessageBox
import trainer as tr
import webbrowser
import pandas
import main
root = Tk()
root.title("Malicious Url Detector")
img = PhotoImage(width=300,height=300)
data = ("{red red red red blue blue blue blue}")
root.attributes('-alpha',0.9)
root.iconbitmap(r'C:\Users\ssrev\PycharmProjects\Malicious _URL_Detector\malware.ico')
#root.configure(background='thistle')
#root.geometry("800x100")
frame = Frame(root)
frame.pack()
bottomframe = Frame(root)
bottomframe.pack(side=BOTTOM)
L1 = Label(frame, text="Enter the URL: ")
L1.pack(side=LEFT)
E1 = Entry(frame, bd=5, width=150)
E1.pack(side=RIGHT)
def submitCallBack():
url = E1.get()
main.process_test_url(url, 'test_features.csv')
return_ans = tr.gui_caller('url_features.csv', 'test_features.csv')
a = str(return_ans).split()
if int(a[1]) == 0:
tkMessageBox.showinfo("URL Checker Result", "The URL " + url + " is Safe to Visit")
new=1
answer = tkMessageBox.askquestion("Redirect","Do you want to visit the url?")
if answer == 'yes':
webbrowser.open(url=E1.get(), new=1)
elif int(a[1]) == 1:
tkMessageBox.showinfo("URL Checker Result", "The URL " + url + " is Malicious")
answer_2 = tkMessageBox.askquestion("Redirect", "The url MALICIOUS, Do you still want to visit the url?")
if answer_2=='yes':
webbrowser.open(url=E1.get(),new=1)
else:
tkMessageBox.showinfo("URL Checker Result", "The URL " + url + " is Malware")
tkMessageBox.showwarning("Warning","Cant Redirect, url contains a malware")
def about():
tkMessageBox.showinfo("About","Authors: Sauhardya Singha, Deepak Triphati, Sakshi Thakur,Ishieta Aggarwal")
B2 = Button(root, text="About", command=about)
B1 = Button(bottomframe, text="Submit", command=submitCallBack)
B2.pack(side=RIGHT, padx=5, pady=5)
B1.pack(side=RIGHT, padx=5,pady=5)
root.mainloop()