Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hashlib
- import os
- # see https://cryptography.io
- from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
- from cryptography.hazmat.backends import default_backend
- passwords = '''1d6f01294dd449889d58cec0d7778476
- ceca75998b6f412d89107a547edd89eb
- 65ffce5b584a46628c7237ebb4249a79
- 10a9873f50344226a9defbad15c91d21
- 184cec1173d04418bc588099d94d9eda
- 16589fa9e7444f238e980e2eabbe1a91
- 7de85e2732584b559ce34531748547c2
- 5f09b9dc9f1347d1912a279dd30c62c2
- 513368585cc64d9fba12d78645411c5a
- 57d0f15fb0d447d395321cd2debcde0b
- 22ef5bb093a14152a0bdd2f9bdea1fb7
- 7b3592b8a4aa4caea4d94b898a81efe1
- bc1b4c144cb74bc0981e1e88a73381e7
- f66dfeab81a247268f66650fbe132ec8
- 704ff0cdee73439b80a8d0af1ed4c5ab
- 7b7d6dd186384bb0b8e4bb5736148dbd
- ad9dc6e9c1b3495aa8a95fc58db35776
- a77ce16930c84884810812b7bcd69fbd
- ffcb22fb9aea4718b1df016a333c281c
- f4fd104640df46968d6345372aea3c93
- ded3d46500c340c196cafaec10c33729
- 9fce3b0400574265afad3d6ec3b0698a
- f487949839224aa3a1cc728caaade0dd
- a9d97a170b4848fab44f97af053eb166
- 8d9a6e11cfc942c7951e462166ec670a
- 577fc2feda5a422aa1eac2886de479da
- 0df5b458ca334d4287fd9fe767c36b78
- e40d1437c98243c8bb515b0bd32fca6d
- 05db16c557db413cb2cac96e65989eee
- 187d73349e344ab880939ded883c3304
- 19c5bbb6a702426c8ff75ac5342c9e3b
- 8379b9001598425f9d7638614f2626b3
- 574cabad49814673897306e080b32003
- 2361f05c70084aae87009f0713921885
- d183887a0bfc49f0ae0dd39e2ec52ffc
- cfc62137f7f74d8d8bfca117c7fefeec
- 7f12ef3af006467eb73434ad85e103e9
- 242683f132f04f0ba21909cc1d790d62
- 0c47259dd6e344dbbb3294f240a60080
- b141bb75f86748889a571c90b5bd9348
- 21fb8799faef48c9bc75499fd0c9efd7
- f0dd3e6d874d4745a978d191d9590dd6
- 2f3d6f53d51d4540b3634f7228db890d
- ef7a20115ff64ce8b359b6dfb32b6b15
- d17ae816bd464141adf67daa9dcdb832
- 22c44563b04d478bb444c665dff073f5
- 70c83a88658549d2bef40cbcf5ca4986
- d77c5e729d1549a88f1923ce82e7ae62
- e19c938582b145e5906f6fea89b0d44e
- 07df85cc6fd94a7fb483598287fd5190
- 9cd0b9a6f99e46e08878cfde7ea118ad
- d7da820a2bba48abbbd261ba5fcce79f
- 1f098b5bd0c74e0e914633db9cad262d
- 1c9370d10e8f4bc89d5a8b61c0064289
- ce3d546ad7d448d2bfb47f8cc59b9570
- 2b329abfe39a413da295b6294d6d0eb8
- 7f5e4da6457443eda464eef749a2bb5a
- 14f3ccaf0cdc4456a14c5c927e0a1680
- 3fe72a73ce664a03822facc739424941
- fc19798f336444068398125fe6125229
- 52d849fe8fca4ef8813420a26587f02c'''
- passwords = passwords.splitlines()
- backend = default_backend()
- # Based on https://stackoverflow.com/questions/38168323/c-sharp-encrypt-data-aes
- #
- # INSTRUCTIONS:
- # Install the cryptograpy library by running
- # pip install cryptography
- # Folder layout:
- # [this script]
- # [asc] - all the encypted .aes files from the archive go in here
- # [asc-out] - decrypted files will be placed in here
- def idiots_aes_decrypt(encrypted_bytes, key, iv):
- cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=backend) # create the ass-wiper object before you can actually wipe your ass
- decryptor = cipher.decryptor()
- return decryptor.update(encrypted_bytes) + decryptor.finalize()
- def pajeets_key_iv_derive(password, iterations=1000, salt=bytes([1,2,3,4,5,6,7,8]), password_decode_method=str.encode):
- password = password_decode_method(password)
- password = hashlib.sha256(password).digest()
- password = hashlib.pbkdf2_hmac("sha1", password, salt, iterations, 48)
- # The GetBytes in the example consumes the bytes across calls: https://msdn.microsoft.com/en-us/library/system.security.cryptography.rfc2898derivebytes.getbytes(v=vs.110).aspx
- key = password[0:32]
- iv = password[32:48]
- return (key, iv)
- directory_in = "asc"
- directory_out = "asc-out"
- for filename in os.listdir(directory_in):
- password = passwords[int(os.path.splitext(filename)[0]) - 1]
- key, iv = pajeets_key_iv_derive(password)
- with open(os.path.join(directory_in, filename), 'rb') as encrypted_file:
- encrypted_bytes = encrypted_file.read()
- decrypted_bytes = idiots_aes_decrypt(encrypted_bytes, key, iv)
- output_filename = os.path.splitext(filename)[0] + ".png"
- with open(os.path.join(directory_out, output_filename), 'wb') as decrypted_file:
- decrypted_file.write(decrypted_bytes)
- print("Decrypted " + filename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement