Created
July 7, 2024 18:01
-
-
Save DavidBuchanan314/d3b9fea6b48688f7ea23503c42c6cbdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes | |
KEY = bytes.fromhex("5c0e349a27dc46034c7b6744a378bd17") | |
IV = bytes.fromhex("a0b0924686447109f2d51dcddc93458a") | |
img = open("gz_a.bin", "rb") | |
img.seek(4) | |
length = int.from_bytes(img.read(4), "little") | |
img.seek(0x34) | |
offset = int.from_bytes(img.read(4), "little") | |
img.seek(offset) | |
ciphertext = img.read(length) | |
cipher = Cipher(algorithms.AES(KEY), modes.CTR(IV)) | |
decryptor = cipher.decryptor() | |
plaintext = decryptor.update(ciphertext) + decryptor.finalize() | |
with open("gz_decrypted.bin", "wb") as outfile: | |
outfile.write(plaintext) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment