Adding_Final_Marged
This commit is contained in:
parent
f28f3cefb8
commit
0fbae04a94
514
Final_Marged.py
514
Final_Marged.py
@ -28,6 +28,41 @@ from sklearn.preprocessing import StandardScaler
|
|||||||
import sklearn.ensemble._forest
|
import sklearn.ensemble._forest
|
||||||
from threading import Thread, Event
|
from threading import Thread, Event
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#hardware check
|
||||||
|
# Function to run device check before showing the wizard window
|
||||||
|
def device_check():
|
||||||
|
try:
|
||||||
|
subprocess.run(['python3', 'intaller.py'], check=True)
|
||||||
|
return True
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(f"Error running device check script: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Global variable for thread control
|
# Global variable for thread control
|
||||||
stop_event = Event()
|
stop_event = Event()
|
||||||
value = False
|
value = False
|
||||||
@ -47,12 +82,18 @@ important_features = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Drop features you don't need based on what you used in training
|
# Drop features you don't need based on what you used in training
|
||||||
drop_features = [
|
# Drop features you don't need based on what you used in training
|
||||||
'src', 'dst', 'dt', 'dur', 'pktrate', 'pktperflow',
|
drop_features = ['src', 'dst', 'dt', 'dur', 'pktrate', 'pktperflow',
|
||||||
'Protocol_HTTP', 'Protocol_HTTPS', 'Protocol_SSH',
|
|
||||||
'Protocol_DHCP', 'Protocol_FTP', 'Protocol_SMTP',
|
'Protocol_HTTP',
|
||||||
'Protocol_POP3', 'Protocol_IMAP', 'Protocol_DNS'
|
'Protocol_HTTPS',
|
||||||
]
|
'Protocol_SSH',
|
||||||
|
'Protocol_DHCP',
|
||||||
|
'Protocol_FTP',
|
||||||
|
'Protocol_SMTP',
|
||||||
|
'Protocol_POP3',
|
||||||
|
'Protocol_IMAP',
|
||||||
|
'Protocol_DNS']
|
||||||
|
|
||||||
# Automatically detect active network interface
|
# Automatically detect active network interface
|
||||||
def get_active_interface():
|
def get_active_interface():
|
||||||
@ -153,7 +194,7 @@ def make_predictions(X_test, X):
|
|||||||
for row in transposed_predictions:
|
for row in transposed_predictions:
|
||||||
row_sum = sum(row)
|
row_sum = sum(row)
|
||||||
avg = row_sum / 5
|
avg = row_sum / 5
|
||||||
X['probability'][i] = avg
|
X.loc[i, 'probability'] = avg
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
with open('predictions.csv', mode='w', newline='') as file:
|
with open('predictions.csv', mode='w', newline='') as file:
|
||||||
@ -167,45 +208,67 @@ def make_predictions(X_test, X):
|
|||||||
print("could not connect to server")
|
print("could not connect to server")
|
||||||
|
|
||||||
def capture_packets(interface=None):
|
def capture_packets(interface=None):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(['sudo', 'apt', 'install', '-y', 'tshark'])
|
subprocess.check_call(['sudo', 'apt', 'install', '-y', 'tshark'])
|
||||||
print("tshark installed successfully.")
|
print("tshark installed successfully.")
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print("Failed to install tshark. Please install it manually.")
|
print("Failed to install tshark. Please install it manually.")
|
||||||
|
|
||||||
if interface is None:
|
if interface is None:
|
||||||
interface = get_active_interface()
|
interface = get_active_interface()
|
||||||
|
|
||||||
capture = pyshark.LiveCapture(interface=interface, tshark_path='/usr/bin/tshark')
|
capture = pyshark.LiveCapture(interface=interface, tshark_path='/usr/bin/tshark')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# print("here")
|
||||||
|
# capture.sniff(timeout=60)
|
||||||
while value:
|
while value:
|
||||||
|
# print(value)
|
||||||
packets_list = []
|
packets_list = []
|
||||||
if stop_event.is_set():
|
if stop_event.is_set():
|
||||||
break
|
break
|
||||||
|
# print("c")
|
||||||
count = 0
|
count = 0
|
||||||
|
# print(packets_list)
|
||||||
for packet in capture:
|
for packet in capture:
|
||||||
if count == 15:
|
# print("Packet", packet)
|
||||||
break
|
|
||||||
|
# if(count == 15):
|
||||||
|
# break
|
||||||
|
# print(f"Packet No. - {count} Received!")
|
||||||
try:
|
try:
|
||||||
processed_packet = preprocess_packet(packet)
|
processed_packet = preprocess_packet(packet)
|
||||||
|
|
||||||
if processed_packet is not None:
|
if processed_packet is not None:
|
||||||
|
# print(processed_packet["dst_ip"])
|
||||||
|
# print(processed_packet["src_ip"])
|
||||||
|
|
||||||
if ":" in processed_packet["dst_ip"] or ":" in processed_packet["src_ip"]:
|
if ":" in processed_packet["dst_ip"] or ":" in processed_packet["src_ip"]:
|
||||||
|
print("packet isn't correct")
|
||||||
continue
|
continue
|
||||||
|
# print(processed_packet)
|
||||||
packets_list.append(processed_packet)
|
packets_list.append(processed_packet)
|
||||||
count += 1
|
count+=1
|
||||||
|
print(count, len(packets_list))
|
||||||
|
|
||||||
|
# X_test_scaled = prepare_X_test(packets_list, drop_features)
|
||||||
|
if len(packets_list) >= 1:
|
||||||
|
X_test = pd.concat(packets_list, ignore_index=True)
|
||||||
|
X_test_scaled = X_test.drop(drop_features, axis=1, errors='ignore')
|
||||||
|
X_test_scaled = X_test_scaled.reindex(columns=important_features, fill_value=0)
|
||||||
|
|
||||||
|
if X_test_scaled is not None:
|
||||||
|
make_predictions(X_test_scaled,X_test)
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
print(f"Error processing packet: {e}")
|
print(f"Error processing packet: {e}")
|
||||||
|
print("Packets being Captured..!")
|
||||||
if len(packets_list) >= 1:
|
|
||||||
X_test = pd.concat(packets_list, ignore_index=True)
|
|
||||||
X_test_scaled = X_test.drop(drop_features, axis=1, errors='ignore')
|
except KeyboardInterrupt:
|
||||||
X_test_scaled = X_test_scaled.reindex(columns=important_features, fill_value=0)
|
|
||||||
|
|
||||||
if X_test_scaled is not None:
|
|
||||||
results = make_predictions(X_test_scaled, X_test)
|
|
||||||
time.sleep(10)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print("\nPacket capturing stopped.")
|
print("\nPacket capturing stopped.")
|
||||||
|
|
||||||
def start_capture():
|
def start_capture():
|
||||||
@ -697,30 +760,28 @@ class PermissionChangeHandler(FileSystemEventHandler):
|
|||||||
# print(f"Updated {operation} for {file_extension}: {perms[key]}")
|
# print(f"Updated {operation} for {file_extension}: {perms[key]}")
|
||||||
|
|
||||||
class AuditDManagerApp:
|
class AuditDManagerApp:
|
||||||
# def __init__(self, root):
|
def __init__(self, frame):
|
||||||
# self.root = root
|
self.frame = frame
|
||||||
# self.root.title("AuditD Manager")
|
# self.root = frame
|
||||||
# self.root.geometry("400x350") # Adjusted for additional widget
|
# self.root.title("AuditD Manager")
|
||||||
|
# self.root.geometry("400x350")
|
||||||
|
# # Adjusted for additional widget
|
||||||
|
self.frame.pack(fill='both', expand=True)
|
||||||
|
|
||||||
# # Create Widgets
|
|
||||||
# self.install_button = tk.Button(root, text="Install AuditD", command=self.install_auditd)
|
# Create Widgets
|
||||||
# self.install_button.pack(pady=10)
|
self.install_button = tk.Button(self.frame , text="Install AuditD", command=self.install_auditd)
|
||||||
|
self.install_button.pack(pady=10)
|
||||||
|
|
||||||
# self.start_button = tk.Button(root, text="Start AuditD", command=self.start_auditd)
|
self.start_button = tk.Button(self.frame , text="Start AuditD", command=self.start_auditd)
|
||||||
# self.start_button.pack(pady=10)
|
self.start_button.pack(pady=10)
|
||||||
|
|
||||||
# self.stop_button = tk.Button(root, text="Stop AuditD", command=self.stop_auditd)
|
self.stop_button = tk.Button(self.frame , text="Stop AuditD", command=self.stop_auditd)
|
||||||
# self.stop_button.pack(pady=10)
|
self.stop_button.pack(pady=10)
|
||||||
|
|
||||||
# self.status_button = tk.Button(root, text="Check Status", command=self.check_status)
|
self.status_button = tk.Button(self.frame, text="Check Status", command=self.check_status)
|
||||||
# self.status_button.pack(pady=10)
|
self.status_button.pack(pady=10)
|
||||||
def __init__(self, root):
|
|
||||||
self.root = root
|
|
||||||
# Ensure root is a Tk or Toplevel object
|
|
||||||
if isinstance(self.root, tk.Tk) or isinstance(self.root, tk.Toplevel):
|
|
||||||
self.root.title("AuditD Manager")
|
|
||||||
else:
|
|
||||||
raise TypeError("root must be a Tk or Toplevel window")
|
|
||||||
|
|
||||||
# Add Text Entry for Watch Path
|
# Add Text Entry for Watch Path
|
||||||
|
|
||||||
@ -1546,9 +1607,6 @@ def browse_start_dirs():
|
|||||||
start_dirs_entry.insert(0, ', '.join(directories))
|
start_dirs_entry.insert(0, ', '.join(directories))
|
||||||
|
|
||||||
|
|
||||||
# def malware_gui(frame):
|
|
||||||
# frame.tkraise() # Raise the malware frame (if needed)
|
|
||||||
|
|
||||||
def malware_gui(parent_frame):
|
def malware_gui(parent_frame):
|
||||||
# Create a new window for malware analysis
|
# Create a new window for malware analysis
|
||||||
malware_window = tk.Toplevel(parent_frame)
|
malware_window = tk.Toplevel(parent_frame)
|
||||||
@ -1564,25 +1622,28 @@ def malware_gui(parent_frame):
|
|||||||
tk.Button(malware_window, text="Browse...", command=browse_hex_directories).pack(pady=5)
|
tk.Button(malware_window, text="Browse...", command=browse_hex_directories).pack(pady=5)
|
||||||
tk.Button(malware_window, text="Analyze Malware", command=lambda: print("Analyzing...")).pack(pady=10)
|
tk.Button(malware_window, text="Analyze Malware", command=lambda: print("Analyzing...")).pack(pady=10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import ttk
|
from tkinter import ttk
|
||||||
|
# Requires `pip install ttkthemes`
|
||||||
|
|
||||||
def create_wizard_window():
|
def create_wizard_window():
|
||||||
global root
|
global root
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
root.title("File Conversion and Disassembly Wizard")
|
root.title("File Conversion and Disassembly Wizard")
|
||||||
root.geometry("600x400")
|
root.geometry("700x450")
|
||||||
root.resizable(False, False)
|
root.resizable(False, False)
|
||||||
|
|
||||||
# Wizard frames
|
# Wizard frames with a more appealing color scheme
|
||||||
frame1 = tk.Frame(root, bg="#f0f0f0")
|
frame1 = tk.Frame(root, bg="#ffffff")
|
||||||
frame2 = tk.Frame(root, bg="#f0f0f0")
|
frame2 = tk.Frame(root, bg="#f9f9f9")
|
||||||
frame3 = tk.Frame(root, bg="#f0f0f0")
|
frame3 = tk.Frame(root, bg="#f9f9f9")
|
||||||
frame4 = tk.Frame(root, bg="#f0f0f0")
|
frame4 = tk.Frame(root, bg="#ffffff")
|
||||||
frame5 = tk.Frame(root, bg="#f0f0f0")
|
frame5 = tk.Frame(root, bg="#f9f9f9")
|
||||||
frame6 = tk.Frame(root, bg="#f0f0f0")
|
frame6 = tk.Frame(root, bg="#ffffff")
|
||||||
|
frames = [frame1, frame2, frame3, frame4, frame5, frame6]
|
||||||
frames = [frame1, frame2, frame3, frame4,frame5,frame6]
|
|
||||||
|
|
||||||
def show_frame(frame):
|
def show_frame(frame):
|
||||||
"""Hide all frames and show only the specified one."""
|
"""Hide all frames and show only the specified one."""
|
||||||
@ -1592,143 +1653,334 @@ def create_wizard_window():
|
|||||||
|
|
||||||
def update_progress(step):
|
def update_progress(step):
|
||||||
"""Update the progress bar and label to reflect the current step."""
|
"""Update the progress bar and label to reflect the current step."""
|
||||||
progress_label.config(text=f"Step {step} of 4")
|
progress_label.config(text=f"Step {step} of 5")
|
||||||
progress_bar['value'] = (step / 4) * 100
|
progress_bar['value'] = (step / 5) * 100
|
||||||
|
|
||||||
# Title bar frame for better aesthetics
|
# Enhanced Title Bar with Icons
|
||||||
title_frame = tk.Frame(root, bg="#0078d7")
|
title_frame = tk.Frame(root, bg="#283593")
|
||||||
title_frame.pack(fill="x", side="top")
|
title_frame.pack(fill="x", side="top")
|
||||||
|
|
||||||
title_label = tk.Label(title_frame, text="Setup Wizard", font=("Arial", 14, "bold"), fg="white", bg="#0078d7")
|
title_label = tk.Label(
|
||||||
|
title_frame,
|
||||||
|
text="🛠 Setup Wizard",
|
||||||
|
font=("Arial", 16, "bold"),
|
||||||
|
fg="white",
|
||||||
|
bg="#283593",
|
||||||
|
anchor="w", padx=20
|
||||||
|
)
|
||||||
title_label.pack(pady=10)
|
title_label.pack(pady=10)
|
||||||
|
|
||||||
# Progress bar
|
# Progress bar with percentage display
|
||||||
progress_bar = ttk.Progressbar(root, orient="horizontal", mode="determinate", length=400)
|
progress_frame = tk.Frame(root, bg="#f0f0f0")
|
||||||
progress_bar.pack(side="bottom", pady=10)
|
progress_frame.pack(fill="x", side="bottom")
|
||||||
|
progress_bar = ttk.Progressbar(progress_frame, orient="horizontal", mode="determinate", length=500)
|
||||||
progress_label = tk.Label(root, text="Step 1 of 4", font=("Arial", 12))
|
progress_bar.pack(side="left", padx=20, pady=10)
|
||||||
progress_label.pack(side="bottom")
|
progress_label = tk.Label(progress_frame, text="Step 1 of 5", font=("Arial", 12), bg="#f0f0f0")
|
||||||
|
progress_label.pack(side="left", padx=10)
|
||||||
|
|
||||||
# Frame 1 - Welcome Screen
|
# Frame 1 - Welcome Screen
|
||||||
label1 = tk.Label(frame1, text="Welcome to the File Conversion Wizard", font=("Arial", 16), bg="#f0f0f0")
|
label1 = tk.Label(frame1, text="Welcome to the File Conversion Wizard", font=("Arial", 18, "bold"), bg="#ffffff")
|
||||||
label1.pack(pady=40)
|
label1.pack(pady=40)
|
||||||
desc_label1 = tk.Label(frame1, text="This wizard will guide you through the steps.", bg="#f0f0f0", font=("Arial", 12))
|
desc_label1 = tk.Label(frame1, text="This wizard will guide you through the steps.", bg="#ffffff", font=("Arial", 12))
|
||||||
desc_label1.pack(pady=10)
|
desc_label1.pack(pady=10)
|
||||||
|
|
||||||
next_button1 = ttk.Button(frame1, text="Next", command=lambda: [update_progress(2), show_frame(frame2)])
|
|
||||||
next_button1.pack(pady=10, side="bottom")
|
|
||||||
|
|
||||||
# Frame 2 - Packet Capture UI
|
next_button1 = ttk.Button(frame1, text="Next ➡️", command=lambda: [update_progress(2), show_frame(frame2)])
|
||||||
label2 = tk.Label(frame2, text="Packet Capture Setup", font=("Arial", 16), bg="#f0f0f0")
|
next_button1.pack(pady=20)
|
||||||
|
|
||||||
|
# Frame 2 - Packet Capture Setup
|
||||||
|
label2 = tk.Label(frame2, text="📡 Packet Capture Setup", font=("Arial", 16, "bold"), bg="#f9f9f9")
|
||||||
label2.pack(pady=40)
|
label2.pack(pady=40)
|
||||||
|
|
||||||
# Insert your packet capture setup UI here
|
|
||||||
setup_gui(frame2) # Assuming you have this function defined
|
setup_gui(frame2) # Assuming you have this function defined
|
||||||
|
|
||||||
# Create a separate frame for buttons
|
|
||||||
button_frame2 = tk.Frame(frame2, bg="#f0f0f0")
|
button_frame2 = tk.Frame(frame2, bg="#f9f9f9")
|
||||||
button_frame2.pack(side="bottom", pady=10)
|
button_frame2.pack(side="bottom", pady=10)
|
||||||
|
|
||||||
next_button2 = ttk.Button(button_frame2, text="Next", command=lambda: [update_progress(3), show_frame(frame3)], width=10)
|
next_button2 = ttk.Button(button_frame2, text="Next ➡️", command=lambda: [update_progress(3), show_frame(frame3)], width=10)
|
||||||
next_button2.pack(side="right", padx=10)
|
next_button2.pack(side="right", padx=10)
|
||||||
|
back_button2 = ttk.Button(button_frame2, text="⬅️ Back", command=lambda: [update_progress(1), show_frame(frame1)], width=10)
|
||||||
back_button2 = ttk.Button(button_frame2, text="Back", command=lambda: [update_progress(1), show_frame(frame1)], width=10)
|
|
||||||
back_button2.pack(side="left", padx=10)
|
back_button2.pack(side="left", padx=10)
|
||||||
# Frame 3 - Malware Analysis
|
|
||||||
|
# Frame 3 - Malware Analysis with Tabbed Layout
|
||||||
notebook = ttk.Notebook(frame3)
|
notebook = ttk.Notebook(frame3)
|
||||||
notebook.pack(fill='both', expand=True)
|
notebook.pack(fill='both', expand=True)
|
||||||
|
|
||||||
# Hex Conversion and ELF Disassembly tabs
|
|
||||||
hex_frame = ttk.Frame(notebook)
|
hex_frame = ttk.Frame(notebook)
|
||||||
asm_frame = ttk.Frame(notebook)
|
asm_frame = ttk.Frame(notebook)
|
||||||
notebook.add(hex_frame, text='Hex Conversion')
|
notebook.add(hex_frame, text='🔢 Hex Conversion')
|
||||||
notebook.add(asm_frame, text='ELF Disassembly')
|
notebook.add(asm_frame, text='⚙️ ELF Disassembly')
|
||||||
|
|
||||||
# Frame 3 Content
|
|
||||||
tk.Label(hex_frame, text="Select Directories to Convert to Hex:", font=("Arial", 12)).pack(pady=5)
|
tk.Label(hex_frame, text="Select Directories to Convert to Hex:", font=("Arial", 12)).pack(pady=5)
|
||||||
global hex_files_entry
|
global hex_files_entry
|
||||||
hex_files_entry = tk.Entry(hex_frame, width=80)
|
hex_files_entry = tk.Entry(hex_frame, width=80)
|
||||||
hex_files_entry.pack(pady=5)
|
hex_files_entry.pack(pady=5)
|
||||||
tk.Button(hex_frame, text="Browse...", command=browse_hex_directories).pack(pady=5)
|
tk.Button(hex_frame, text="Browse...").pack(pady=5)
|
||||||
tk.Button(hex_frame, text="Convert to Hex", command=run_hex_conversion).pack(pady=10)
|
tk.Button(hex_frame, text="Convert to Hex").pack(pady=10)
|
||||||
|
|
||||||
tk.Label(asm_frame, text="Select Directories to Scan for ELF Files:", font=("Arial", 12)).pack(pady=5)
|
tk.Label(asm_frame, text="Select Directories to Scan for ELF Files:", font=("Arial", 12)).pack(pady=5)
|
||||||
global start_dirs_entry
|
global start_dirs_entry
|
||||||
start_dirs_entry = tk.Entry(asm_frame, width=80)
|
start_dirs_entry = tk.Entry(asm_frame, width=80)
|
||||||
start_dirs_entry.pack(pady=5)
|
start_dirs_entry.pack(pady=5)
|
||||||
tk.Button(asm_frame, text="Browse...", command=browse_start_dirs).pack(pady=5)
|
tk.Button(asm_frame, text="Browse...").pack(pady=5)
|
||||||
tk.Button(asm_frame, text="Disassemble ELF Files", command=run_disassembly).pack(pady=10)
|
tk.Button(asm_frame, text="Disassemble ELF Files").pack(pady=10)
|
||||||
|
|
||||||
next_button3 = ttk.Button(frame3, text="Next", command=lambda: [update_progress(4), show_frame(frame4)])
|
button_frame3 = tk.Frame(frame3, bg="#f9f9f9")
|
||||||
next_button3.pack(side="right", padx=10, pady=20)
|
button_frame3.pack(side="bottom", pady=10)
|
||||||
|
next_button3 = ttk.Button(button_frame3, text="Next ➡️", command=lambda: [update_progress(4), show_frame(frame4)], width=10)
|
||||||
back_button3 = ttk.Button(frame3, text="Back", command=lambda: [update_progress(2), show_frame(frame2)])
|
next_button3.pack(side="right", padx=10)
|
||||||
back_button3.pack(side="left", padx=10, pady=20)
|
back_button3 = ttk.Button(button_frame3, text="⬅️ Back", command=lambda: [update_progress(2), show_frame(frame2)], width=10)
|
||||||
|
back_button3.pack(side="left", padx=10)
|
||||||
|
|
||||||
# Frame 4 - Ransomware Detection
|
# Frame 4 - Ransomware Detection
|
||||||
label4 = tk.Label(frame4, text="Ransomware Detection", font=("Arial", 16), bg="#f0f0f0")
|
label4 = tk.Label(frame4, text="🛡️ Ransomware Detection", font=("Arial", 16, "bold"), bg="#f0f0f0", fg="#333")
|
||||||
label4.pack(pady=40)
|
label4.pack(pady=20)
|
||||||
|
|
||||||
directory_frame = tk.Frame(frame4, bg="#f0f0f0")
|
directory_frame = tk.Frame(frame4, bg="#f0f0f0")
|
||||||
directory_frame.pack(pady=10)
|
directory_frame.pack(pady=10)
|
||||||
|
|
||||||
selected_dir_label = tk.Label(directory_frame, text="No Directory Selected", width=40, bg="#f0f0f0")
|
selected_dir_label = tk.Label(directory_frame, text="No Directory Selected", width=50, bg="#f0f0f0", font=("Arial", 12), fg="#666")
|
||||||
selected_dir_label.grid(row=1, column=0)
|
selected_dir_label.grid(row=1, column=0, pady=10)
|
||||||
|
|
||||||
def select_directory():
|
def select_directory():
|
||||||
directory = browse_directory()
|
# Placeholder for directory selection functionality
|
||||||
if directory:
|
selected_dir_label.config(text="Selected Directory Path")
|
||||||
selected_dir_label.config(text=directory)
|
|
||||||
|
|
||||||
browse_button = ttk.Button(directory_frame, text="Select Directory", command=select_directory)
|
browse_button = ttk.Button(directory_frame, text="📂 Select Directory", command=select_directory)
|
||||||
browse_button.grid(row=0, column=0)
|
browse_button.grid(row=0, column=0, pady=5)
|
||||||
|
|
||||||
status_label = tk.Label(frame4, text="", fg="blue", bg="#f0f0f0")
|
status_label = tk.Label(frame4, text="", fg="blue", bg="#f0f0f0", font=("Arial", 12))
|
||||||
status_label.pack(pady=10)
|
status_label.pack(pady=10)
|
||||||
|
|
||||||
run_button = ttk.Button(frame4, text="Run Predictions", command=lambda: run_predictions(selected_dir_label.cget("text"), status_label))
|
button_frame4 = tk.Frame(frame4, bg="#f0f0f0")
|
||||||
run_button.pack(pady=10)
|
button_frame4.pack(side="bottom", pady=15)
|
||||||
|
|
||||||
finish_button = ttk.Button(frame4, text="Finish", command=root.quit)
|
|
||||||
finish_button.pack(side="right", padx=10, pady=20)
|
|
||||||
|
|
||||||
back_button4 = ttk.Button(frame4, text="Back", command=lambda: [update_progress(3), show_frame(frame3)])
|
|
||||||
back_button4.pack(side="left", padx=10, pady=20)
|
|
||||||
|
|
||||||
|
next_button4 = ttk.Button(button_frame4, text="Next ➡️", command=lambda: [update_progress(5), show_frame(frame5)], width=10)
|
||||||
|
next_button4.pack(side="right", padx=10)
|
||||||
|
back_button4 = ttk.Button(button_frame4, text="⬅️ Back", command=lambda: [update_progress(3), show_frame(frame3)], width=10)
|
||||||
|
back_button4.pack(side="left", padx=10)
|
||||||
|
|
||||||
# Frame 5 - AuditD Manager
|
# Frame 5 - AuditD Manager
|
||||||
# Pass root to AuditDManagerApp instead of frame5
|
label5 = tk.Label(frame5, text="🔍 AuditD Manager", font=("Arial", 16, "bold"), bg="#f0f0f0", fg="#333")
|
||||||
audit_app = AuditDManagerApp(root)
|
label5.pack(pady=20)
|
||||||
audit_app.frame.pack(fill='both', expand=True)
|
|
||||||
|
# Placeholder for AuditD Manager
|
||||||
|
audit_app = AuditDManagerApp(frame5) # Uncomment and define if AuditDManagerApp is available
|
||||||
|
audit_app.frame.pack(fill='both', expand=True, pady=10)
|
||||||
|
|
||||||
# Navigation buttons for Frame 5
|
|
||||||
button_frame5 = tk.Frame(frame5, bg="#f0f0f0")
|
button_frame5 = tk.Frame(frame5, bg="#f0f0f0")
|
||||||
button_frame5.pack(side="bottom", pady=10)
|
button_frame5.pack(side="bottom", pady=15)
|
||||||
|
|
||||||
back_button5 = ttk.Button(button_frame5, text="Back", command=lambda: [update_progress(4), show_frame(frame4)], width=10)
|
next_button5 = ttk.Button(button_frame5, text="Next ➡️", command=lambda: show_frame(frame6), width=10)
|
||||||
|
next_button5.pack(side="right", padx=10)
|
||||||
|
back_button5 = ttk.Button(button_frame5, text="⬅️ Back", command=lambda: [update_progress(4), show_frame(frame4)], width=10)
|
||||||
back_button5.pack(side="left", padx=10)
|
back_button5.pack(side="left", padx=10)
|
||||||
|
|
||||||
finish_button = ttk.Button(button_frame5, text="Finish", command=root.quit, width=10)
|
# Frame 6 - Completion Screen
|
||||||
finish_button.pack(side="right", padx=10)
|
label6 = tk.Label(frame6, text="🎉 Setup Complete!", font=("Arial", 18, "bold"), bg="#ffffff")
|
||||||
|
|
||||||
# Frame 6 - Summary (Optional)
|
|
||||||
label6 = tk.Label(frame6, text="Setup Complete!", font=("Arial", 16), bg="#f0f0f0")
|
|
||||||
label6.pack(pady=40)
|
label6.pack(pady=40)
|
||||||
desc_label6 = tk.Label(frame6, text="Thank you for using the setup wizard.", bg="#f0f0f0", font=("Arial", 12))
|
desc_label6 = tk.Label(frame6, text="Thank you for using the setup wizard.", bg="#ffffff", font=("Arial", 12))
|
||||||
desc_label6.pack(pady=10)
|
desc_label6.pack(pady=10)
|
||||||
|
finish_button = ttk.Button(frame6, text="➡️ Finish ⬅️", command=root.quit, width=10)
|
||||||
|
finish_button.pack(pady=10)
|
||||||
|
|
||||||
# Show the first frame
|
# Show the first frame
|
||||||
show_frame(frame1)
|
show_frame(frame1)
|
||||||
|
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def on_closing():
|
def on_closing():
|
||||||
root.quit()
|
root.quit()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if device_check():
|
||||||
create_wizard_window()
|
# If device check is successful, initialize the Tkinter window
|
||||||
|
create_wizard_window()
|
||||||
|
else:
|
||||||
|
# If the device check fails, show an error message and exit
|
||||||
|
print("Device check failed. Exiting program.")
|
||||||
|
messagebox.showerror("Error", "Device check failed. The wizard will not start.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# def create_wizard_window():
|
||||||
|
# global root
|
||||||
|
# root = tk.Tk()
|
||||||
|
# root.title("File Conversion and Disassembly Wizard")
|
||||||
|
# root.geometry("600x400")
|
||||||
|
# root.resizable(False, False)
|
||||||
|
|
||||||
|
# # Wizard frames
|
||||||
|
# frame1 = tk.Frame(root, bg="#f0f0f0")
|
||||||
|
# frame2 = tk.Frame(root, bg="#f0f0f0")
|
||||||
|
# frame3 = tk.Frame(root, bg="#f0f0f0")
|
||||||
|
# frame4 = tk.Frame(root, bg="#f0f0f0")
|
||||||
|
# frame5 = tk.Frame(root, bg="#f0f0f0")
|
||||||
|
# frame6 = tk.Frame(root, bg="#f0f0f0")
|
||||||
|
|
||||||
|
# frames = [frame1, frame2, frame3, frame4, frame5, frame6]
|
||||||
|
|
||||||
|
# current_step = 1
|
||||||
|
|
||||||
|
# def show_frame(frame):
|
||||||
|
# """Hide all frames and show only the specified one."""
|
||||||
|
# for frm in frames:
|
||||||
|
# frm.pack_forget()
|
||||||
|
# frame.pack(fill='both', expand=True)
|
||||||
|
|
||||||
|
# def update_progress(step):
|
||||||
|
# """Update the progress bar and label to reflect the current step."""
|
||||||
|
# progress_label.config(text=f"Step {step} of 5")
|
||||||
|
# progress_bar['value'] = (step / 5) * 100
|
||||||
|
|
||||||
|
# # Title bar frame for better aesthetics
|
||||||
|
# title_frame = tk.Frame(root, bg="#0078d7")
|
||||||
|
# title_frame.pack(fill="x", side="top")
|
||||||
|
|
||||||
|
# title_label = tk.Label(title_frame, text="Setup Wizard", font=("Arial", 14, "bold"), fg="white", bg="#0078d7")
|
||||||
|
# title_label.pack(pady=10)
|
||||||
|
|
||||||
|
# # Progress bar
|
||||||
|
# progress_bar = ttk.Progressbar(root, orient="horizontal", mode="determinate", length=400)
|
||||||
|
# progress_bar.pack(side="bottom", pady=10)
|
||||||
|
|
||||||
|
# progress_label = tk.Label(root, text="Step 1 of 5", font=("Arial", 12))
|
||||||
|
# progress_label.pack(side="bottom")
|
||||||
|
|
||||||
|
# # Frame 1 - Welcome Screen
|
||||||
|
# label1 = tk.Label(frame1, text="Welcome to the File Conversion Wizard", font=("Arial", 16), bg="#f0f0f0")
|
||||||
|
# label1.pack(pady=40)
|
||||||
|
# desc_label1 = tk.Label(frame1, text="This wizard will guide you through the steps.", bg="#f0f0f0", font=("Arial", 12))
|
||||||
|
# desc_label1.pack(pady=10)
|
||||||
|
|
||||||
|
# next_button1 = ttk.Button(frame1, text="Next", command=lambda: [update_progress(2), show_frame(frame2)])
|
||||||
|
# next_button1.pack(pady=10, side="bottom")
|
||||||
|
|
||||||
|
# # Frame 2 - Packet Capture UI
|
||||||
|
# label2 = tk.Label(frame2, text="Packet Capture Setup", font=("Arial", 16), bg="#f0f0f0")
|
||||||
|
# label2.pack(pady=40)
|
||||||
|
|
||||||
|
# # Insert your packet capture setup UI here
|
||||||
|
# setup_gui(frame2) # Assuming you have this function defined
|
||||||
|
|
||||||
|
# button_frame2 = tk.Frame(frame2, bg="#f0f0f0")
|
||||||
|
# button_frame2.pack(side="bottom", pady=10)
|
||||||
|
|
||||||
|
# next_button2 = ttk.Button(button_frame2, text="Next", command=lambda: [update_progress(3), show_frame(frame3)], width=10)
|
||||||
|
# next_button2.pack(side="right", padx=10)
|
||||||
|
|
||||||
|
# back_button2 = ttk.Button(button_frame2, text="Back", command=lambda: [update_progress(1), show_frame(frame1)], width=10)
|
||||||
|
# back_button2.pack(side="left", padx=10)
|
||||||
|
|
||||||
|
# # Frame 3 - Malware Analysis
|
||||||
|
# notebook = ttk.Notebook(frame3)
|
||||||
|
# notebook.pack(fill='both', expand=True)
|
||||||
|
|
||||||
|
# hex_frame = ttk.Frame(notebook)
|
||||||
|
# asm_frame = ttk.Frame(notebook)
|
||||||
|
# notebook.add(hex_frame, text='Hex Conversion')
|
||||||
|
# notebook.add(asm_frame, text='ELF Disassembly')
|
||||||
|
|
||||||
|
# tk.Label(hex_frame, text="Select Directories to Convert to Hex:", font=("Arial", 12)).pack(pady=5)
|
||||||
|
# global hex_files_entry
|
||||||
|
# hex_files_entry = tk.Entry(hex_frame, width=80)
|
||||||
|
# hex_files_entry.pack(pady=5)
|
||||||
|
# tk.Button(hex_frame, text="Browse...",command=browse_hex_directories).pack(pady=5)
|
||||||
|
# tk.Button(hex_frame, text="Convert to Hex",command=run_hex_conversion).pack(pady=10)
|
||||||
|
|
||||||
|
# tk.Label(asm_frame, text="Select Directories to Scan for ELF Files:", font=("Arial", 12)).pack(pady=5)
|
||||||
|
# global start_dirs_entry
|
||||||
|
# start_dirs_entry = tk.Entry(asm_frame, width=80)
|
||||||
|
# start_dirs_entry.pack(pady=5)
|
||||||
|
# tk.Button(asm_frame, text="Browse...", command=browse_start_dirs).pack(pady=5)
|
||||||
|
# tk.Button(asm_frame, text="Disassemble ELF Files",command=run_disassembly).pack(pady=10)
|
||||||
|
|
||||||
|
# button_frame3 = tk.Frame(frame3, bg="#f0f0f0")
|
||||||
|
# button_frame3.pack(side="bottom", pady=10)
|
||||||
|
|
||||||
|
# next_button3 = ttk.Button(button_frame3, text="Next", command=lambda: [update_progress(4), show_frame(frame4)], width=10)
|
||||||
|
# next_button3.pack(side="right", padx=10)
|
||||||
|
|
||||||
|
# back_button3 = ttk.Button(button_frame3, text="Back", command=lambda: [update_progress(2), show_frame(frame2)], width=10)
|
||||||
|
# back_button3.pack(side="left", padx=10)
|
||||||
|
|
||||||
|
# # Frame 4 - Ransomware Detection
|
||||||
|
# label4 = tk.Label(frame4, text="Ransomware Detection", font=("Arial", 16), bg="#f0f0f0")
|
||||||
|
# label4.pack(pady=40)
|
||||||
|
|
||||||
|
# directory_frame = tk.Frame(frame4, bg="#f0f0f0")
|
||||||
|
# directory_frame.pack(pady=10)
|
||||||
|
|
||||||
|
# selected_dir_label = tk.Label(directory_frame, text="No Directory Selected", width=40, bg="#f0f0f0")
|
||||||
|
# selected_dir_label.grid(row=1, column=0)
|
||||||
|
|
||||||
|
# # Directory label
|
||||||
|
|
||||||
|
|
||||||
|
# def select_directory():
|
||||||
|
# directory = browse_directory()
|
||||||
|
# if directory:
|
||||||
|
# selected_dir_label.config(text=directory)
|
||||||
|
# # Start the watchdog observer
|
||||||
|
|
||||||
|
# browse_button = ttk.Button(directory_frame, text="Select Directory", command=select_directory)
|
||||||
|
# browse_button.grid(row=0, column=0)
|
||||||
|
|
||||||
|
# status_label = tk.Label(frame4, text="", fg="blue", bg="#f0f0f0")
|
||||||
|
# status_label.pack(pady=10)
|
||||||
|
|
||||||
|
# run_button = ttk.Button(frame4, text="Run Predictions", command=lambda: run_predictions(selected_dir_label.cget("text"), status_label))
|
||||||
|
# run_button.pack(pady=10)
|
||||||
|
|
||||||
|
# button_frame4 = tk.Frame(frame4, bg="#f0f0f0")
|
||||||
|
# button_frame4.pack(side="bottom", pady=10)
|
||||||
|
|
||||||
|
# next_button4 = ttk.Button(button_frame4, text="Next", command=lambda: [update_progress(5), show_frame(frame5)], width=10)
|
||||||
|
# next_button4.pack(side="right", padx=10)
|
||||||
|
|
||||||
|
# back_button4 = ttk.Button(button_frame4, text="Back", command=lambda: [update_progress(3), show_frame(frame3)], width=10)
|
||||||
|
# back_button4.pack(side="left", padx=10)
|
||||||
|
|
||||||
|
# # Frame 5 - AuditD Manager
|
||||||
|
# audit_app = AuditDManagerApp(frame5)
|
||||||
|
# audit_app.frame.pack(fill='both', expand=True)
|
||||||
|
|
||||||
|
# # tk.Label(frame5, text="AuditD Manager", font=("Arial", 16), bg="#f0f0f0").pack(pady=40)
|
||||||
|
|
||||||
|
|
||||||
|
# button_frame5 = tk.Frame(frame5, bg="#f0f0f0")
|
||||||
|
# button_frame5.pack(side="bottom", pady=10)
|
||||||
|
|
||||||
|
# next_button5 = ttk.Button(button_frame5, text="Next", command=lambda: show_frame(frame6), width=10)
|
||||||
|
# next_button5.pack(side="right", padx=10)
|
||||||
|
|
||||||
|
# back_button5 = ttk.Button(button_frame5, text="Back", command=lambda: [update_progress(4), show_frame(frame4)], width=10)
|
||||||
|
# back_button5.pack(side="left", padx=10)
|
||||||
|
|
||||||
|
# # Frame 6 - Summary
|
||||||
|
# label6 = tk.Label(frame6, text="Setup Complete!", font=("Arial", 16), bg="#f0f0f0")
|
||||||
|
# label6.pack(pady=40)
|
||||||
|
# desc_label6 = tk.Label(frame6, text="Thank you for using the setup wizard.", bg="#f0f0f0", font=("Arial", 12))
|
||||||
|
# desc_label6.pack(pady=10)
|
||||||
|
|
||||||
|
# finish_button = ttk.Button(frame6, text="Finish", command=root.quit, width=10)
|
||||||
|
# finish_button.pack(pady=10)
|
||||||
|
|
||||||
|
# # Show the first frame
|
||||||
|
# show_frame(frame1)
|
||||||
|
|
||||||
|
# root.mainloop()
|
||||||
|
|
||||||
|
|
||||||
|
# def on_closing():
|
||||||
|
# root.quit()
|
||||||
|
|
||||||
|
# if __name__ == "__main__":
|
||||||
|
|
||||||
|
# root = tk.Tk()
|
||||||
|
# create_wizard_window()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user