-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyze.py
executable file
·80 lines (58 loc) · 2.58 KB
/
analyze.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
#!/usr/bin/env python3
from Screen import *
def showImports(root, importFrame, filename):
imports = peExtract(filename)
listbox = Listbox(importFrame, width = 20, height = 20)
listbox.pack(side="left", fill="y")
scrollbar = Scrollbar(importFrame, orient='vertical')
listbox.config(yscrollcommand=scrollbar.set)
scrollbar.config(command=listbox.yview)
scrollbar.pack(side="right", fill="y")
for imp in imports:
listbox.insert(END, imp)
root.update()
def browseFiles(root, selectFrame, label_file_explorer):
filename = filedialog.askopenfilename(initialdir = "/",
title = "Select a File",
filetypes = (("Executables", "*.exe"),
("all files", "*.*")))
# Change label contents
label_file_explorer.configure(text="File Opened: "+filename)
# Show button to extract imports
button_extract_imports = Button(selectFrame, text="Extract Imports",
command=lambda: showImports(root, filename))
button_extract_imports.pack()
# Run Mike stuff on filename
# Show button to analyze imports against model
# Put in Jack code here
# Display result of running against model
def createSelectFileWindow(root):
selectFrame = Frame(root)
selectFrame.place(relwidth=0.6, relheight=0.5, relx=0.01, rely=0.01)
label_file_explorer = Label(selectFrame,
text = "Select a File to Analyze",
width = 100, height = 4,
fg = "blue")
button_explore = Button(root,
text = "Browse Files",
command = lambda: browseFiles(root, selectFrame, label_file_explorer))
button_exit = Button(root,
text = "Exit",
command = exit)
label_file_explorer.pack()
button_explore.pack()
button_exit.pack()
def createImportListWindow(root):
importFrame = Frame(root)
importFrame.config(bg="#f73b3b")
importFrame.place(relwidth=0.37, relheight=0.5, relx=0.62, rely=0.01)
listImports = Listbox(importFrame, width = 20, height = 20, font=("Courier", 12))
listImports.pack(side="left", fill="y")
scrollbar = Scrollbar(importFrame, orient="vertical")
scrollbar.pack(side="right", fill="y")
listImports.config(yscrollcommand=scrollbar.set)
scrollbar.config(command=listImports.yview)
def main():
screen = Screen()
if __name__ == "__main__":
main()