jacob614

BRIEFCAES

Jun 10th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. # This script requires python 3.5 but could be easily changed for older python versions
  2. # If you are on windows then download openssl from here: https://wiki.openssl.org/index.php/Binaries
  3.  
  4. import subprocess
  5. import sys
  6. import os
  7.  
  8. def Rot13(a):
  9.     o = ord(a)
  10.     return chr(o+13 if o < 78 else o-13)
  11.  
  12. successes = 0
  13. path = " ".join(sys.argv[1:])
  14.  
  15.  
  16. pathrot13 = "".join([Rot13(a) for a in path])
  17. checks = [path, pathrot13, path[::-1], pathrot13[::-1], path.lower(), pathrot13.lower(), path[::-1].lower(), pathrot13[::-1].lower()]
  18. aeses = ["aes-256-cbc","aes-128-cbc","aes-192-cbc","aes-256-ecb","aes-128-ecb","aes-192-ecb"]
  19. for check in checks:
  20.     for aes in aeses:
  21.         if subprocess.run(["openssl", aes, "-d", "-in", "BRIEFCAES", "-out", "BRIEFCAES-out", "-k", check], stderr=subprocess.PIPE).returncode == 0:
  22.             print(check)
  23.             print("WIN!")
  24.             os.rename("BRIEFCAES-out", "solutions/BRIEFCAES-"+str(successes))
  25.             successes = successes + 1
Advertisement
Add Comment
Please, Sign In to add comment