Last active
November 1, 2018 18:29
-
-
Save SakiiR/ff9f44035c96d6ff3f331a0f98391023 to your computer and use it in GitHub Desktop.
Workshop Secu 3 - Crackme 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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