-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlevel5.py
More file actions
58 lines (53 loc) ยท 2.12 KB
/
level5.py
File metadata and controls
58 lines (53 loc) ยท 2.12 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
import os
import time
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
def next_step_menu():
print("\n๐ฎ What would you like to do next?")
print("1. Continue to next level")
print("2. Restart this level")
print("3. Exit game")
choice = input("> ").strip()
return choice
def level5(save):
clear()
print("๐งช Level 5: Suspicious Scheduled Task\n")
print("Malware created a scheduled task that runs silently every 10 minutes.\n")
print("--- Scheduled Task Command ---")
print("powershell.exe -WindowStyle Hidden -File C:\\Users\\Public\\hidden.ps1")
print("--- End Command ---\n")
print("๐ Contents of hidden.ps1:\n")
print("iex ([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String(")
print("\"ZmxhZ3tzYW1wbGVfc2NyaXB0X3BhdGh9\")))")
print("\n๐ ๏ธ Your task:")
print("The PowerShell script is base64-encoded and hides a message. Decode it to find the hidden flag.")
print("\n๐ฏ Submit the flag using:")
print("submit FLAG{SAMPLE_SCRIPT_PATH}")
print("\n๐ก Hint: You only need to decode the base64 string to reveal the flag message.\n")
while True:
cmd = input("> ").strip().lower()
if cmd == "submit flag{sample_script_path}":
print("\nโ
Correct! Flag accepted.")
save["level"] = 6
save["flags"].append("FLAG{SAMPLE_SCRIPT_PATH}")
time.sleep(1.5)
clear()
print("๐ Level 5 Complete!\n")
while True:
choice = next_step_menu()
if choice == "1":
return save
elif choice == "2":
return level5(save)
elif choice == "3":
print("๐ Exiting game...")
exit()
else:
print("โ Invalid choice. Please select 1, 2, or 3.")
elif cmd == "restart":
return level5(save)
elif cmd == "exit":
print("๐ Exiting game...")
exit()
else:
print("โ Incorrect flag. Try again or type 'exit' or 'restart'.")