-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlevel2.py
More file actions
61 lines (54 loc) · 2.02 KB
/
level2.py
File metadata and controls
61 lines (54 loc) · 2.02 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
import os
import time
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
def next_step_menu():
print("\n🎉 Level 2 Complete!")
print("What would you like to do next?")
print("1. Continue to next level")
print("2. Restart this level")
print("3. Exit game")
while True:
choice = input("Enter 1, 2, or 3: ").strip()
if choice == "1":
return "next"
elif choice == "2":
return "restart"
elif choice == "3":
print("Exiting game...")
exit()
else:
print("❌ Invalid choice.")
def level2(save):
while True:
clear()
print("🧪 Level 2: XOR Encrypted Message\n")
print("We intercepted an encoded message believed to be from the malware’s C2 server.\n")
print("XORed Hex String:")
print("73-54-6f-35-75-34-66-23-62-39-73-27-7c-2a")
print("XOR Key: 0f\n")
print("🛠️ Your task:")
print("This message was XOR-encrypted using the given key. Use any XOR decoder (online or script) to decrypt it.")
print("\n🎯 Once you recover the original message, submit the flag using:")
print("submit FLAG{YOUR_ANSWER_HERE}")
cmd = input("> ").strip()
if cmd.lower() == "exit":
print("Exiting game...")
exit()
elif cmd.startswith("submit "):
_, flag = cmd.split(" ", 1)
if flag.strip().upper() == "FLAG{C2_SERVER_CALL}":
print("\n✅ Correct! Flag accepted.")
save["level"] = 3
save["flags"].append("FLAG{C2_SERVER_CALL}")
time.sleep(1.5)
clear()
action = next_step_menu()
if action == "next":
return save
elif action == "restart":
continue
else:
print("❌ Incorrect. Try again or type 'exit'.")
else:
print("❌ Unknown command. Use 'submit <FLAG>' or type 'exit'.")