Skip to content

Instantly share code, notes, and snippets.

@SakiiR
Last active November 1, 2018 18:29
Show Gist options
  • Save SakiiR/ff9f44035c96d6ff3f331a0f98391023 to your computer and use it in GitHub Desktop.
Save SakiiR/ff9f44035c96d6ff3f331a0f98391023 to your computer and use it in GitHub Desktop.
Workshop Secu 3 - Crackme 3
#!/usr/bin/env python
import base64
import sys
# The real flag is beguinning with 'FLAG{'
FLAG = "DX8YDEgOJGQGElwMFH5tLwAGAmd4ahJ4H1Y1J2wcOUQ4BWwfKkAtFHU2GWwYFHE2Pl0tEk4="
KEY = "[REVOKED]" # You have to find the real one (I removed the real one)
def xor(text, key):
out = ""
for i, c in enumerate(text):
out += chr(ord(c) ^ ord(key[i % len(key)]))
return out
def main(password):
if xor(base64.b64decode(FLAG), KEY) == password:
print("[+] Wow, good job, the flag is '{}'".format(password))
else:
print("[-] Sorry dude, you phailed it")
if __name__ == "__main__":
if len(sys.argv) < 2:
print("[+] USAGE: {} password".format(sys.argv[0]))
sys.exit(1)
sys.exit(main(sys.argv[1]))
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment