Repository navigation
Expand file tree
/
Copy pathreverse_engineering_game_gui.py
More file actions
2918 lines (2576 loc) · 116 KB
/
Copy pathreverse_engineering_game_gui.py
File metadata and controls
2918 lines (2576 loc) · 116 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
"""GUI version of the Reverse Engineering webinar game using tkinter."""
from __future__ import annotations
import json
import random
import io
import contextlib
import time
from datetime import datetime
from pathlib import Path
import tkinter as tk
from tkinter import messagebox
from tkinter import ttk
try:
import winsound
except ImportError:
winsound = None
class ReverseEngineeringGameGUI:
def __init__(self, root: tk.Tk) -> None:
self.root = root
self.root.title("VM Login")
self.root.geometry("980x700")
self.root.minsize(920, 640)
self.colors = {
"bg": "#1B1F24",
"panel": "#242B33",
"text": "#FFFFFF",
"muted": "#9FB0C0",
"accent": "#D70A53",
"terminal": "#8AE234",
"code_bg": "#0F1419",
"code_text": "#C9D1D9",
}
self.root.configure(bg=self.colors["bg"])
self.total_score = 0
self.completed_levels: set[str] = set()
self.end_credits_shown = False
self.team_scores: dict[str, int] = {}
self.leaderboard_path = Path(__file__).with_name("leaderboard.json")
self.leaderboard_data = self._load_leaderboard()
self.style = ttk.Style()
self.style.theme_use("clam")
self._setup_style()
self.levels = {
"Easy": {
"points": 50,
"expected": "DOOM{BOOTCAMP}",
"desc": "Chapter 1: Bridge Note - Warm-up Word",
"hint": "Hint: A crumpled note under the bridge has scrambled letters.",
"learning_goal": "Spot and apply a simple text transformation rule.",
"real_world": "Analysts often decode scrambled or obfuscated strings to understand hidden behavior.",
"common_mistakes": [
"Forgetting to wrap answer in DOOM{...}",
"Typing the right word with wrong spelling",
"Adding extra spaces before or after the flag",
],
"teacher_script": "We solved this by unscrambling letters, then applying the correct flag format.",
"student_takeaway": "Break a puzzle into steps: transform first, format second.",
"hints": [
"Unscramble this: PMTOOCBA.",
"Think of your current event theme.",
"The solved word is BOOTCAMP.",
],
"walkthrough": (
"Chapter 1 Walkthrough\n\n"
"1) Unscramble PMTOOCBA.\n"
"2) You get BOOTCAMP.\n"
"3) Put it in flag format: DOOM{BOOTCAMP}."
),
"presenter_script": (
"Easy Presenter Script\n\n"
"Chapter 1 starts with a bridge note. The letters look random, but they are only scrambled. "
"We rearrange PMTOOCBA into BOOTCAMP, then wrap it in our flag format."
),
"content": (
"Story: You find a crumpled note under the bridge.\n"
"Mission: Decode the first keyword.\n"
"Puzzle: PMTOOCBA\n"
"Rule: Unscramble the letters, then submit as DOOM{WORD}."
),
},
"Medium": {
"points": 100,
"expected": 'DOOM{"3ARLYB1RD"}',
"desc": "Chapter 2: Earl's Tag - EARLYBIRD Cipher",
"hint": "Hint: Earl stylizes his stage tag as EARLYBIRD.",
"learning_goal": "Practice substitution rules and precise output formatting.",
"real_world": "Reverse engineers frequently decode text that was transformed to hide intent.",
"common_mistakes": [
"Missing the inner double quotes",
"Only replacing one letter (E or I) instead of both",
"Using lowercase when uppercase is expected",
],
"teacher_script": "We converted a plain word using fixed replacement rules and checked formatting precision.",
"student_takeaway": "Small substitution rules can completely change output, so verify every character.",
"hints": [
"Start from EARLYBIRD.",
"Replace E -> 3 and I -> 1.",
'Use exact custom flag: DOOM{"3ARLYB1RD"}.',
],
"walkthrough": (
"Chapter 2 Walkthrough\n\n"
"1) Base phrase is EARLYBIRD.\n"
"2) Apply replacements: E->3, I->1.\n"
"3) Result becomes 3ARLYB1RD.\n"
"4) Wrap with quotes inside braces: DOOM{\"3ARLYB1RD\"}."
),
"presenter_script": (
"Medium Presenter Script\n\n"
"Chapter 2 uses Earl's stage-name lore: EARL + Y + BIRD -> EARLYBIRD. "
"Then we apply gamer-style substitutions to get 3ARLYB1RD and keep exact format."
),
"content": (
"Story: Earl leaves his signature tag near the bridge terminal.\n"
"Mission: Transform the tag to hacker style.\n"
"Base: EARLYBIRD\n"
"Rules: E->3, I->1\n"
"Then submit exactly with inner quotes."
),
},
"Hard": {
"points": 150,
"expected": 'DOOM{"AmBatUkammm"}',
"desc": "Chapter 3: Mask Pattern - Case Control",
"hint": "Hint: The bridge console logs show a strict letter-case mask.",
"learning_goal": "Follow position-based rules accurately under constraints.",
"real_world": "In real analysis, one wrong character can break a key, hash, or validation routine.",
"common_mistakes": [
"Using 0-based indexing instead of 1-based indexing",
"Capitalizing the wrong letters",
"Forgetting the required inner quotes",
],
"teacher_script": "We followed position-based capitalization exactly, then wrapped the answer correctly.",
"student_takeaway": "In security tasks, position and case both matter; precision beats guessing.",
"hints": [
"Start from: ambatukammm",
"Uppercase only letters #1, #3, and #6.",
'Use exact custom flag: DOOM{"AmBatUkammm"}.',
],
"walkthrough": (
"Chapter 3 Walkthrough\n\n"
"1) Start with ambatukammm.\n"
"2) Uppercase positions 1, 3, and 6 (1-based indexing).\n"
"3) You get AmBatUkammm.\n"
"4) Wrap with inner quotes: DOOM{\"AmBatUkammm\"}."
),
"presenter_script": (
"Hard Presenter Script\n\n"
"Chapter 3 is about precision. The console mask tells us which positions must be uppercase. "
"One wrong letter-case breaks the final value, just like in real validation checks."
),
"content": (
"Story: You recover a mask rule from a hidden bridge log file.\n"
"Mission: Apply the letter-case mask exactly.\n"
"Base: ambatukammm\n"
"Mask (1-based): capitalize #1, #3, #6\n"
"Submit using exact quote format."
),
},
"XHARD": {
"points": 200,
"expected": "DOOM{WE_7HE_B3ST}",
"desc": "Chapter 4: Block Hunt - Story Clue Puzzle",
"hint": "Hint: Click block tiles to reveal the real clue fragments.",
"learning_goal": "Collect scattered clues and reconstruct one exact flag.",
"real_world": "Investigators combine many tiny artifacts into one final conclusion.",
"common_mistakes": [
"Submitting before all clue fragments are revealed",
"Mixing decoy words into the final flag",
"Using wrong underscore placement",
],
"teacher_script": "We played a clue-hunt and assembled only valid fragments in the right order.",
"student_takeaway": "Gather evidence first, then format final output.",
"content": (
"Story: You enter a ruined bridge chamber with 9 memory blocks.\n"
"Goal: Find the 4 true fragments hidden among decoys, then combine them into one flag.\n"
"Format reminder: DOOM{...}"
),
},
"CRAZY": {
"points": 250,
"expected": "DOOM{6.7_MASTER}",
"desc": "Chapter 5: Reaction Core - Precision Timing",
"hint": "Hint: Start, wait, then stop exactly at 6.7 seconds.",
"learning_goal": "Practice precision timing under pressure.",
"real_world": "Timing precision matters in exploit development and race-condition analysis.",
"common_mistakes": [
"Stopping too early due to panic",
"Overshooting while waiting for perfect timing",
"Forgetting to retry calmly with rhythm",
],
"teacher_script": "This level rewards patience and micro-precision, not speed.",
"student_takeaway": "Control and timing can be as important as logic in security challenges.",
"content": (
"Story: A reactor lock opens only when your stop timing matches 6.7 seconds.\n"
"Target zone: 6.7 +/- 0.07s"
),
},
"DOOMDADA": {
"points": 300,
"expected": "DOOM{C0n6r@+Ul4tIoN$!}",
"desc": "Final Boss Story Script - Under The Bridge",
"hint": "Hint: Follow each function step and keep exact symbols/casing in final output.",
"learning_goal": "Trace a longer scripted flow and combine transformations in order.",
"real_world": "Real reverse engineering often means reading long logic chains and reconstructing final outputs exactly.",
"common_mistakes": [
"Skipping one function and jumping to final guess",
"Applying substitutions but forgetting exact uppercase/lowercase",
"Using the right phrase but wrong punctuation/symbol positions",
],
"teacher_script": "We solved a long script by tracing functions one by one, then verifying exact final formatting.",
"student_takeaway": "For hard levels, process beats intuition: follow the code path and validate every character.",
"hints": [
"The story text reveals the base phrase: congratulations!",
"apply_leet() swaps letters: o->0, g->6, a->@, t->+, s->$",
"apply_case_pattern() gives: C0n6r@+Ul4tIoN$!",
],
"walkthrough": (
"DOOMDADA Walkthrough\n\n"
"1) Read story_seed(): the key phrase is congratulations!\n"
"2) Run apply_leet(): o->0, g->6, a->@, t->+, s->$\n"
"3) Run apply_case_pattern(): produce C0n6r@+Ul4tIoN$!\n"
"4) build_flag() wraps it as DOOM{C0n6r@+Ul4tIoN$!}."
),
"presenter_script": (
"DOOMDADA Presenter Script\n\n"
"This final level uses a full mini-script instead of one-liners. Students practice the real "
"reverse-engineering habit: inspect each function, follow data flow, and avoid skipping steps."
),
"trace_table": (
"DOOMDADA Trace Table\n\n"
"phrase = congratulations!\n"
"stage1 = c0n6r@+ul@+i0n$!\n"
"stage2 = C0n6r@+Ul4tIoN$!\n"
"flag = DOOM{C0n6r@+Ul4tIoN$!}\n\n"
"Read it left to right: each stage applies one function from the story script."
),
"content": (
"# DOOMDADA Final Script: Bridge Boy Cipher\n"
"# Story: A boy lives under the bridge and writes clues in code.\n"
"# Your mission is to reconstruct his final access flag.\n\n"
"def story_seed() -> str:\n"
" \"\"\"The boy's note says: 'When they finally see me, they say this word.'\"\"\"\n"
" return \"congratulations!\"\n\n"
"def apply_leet(text: str) -> str:\n"
" # Symbol swaps from his notebook\n"
" table = {\"o\": \"0\", \"g\": \"6\", \"a\": \"@\", \"t\": \"+\", \"s\": \"$\"}\n"
" return \"\".join(table.get(ch, ch) for ch in text.lower())\n\n"
"def apply_case_pattern(text: str) -> str:\n"
" # Uppercase indexes from graffiti marks (0-based): 0, 7, 8, 10, 12\n"
" upper_idx = {0, 7, 8, 10, 12}\n"
" out = []\n"
" for i, ch in enumerate(text):\n"
" out.append(ch.upper() if i in upper_idx else ch.lower())\n"
" return \"\".join(out)\n\n"
"def build_flag() -> str:\n"
" phrase = story_seed()\n"
" stage1 = apply_leet(phrase)\n"
" stage2 = apply_case_pattern(stage1)\n"
" return f\"DOOM{{{stage2}}}\"\n\n"
"# QUESTION:\n"
"# What is the exact output of build_flag()?\n"
"# Submit exactly, including symbols and uppercase/lowercase."
),
},
}
self.challenge_window: tk.Toplevel | None = None
self.attempts_left = 0
self.doomdada_attempts_left = 3
self.active_level = ""
self.timer_job: str | None = None
self.time_left = 0
self.side_info_box: tk.Text | None = None
self.console_input: tk.Text | None = None
self.console_output_var: tk.StringVar | None = None
self.boost_mode_var = tk.BooleanVar(value=True)
self.boost_widgets: list[tk.Widget] = []
self.main_code_box: tk.Text | None = None
self.main_code_job: str | None = None
self.main_code_running = False
self.main_bg_box: tk.Text | None = None
self.main_bg_job: str | None = None
self.main_bg_running = False
self.doomdada_card_widget: tk.Widget | None = None
self.doomdada_pulse_job: str | None = None
self.doomdada_pulse_on = False
self.doomdada_alert_bar: tk.Label | None = None
self.doomdada_scan_canvas: tk.Canvas | None = None
self.doomdada_scan_job: str | None = None
self.doomdada_scan_x = 0
self.startup_bg_box: tk.Text | None = None
self.startup_bg_job: str | None = None
self.startup_bg_running = False
self.startup_bg_mode = "login"
self.hint_mode_var = tk.BooleanVar(value=False)
self.mute_sfx_var = tk.BooleanVar(value=False)
self.level_submit_counts: dict[str, int] = {}
self.level_hint_used: set[str] = set()
self.level_start_time: dict[str, float] = {}
self.level_achievements: dict[str, list[str]] = {}
self.level_speed_targets = {
"Easy": 45.0,
"Medium": 60.0,
"Hard": 75.0,
"XHARD": 120.0,
"CRAZY": 25.0,
"DOOMDADA": 180.0,
}
self.root.update_idletasks()
self.root.deiconify()
self._center_root_window()
self._build_startup_screen()
self.root.attributes("-topmost", True)
self.root.after(1200, lambda: self.root.attributes("-topmost", False))
def _center_root_window(self) -> None:
self.root.update_idletasks()
width = self.root.winfo_width() or 980
height = self.root.winfo_height() or 700
screen_w = self.root.winfo_screenwidth()
screen_h = self.root.winfo_screenheight()
x = max(0, (screen_w - width) // 2)
y = max(0, (screen_h - height) // 2)
self.root.geometry(f"{width}x{height}+{x}+{y}")
def _clear_root(self) -> None:
if self.doomdada_pulse_job:
try:
self.root.after_cancel(self.doomdada_pulse_job)
except Exception:
pass
self.doomdada_pulse_job = None
if self.doomdada_scan_job:
try:
self.root.after_cancel(self.doomdada_scan_job)
except Exception:
pass
self.doomdada_scan_job = None
if self.main_bg_job:
try:
self.root.after_cancel(self.main_bg_job)
except Exception:
pass
self.main_bg_job = None
if self.main_code_job:
try:
self.root.after_cancel(self.main_code_job)
except Exception:
pass
self.main_code_job = None
if self.startup_bg_job:
try:
self.root.after_cancel(self.startup_bg_job)
except Exception:
pass
self.startup_bg_job = None
self.main_code_running = False
self.main_code_box = None
self.main_bg_running = False
self.main_bg_box = None
self.doomdada_card_widget = None
self.doomdada_alert_bar = None
self.doomdada_scan_canvas = None
self.doomdada_scan_x = 0
self.startup_bg_running = False
self.startup_bg_box = None
for widget in self.root.winfo_children():
widget.destroy()
def _start_startup_hacker_background(self, parent: tk.Widget, mode: str) -> None:
self.startup_bg_mode = mode
self.startup_bg_running = True
self.startup_bg_box = tk.Text(
parent,
wrap="none",
font=("Consolas", 9),
bg="#06090D",
fg="#2EA043",
insertbackground="#2EA043",
relief="flat",
state="disabled",
)
self.startup_bg_box.place(relx=0, rely=0, relwidth=1, relheight=1)
self.startup_bg_box.lower()
self._append_startup_bg_line("boot:: initializing terminal background stream")
self._append_startup_bg_line("net:: handshake with virtual bridge node")
self._append_startup_bg_line("enc:: 01001100 01001111 01000011 01001011")
self._tick_startup_hacker_background()
def _append_startup_bg_line(self, text: str) -> None:
if self.startup_bg_box is None or not self.startup_bg_box.winfo_exists():
return
self.startup_bg_box.config(state="normal")
self.startup_bg_box.insert("end", text + "\n")
lines = int(float(self.startup_bg_box.index("end-1c").split(".")[0]))
if lines > 260:
self.startup_bg_box.delete("1.0", "50.0")
self.startup_bg_box.see("end")
self.startup_bg_box.config(state="disabled")
def _tick_startup_hacker_background(self) -> None:
if not self.startup_bg_running:
self.startup_bg_job = None
return
if self.startup_bg_box is None or not self.startup_bg_box.winfo_exists():
self.startup_bg_job = None
self.startup_bg_running = False
return
line = self._startup_noise_line(self.startup_bg_mode)
self._append_startup_bg_line(line)
self.startup_bg_job = self.root.after(random.randint(70, 170), self._tick_startup_hacker_background)
def _startup_noise_line(self, mode: str) -> str:
# Build long lines so visible activity fills left/center/right background regions.
binary = "".join(random.choice("01") for _ in range(24))
ip = f"10.{random.randint(0,255)}.{random.randint(0,255)}.{random.randint(1,254)}"
lat = random.randint(2, 120)
code_snippets = [
"for(i=0;i<buf_len;i++){xor[i]^=0x2A;}",
"if(auth(user,pass)==0){grant();}",
"token = sha256(seed + salt).hexdigest()",
"while(socket.open()){recv(pkt);parse(pkt);}",
"flag = f'DOOM{{{stage2}}}'",
"try: connect(host,443); except: retry()",
]
pings = [
f"ping {ip} time={lat}ms TTL=64",
f"icmp_seq={random.randint(1,999)} from {ip} ttl=57 time={lat}ms",
f"nmap scan {ip} -> 22/tcp open 443/tcp open",
]
actions_login = [
"auth:: scanning credential table",
"proc:: checking tty access",
"sys:: awaiting operator login",
"guard:: bruteforce shield active",
]
actions_load = [
"load:: challenge modules -> OK",
"link:: story pipeline synced",
"cache:: prewarming score subsystem",
"boot:: spinning event dispatcher",
]
actions_main = [
"main:: streaming cyber backdrop",
"main:: syncing challenge telemetry",
"main:: rendering binary motion layer",
"main:: operator console online",
]
if mode == "loading":
action = random.choice(actions_load)
elif mode == "main":
action = random.choice(actions_main)
else:
action = random.choice(actions_login)
segments = [
action,
random.choice(code_snippets),
random.choice(pings),
f"bin::{binary}",
f"hex::0x{random.randint(0, 16**8 - 1):08X}",
f"route::{ip}/24 via 10.0.0.1",
]
random.shuffle(segments)
pad = " " * random.randint(0, 36)
return pad + " | ".join(segments)
def _start_main_screen_background(self, parent: tk.Widget) -> None:
self.main_bg_running = True
feed_frame = tk.Frame(parent, bg="#0A1016", highlightbackground="#1E7A47", highlightthickness=1)
feed_frame.pack(fill="x", pady=(0, 10))
tk.Label(
feed_frame,
text="LIVE BACKGROUND CODE FEED",
font=("Consolas", 9, "bold"),
fg="#7EE787",
bg="#0A1016",
anchor="w",
padx=8,
pady=4,
).pack(fill="x")
self.main_bg_box = tk.Text(
feed_frame,
wrap="none",
height=6,
font=("Consolas", 9),
bg="#060B11",
fg="#4ADE80",
insertbackground="#4ADE80",
relief="flat",
state="disabled",
)
self.main_bg_box.pack(fill="x", padx=8, pady=(0, 8))
self._append_main_bg_line("bg:: ambient stream online")
self._append_main_bg_line("bg:: signal boosted for stage visibility")
self._tick_main_screen_background()
def _append_main_bg_line(self, text: str) -> None:
if self.main_bg_box is None or not self.main_bg_box.winfo_exists():
return
self.main_bg_box.config(state="normal")
self.main_bg_box.insert("end", text + "\n")
lines = int(float(self.main_bg_box.index("end-1c").split(".")[0]))
if lines > 280:
self.main_bg_box.delete("1.0", "70.0")
self.main_bg_box.see("end")
self.main_bg_box.config(state="disabled")
def _tick_main_screen_background(self) -> None:
if not self.main_bg_running:
self.main_bg_job = None
return
if self.main_bg_box is None or not self.main_bg_box.winfo_exists():
self.main_bg_job = None
self.main_bg_running = False
return
binary = "".join(random.choice("01") for _ in range(18))
line = random.choice(
[
f"ambient:: {binary} ping 10.{random.randint(0,255)}.{random.randint(0,255)}.{random.randint(1,254)}",
"runner:: parse(token); validate(signature)",
"matrix:: for ch in stream: render(ch)",
"guard:: monitor(levels, score, attempts)",
"trace:: stack.push(seed); transform(); finalize()",
]
)
self._append_main_bg_line(line)
self.main_bg_job = self.root.after(random.randint(180, 360), self._tick_main_screen_background)
def _pulse_doomdada_card(self) -> None:
if self.doomdada_card_widget is None or not self.doomdada_card_widget.winfo_exists():
self.doomdada_pulse_job = None
return
self.doomdada_pulse_on = not self.doomdada_pulse_on
try:
self.doomdada_card_widget.configure(
highlightbackground="#FF4466" if self.doomdada_pulse_on else "#D70A53",
highlightcolor="#FF4466" if self.doomdada_pulse_on else "#D70A53",
)
except Exception:
pass
self.doomdada_pulse_job = self.root.after(760, self._pulse_doomdada_card)
def _stop_doomdada_scanline(self) -> None:
if self.doomdada_scan_job:
try:
self.root.after_cancel(self.doomdada_scan_job)
except Exception:
pass
self.doomdada_scan_job = None
self.doomdada_scan_canvas = None
self.doomdada_scan_x = 0
def _start_doomdada_scanline(self, parent: tk.Widget) -> None:
self._stop_doomdada_scanline()
self.doomdada_scan_canvas = tk.Canvas(
parent,
height=20,
bg="#080C10",
highlightthickness=1,
highlightbackground="#3B0F1F",
relief="flat",
)
self.doomdada_scan_canvas.pack(fill="x", pady=(0, 8))
self.doomdada_scan_x = 0
self._tick_doomdada_scanline()
def _tick_doomdada_scanline(self) -> None:
if self.doomdada_scan_canvas is None or not self.doomdada_scan_canvas.winfo_exists():
self.doomdada_scan_job = None
return
canvas = self.doomdada_scan_canvas
width = max(10, canvas.winfo_width())
height = max(10, canvas.winfo_height())
canvas.delete("all")
for y in range(2, height, 4):
canvas.create_line(0, y, width, y, fill="#102414")
x = self.doomdada_scan_x
canvas.create_line(x, 0, x, height, fill="#3DDC84", width=2)
canvas.create_line(max(0, x - 2), 0, max(0, x - 2), height, fill="#1E7A47")
canvas.create_line(min(width, x + 2), 0, min(width, x + 2), height, fill="#1E7A47")
canvas.create_text(
8,
height // 2,
anchor="w",
text="scanline:: signal integrity monitor",
fill="#6EE7B7",
font=("Consolas", 8),
)
self.doomdada_scan_x += 10
if self.doomdada_scan_x > width + 6:
self.doomdada_scan_x = -6
self.doomdada_scan_job = self.root.after(70, self._tick_doomdada_scanline)
def _build_startup_screen(self) -> None:
self._clear_root()
wrapper = tk.Frame(self.root, bg="#080C10", highlightbackground="#D70A53", highlightthickness=2)
wrapper.pack(fill="both", expand=True, padx=18, pady=18)
self._start_startup_hacker_background(wrapper, "login")
# Add a subtle haze layer so foreground glow pops while keeping background animation visible.
haze = tk.Frame(wrapper, bg="#070A0E")
haze.place(relx=0, rely=0, relwidth=1, relheight=1)
haze.lower()
# Faux shadow and glow stack for center login form.
shadow = tk.Frame(wrapper, bg="#020304")
shadow.place(relx=0.5, rely=0.5, anchor="center", width=560, height=330, x=10, y=12)
glow_outer = tk.Frame(wrapper, bg="#111722", highlightbackground="#2EA043", highlightthickness=1)
glow_outer.place(relx=0.5, rely=0.5, anchor="center", width=560, height=330)
glow_inner = tk.Frame(glow_outer, bg="#0B1118", highlightbackground="#3DDC84", highlightthickness=1)
glow_inner.place(relx=0.5, rely=0.5, anchor="center", relwidth=0.97, relheight=0.95)
center = tk.Frame(glow_inner, bg="#080C10")
center.place(relx=0.5, rely=0.5, anchor="center")
tk.Label(
center,
text="DOOMDADDY's VB",
font=("Consolas", 22, "bold"),
fg="#FF4477",
bg="#080C10",
).pack(anchor="center", pady=(0, 8))
tk.Label(
center,
text="Authenticate to launch RANDOM AHH GAME",
font=("Consolas", 11),
fg="#8AE234",
bg="#080C10",
).pack(anchor="center", pady=(0, 20))
tk.Label(
center,
text="LOGIN PAGE ACTIVE",
font=("Consolas", 10, "bold"),
fg="#FFD166",
bg="#080C10",
).pack(anchor="center", pady=(0, 16))
form = tk.Frame(center, bg="#080C10")
form.pack(anchor="center")
user_var = tk.StringVar()
pass_var = tk.StringVar()
status_var = tk.StringVar(value="Attempts left: 3")
attempts = {"left": 3}
tk.Label(form, text="Username:", font=("Consolas", 12), fg="#FFFFFF", bg="#080C10").grid(
row=0, column=0, sticky="w", pady=(0, 10)
)
user_entry = tk.Entry(
form,
textvariable=user_var,
width=26,
font=("Consolas", 12),
fg="#FFFFFF",
bg="#0A0F14",
insertbackground="#8AE234",
relief="solid",
highlightthickness=1,
highlightbackground="#D70A53",
highlightcolor="#D70A53",
)
user_entry.grid(row=0, column=1, sticky="w", padx=(10, 0), pady=(0, 10))
tk.Label(form, text="Password:", font=("Consolas", 12), fg="#FFFFFF", bg="#080C10").grid(
row=1, column=0, sticky="w"
)
pass_entry = tk.Entry(
form,
textvariable=pass_var,
width=26,
font=("Consolas", 12),
fg="#FFFFFF",
bg="#0A0F14",
insertbackground="#8AE234",
relief="solid",
highlightthickness=1,
highlightbackground="#D70A53",
highlightcolor="#D70A53",
show="*",
)
pass_entry.grid(row=1, column=1, sticky="w", padx=(10, 0))
tk.Label(center, textvariable=status_var, font=("Consolas", 11), fg="#FFD166", bg="#080C10").pack(
anchor="center", pady=(14, 14)
)
def do_login() -> None:
if user_var.get().strip().upper() == "DOOM" and pass_var.get().strip().upper() == "DADA":
self._show_startup_loading_screen()
return
attempts["left"] -= 1
if attempts["left"] <= 0:
messagebox.showerror("ACCESS DENIED", "Too many failed attempts.")
self.root.destroy()
return
status_var.set(f"Attempts left: {attempts['left']}")
messagebox.showwarning("ACCESS DENIED", "Wrong username or password.")
actions = tk.Frame(center, bg="#080C10")
actions.pack(anchor="center")
tk.Button(
actions,
text="LOGIN",
command=do_login,
font=("Consolas", 11, "bold"),
fg="#FFFFFF",
bg="#D70A53",
activebackground="#B70844",
relief="flat",
padx=14,
pady=7,
).pack(side="left", padx=(0, 8))
tk.Button(
actions,
text="EXIT",
command=self.root.destroy,
font=("Consolas", 11, "bold"),
fg="#FFFFFF",
bg="#374151",
activebackground="#1F2937",
relief="flat",
padx=14,
pady=7,
).pack(side="left")
pass_entry.bind("<Return>", lambda _event: do_login())
user_entry.focus_set()
self.root.title("VM Login")
def _show_startup_loading_screen(self) -> None:
self._clear_root()
frame = tk.Frame(self.root, bg="#080C10", highlightbackground="#D70A53", highlightthickness=2)
frame.pack(fill="both", expand=True, padx=18, pady=18)
self._start_startup_hacker_background(frame, "loading")
haze = tk.Frame(frame, bg="#070A0E")
haze.place(relx=0, rely=0, relwidth=1, relheight=1)
haze.lower()
shadow = tk.Frame(frame, bg="#020304")
shadow.place(relx=0.5, rely=0.5, anchor="center", width=760, height=190, x=10, y=12)
glow_outer = tk.Frame(frame, bg="#111722", highlightbackground="#2EA043", highlightthickness=1)
glow_outer.place(relx=0.5, rely=0.5, anchor="center", width=760, height=190)
glow_inner = tk.Frame(glow_outer, bg="#0B1118", highlightbackground="#3DDC84", highlightthickness=1)
glow_inner.place(relx=0.5, rely=0.5, anchor="center", relwidth=0.97, relheight=0.9)
center = tk.Frame(glow_inner, bg="#080C10")
center.place(relx=0.5, rely=0.5, anchor="center")
tk.Label(
center,
text="Launching RANDOM AHH GAME by DOOMDADA",
font=("Consolas", 13, "bold"),
fg="#8AE234",
bg="#080C10",
).pack(anchor="center", pady=(0, 12))
progress = ttk.Progressbar(center, mode="determinate", length=700, maximum=100)
progress.pack(pady=(0, 10), anchor="center")
status = tk.StringVar(value="Initializing virtual environment...")
tk.Label(center, textvariable=status, font=("Consolas", 11), fg="#FFFFFF", bg="#080C10").pack(
anchor="center"
)
phases = [
(15, "Loading challenge modules..."),
(35, "Mounting bridge storyline..."),
(60, "Activating terminal overlays..."),
(85, "Preparing score systems..."),
(100, "Boot complete."),
]
def tick() -> None:
value = int(progress["value"]) + 2
progress["value"] = min(value, 100)
for threshold, text in phases:
if progress["value"] <= threshold:
status.set(text)
break
if progress["value"] >= 100:
self._build_main_layout()
return
self.root.after(30, tick)
tick()
def _show_startup_login_gate(self) -> bool:
gate = tk.Toplevel(self.root)
gate.title("VM Login")
gate.geometry("520x300")
gate.configure(bg="#080C10")
gate.grab_set()
gate.attributes("-topmost", True)
gate.protocol("WM_DELETE_WINDOW", lambda: gate.destroy())
result = {"ok": False}
attempts = {"left": 3}
frame = tk.Frame(gate, bg="#080C10", highlightbackground="#D70A53", highlightthickness=2)
frame.pack(fill="both", expand=True, padx=12, pady=12)
tk.Label(
frame,
text="[ VIRTUAL BOX LOGIN ]",
font=("Consolas", 16, "bold"),
fg="#FF4477",
bg="#080C10",
).pack(anchor="w", padx=12, pady=(12, 8))
tk.Label(
frame,
text="Authenticate to launch RANDOM AHH GAME",
font=("Consolas", 10),
fg="#8AE234",
bg="#080C10",
).pack(anchor="w", padx=12, pady=(0, 10))
row1 = tk.Frame(frame, bg="#080C10")
row1.pack(fill="x", padx=12, pady=(0, 8))
tk.Label(row1, text="Username:", font=("Consolas", 11), fg="#FFFFFF", bg="#080C10").pack(side="left")
user_var = tk.StringVar()
user_entry = tk.Entry(
row1,
textvariable=user_var,
width=24,
font=("Consolas", 11),
fg="#FFFFFF",
bg="#0A0F14",
insertbackground="#8AE234",
relief="solid",
highlightthickness=1,
highlightbackground="#D70A53",
highlightcolor="#D70A53",
)
user_entry.pack(side="left", padx=(10, 0))
row2 = tk.Frame(frame, bg="#080C10")
row2.pack(fill="x", padx=12, pady=(0, 8))
tk.Label(row2, text="Password:", font=("Consolas", 11), fg="#FFFFFF", bg="#080C10").pack(side="left")
pass_var = tk.StringVar()
pass_entry = tk.Entry(
row2,
textvariable=pass_var,
width=24,
font=("Consolas", 11),
fg="#FFFFFF",
bg="#0A0F14",
insertbackground="#8AE234",
relief="solid",
highlightthickness=1,
highlightbackground="#D70A53",
highlightcolor="#D70A53",
show="*",
)
pass_entry.pack(side="left", padx=(10, 0))
status_var = tk.StringVar(value="Attempts left: 3")
tk.Label(frame, textvariable=status_var, font=("Consolas", 10), fg="#FFD166", bg="#080C10").pack(
anchor="w", padx=12, pady=(0, 10)
)
def try_login() -> None:
if user_var.get().strip().upper() == "DOOM" and pass_var.get().strip().upper() == "DADA":
result["ok"] = True
gate.destroy()
return
attempts["left"] -= 1
if attempts["left"] <= 0:
messagebox.showerror("ACCESS DENIED", "Too many failed attempts.")
gate.destroy()
return
status_var.set(f"Attempts left: {attempts['left']}")
messagebox.showwarning("ACCESS DENIED", "Wrong username or password.")
actions = tk.Frame(frame, bg="#080C10")
actions.pack(anchor="w", padx=12)
tk.Button(
actions,
text="LOGIN",
command=try_login,
font=("Consolas", 10, "bold"),
fg="#FFFFFF",
bg="#D70A53",
activebackground="#B70844",
relief="flat",
padx=12,
pady=6,
).pack(side="left", padx=(0, 8))
tk.Button(
actions,
text="EXIT",
command=gate.destroy,
font=("Consolas", 10, "bold"),
fg="#FFFFFF",
bg="#374151",
activebackground="#1F2937",
relief="flat",
padx=12,
pady=6,
).pack(side="left")
user_entry.focus_set()
pass_entry.bind("<Return>", lambda _event: try_login())
gate.update_idletasks()
gate.deiconify()
gate.lift()
gate.focus_force()
gate.wait_window()
return bool(result["ok"])
def _show_loading_transition(self) -> None:
loader = tk.Toplevel(self.root)
loader.title("Booting...")
loader.geometry("520x170")
loader.configure(bg="#080C10")
loader.grab_set()
loader.attributes("-topmost", True)
frame = tk.Frame(loader, bg="#080C10", highlightbackground="#D70A53", highlightthickness=2)
frame.pack(fill="both", expand=True, padx=10, pady=10)
tk.Label(
frame,
text="Launching RANDOM AHH GAME by DOOMDADA",
font=("Consolas", 11, "bold"),
fg="#8AE234",
bg="#080C10",
).pack(anchor="w", padx=12, pady=(14, 10))
progress = ttk.Progressbar(frame, mode="determinate", length=470, maximum=100)
progress.pack(padx=12, pady=(0, 8))
status = tk.StringVar(value="Initializing virtual environment...")
tk.Label(frame, textvariable=status, font=("Consolas", 10), fg="#FFFFFF", bg="#080C10").pack(
anchor="w", padx=12
)
phases = [
(15, "Loading challenge modules..."),
(35, "Mounting bridge storyline..."),
(60, "Activating terminal overlays..."),
(85, "Preparing score systems..."),
(100, "Boot complete."),
]
def tick() -> None:
value = int(progress["value"]) + 2
progress["value"] = min(value, 100)
for threshold, text in phases:
if progress["value"] <= threshold:
status.set(text)
break
if progress["value"] >= 100:
loader.destroy()
return
loader.after(35, tick)
loader.update_idletasks()
loader.deiconify()
loader.lift()
loader.focus_force()
tick()
loader.wait_window()