Skip to content

Instantly share code, notes, and snippets.

@albertzsigovits
Created November 22, 2022 08:35
Show Gist options
  • Save albertzsigovits/f726ae973ca4b2b5e4e4d7828d3e93da to your computer and use it in GitHub Desktop.
Save albertzsigovits/f726ae973ca4b2b5e4e4d7828d3e93da to your computer and use it in GitHub Desktop.
MalRE decrypt script - Exercise
# Mal-RE Decrypt script by @larsborn
####################################
import binascii
import struct
buffer = binascii.unhexlify(b'')
def DecryptBlock(param_1: int, param_2: int) -> :
return (((param_1 ^ param_2) << 4 | (param_1 ^ param_2) >> 0x1
out = b''
for i in range(0, len(buffer), 4):
block = struct.unpack('<I', buffer[i:i + 4])[0]
decrypted_block = decrypt_block(block, 0x10a1)
out += struct.pack('<I', decrypted_block)
print(hashlib.sha256(out).hexdigest())
with open('dump.bin', 'wb') as fp:
fp.write(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment