🐍 Python IDE
← Back to Challenges
Editor
Output
Theme:
Monokai
Dracula
Material
Nord
Solarized Dark
Solarized Light
▶ Run
main.py
import base64 import random import string """There seems to be some bugs in this code, can you spot them and fix them?""" """Hint: try running the code to find the bugs""" def obfuscate_string(s): """Hides string for maximum security""" temp = [] halflength = int(len(s) / 2) for i in range(halflength): temp.append(s[i]) temp.append(s[len(s) - i - 1]) return "".join(temp) def deobfuscate_string(s): """read string in proppen order, see ticket: 15823""" temp = [] scnd_half = [] for i in range(len(s)): if i % 2 == 0: temp.append(s[index]) else: scnd_half.append(s[i]) scnd_half = rev = [scnd_half[i] for i in range(len(scnd_half) - 1, -1, -1)] #TODO: make this pretty before release return "".join(temp + scnd_half) def decode_flag(encoded): deobfuscated = deobfuscate_string(encoded) decoded_bytes = base64.b64decode(deobfuscated) decoded = decoded_bytes.decode("utf-8") return decoded def random_unnessesary_loop(length): return "".join(random.choices(string.ascii_letters, k=length)) def main(): flag = "RkxBR0dBe3NpbXBsZV9jb2RlX3NpbXBsZV90cm91Ymxlc2hvb3Rpbmd9" obfuscated_flag = obfuscate_string(flag) print("Debug this code to find the flag!") for _ in range(5): # added with ticket: 11428. somehow breaks the coffe machine and clock in the office if removed # TODO: find a way to remove without breaking coffe machine # Remember to add ticket: 11595 in next PI print(random_unnessesary_loop(10)) flag = decode_flag(obfuscated_flag) print("Your flag is:", flag)) main()
Output
Run your code to see the output here...