-
Notifications
You must be signed in to change notification settings - Fork 0
/
MalwareDetectionGUI.py
49 lines (40 loc) · 1.37 KB
/
MalwareDetectionGUI.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
import os
import hashlib
import magic
import pefile
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
import yara
import tkinter as tk
from tkinter import filedialog
# Rest of your functions (file_properties, calculate_hashes, static_analysis, etc.)
# Function to handle file selection using GUI
def select_file():
file_path = filedialog.askopenfilename(title="Select Malware Sample")
if file_path:
analyze_file(file_path)
# Function to analyze the selected file
def analyze_file(file_path):
# Rest of your analysis functions
print(f"Selected File: {file_path}")
size, file_type = file_properties(file_path)
md5_hash, sha1_hash, sha256_hash = calculate_hashes(file_path)
# Rest of the analysis
# ...
# Function to perform dynamic analysis
def dynamic_analysis(file_path):
# Execute the file in a sandbox environment
# Monitor system behavior and capture network traffic
# ...
# Rest of your functions
# Main function
def main():
root = tk.Tk()
root.title("Malware Analysis GUI")
# Create GUI elements
select_button = tk.Button(root, text="Select Malware Sample", command=select_file)
select_button.pack(pady=20)
root.mainloop()
if __name__ == "__main__":
main()