Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. from Crypto import Random
  2. from Crypto.Cipher import AES
  3.  
  4. plaintext = bytes.fromhex("255044462d312e350a25d0d4c5d80a34")
  5. IV = bytes.fromhex("09080706050403020100A2B2C2D2E2F2")
  6. lab_ciphertext = bytes.fromhex("d06bf9d0dab8e8ef880660d2af65aa82")
  7. keyFile = open("possibleKeys.txt", "r")
  8.  
  9. #iterate through the possibleKeys.txt file line by line
  10. for line in keyFile.readlines():
  11. #strip \n from string and store in key
  12. key = line.rstrip()
  13. key = bytes.fromhex(key)
  14. cipher_dc = AES.new(key, AES.MODE_CBC, IV)
  15. decrypted = cipher_dc.decrypt(lab_ciphertext)
  16. ## check if we've found the correct key
  17. if (decrypted == plaintext):
  18. print("KEY FOUND!!")
  19. print (key)
  20. print(str(decrypted))
  21.  
  22. keyFile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement