Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Crypto import Random
- from Crypto.Cipher import AES
- plaintext = bytes.fromhex("255044462d312e350a25d0d4c5d80a34")
- IV = bytes.fromhex("09080706050403020100A2B2C2D2E2F2")
- lab_ciphertext = bytes.fromhex("d06bf9d0dab8e8ef880660d2af65aa82")
- keyFile = open("possibleKeys.txt", "r")
- #iterate through the possibleKeys.txt file line by line
- for line in keyFile.readlines():
- #strip \n from string and store in key
- key = line.rstrip()
- key = bytes.fromhex(key)
- cipher_dc = AES.new(key, AES.MODE_CBC, IV)
- decrypted = cipher_dc.decrypt(lab_ciphertext)
- ## check if we've found the correct key
- if (decrypted == plaintext):
- print("KEY FOUND!!")
- print (key)
- print(str(decrypted))
- keyFile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement