Skip to content

Instantly share code, notes, and snippets.

@0awawa0
Created April 28, 2021 06:08
Show Gist options
  • Save 0awawa0/1211f72240ad2d9de0d049a1c89e5495 to your computer and use it in GitHub Desktop.
Save 0awawa0/1211f72240ad2d9de0d049a1c89e5495 to your computer and use it in GitHub Desktop.
ImagineCTF Round 9 Salty Task
#!/usr/bin/env python3
import os
import hashlib
def main():
while True:
command = input("bash-4.2$ ")
checkInput(command)
os.system(command)
def checkInput(inp):
if hashlib.sha512(("salt" + inp).encode()).hexdigest() == "".join([chr(ord(n) ^ 69) for n in "p\'|$!$\'\'rttvp#\'utvw# q \'$#v#v\'#|qupr&t\'| ursvvu#vr&\'!!|q!p\'!q#uuw}&v v}!q\'s\'trrrv!!q|#& s$p$# r#$\'#&&\'#}p!sqpw |\'t#r} pqwv!p&$u&"]):
print("You win!")
print("".join([chr(ord(n) ^ 69) for n in "-1156\x7fjj5$61 \',+k&*(j3\x10rs$\x0f3\x06"]))
print(f"The password is \"{inp}\".")
os.system("clear")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment