-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
90 lines (75 loc) · 3.25 KB
/
Copy pathmain.py
File metadata and controls
90 lines (75 loc) · 3.25 KB
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
import tkinter as tk
import random
boot_lines = [
"[ OK ] Started Network Manager",
"[ OK ] Mounted /boot",
"[ OK ] Started GNOME Display Manager",
"[FAILED] Failed to start Load Kernel Modules",
"[ OK ] Started Authorization Manager",
"[ OK ] Reached target Graphical Interface",
"[ OK ] Started Login Service",
"[ OK ] Started User Manager for UID 1000",
"[ OK ] Started Session c1 of user archuser"
]
def generate_fake_log():
return f"[ {round(random.uniform(0.00001, 3.99999), 5)}] {random.choice(['usb', 'kernel', 'systemd', 'udevd'])}: {random.choice(['Device ready', 'Initializing', 'Mounting', 'Daemon started'])}"
class BootSimulator:
def __init__(self, root):
self.root = root
root.title("Secure System Boot")
root.attributes("-fullscreen", True)
root.configure(bg="black")
root.bind("<Escape>", lambda e: self.close_program())
# Use a Frame to stack widgets vertically
self.frame = tk.Frame(root, bg="black")
self.frame.pack(fill="both", expand=True)
self.text = tk.Text(self.frame, bg="black", fg="white", insertbackground="white",
font=("Courier", 14), borderwidth=0)
self.text.pack(side="top", fill="both", expand=True)
self.text.config(state=tk.DISABLED)
self.entry = tk.Entry(self.frame, bg="black", fg="white", insertbackground="white",
font=("Courier", 14), borderwidth=0, width=41)
self.entry.bind("<Return>", self.handle_input)
self.lines_to_print = boot_lines + [generate_fake_log() for _ in range(40)]
random.shuffle(self.lines_to_print)
self.line_index = 0
self.login_stage = 0
self.root.after(500, self.print_next_line)
def print_next_line(self):
if self.line_index < len(self.lines_to_print):
self.append_line(self.lines_to_print[self.line_index])
self.line_index += 1
self.root.after(80 + random.randint(20, 100), self.print_next_line)
else:
self.ask_login()
def append_line(self, line):
self.text.config(state=tk.NORMAL)
self.text.insert(tk.END, line + "\n")
self.text.see(tk.END)
self.text.config(state=tk.DISABLED)
def ask_login(self):
self.append_line("\nArun's Secure System Login: ")
self.entry.pack(side="bottom", anchor="w", padx=0)
self.entry.focus()
def handle_input(self, event):
input_text = self.entry.get()
self.entry.delete(0, tk.END)
self.entry.pack_forget()
if self.login_stage == 0:
self.append_line(input_text)
self.append_line("Password: ")
self.login_stage = 1
self.entry.config(show="*")
self.entry.pack(side="bottom", anchor="w", padx=0)
self.entry.focus()
elif self.login_stage == 1:
self.append_line("*" * len(input_text))
self.append_line("\nStarting systemd...\n")
self.entry.config(state=tk.DISABLED)
self.entry.pack_forget()
self.root.after(1000, self.close_program)
def close_program(self):
self.root.destroy()
root = tk.Tk()
app = BootSimulator(root)
root.mainloop()