Skip to content

Instantly share code, notes, and snippets.

@neuschaefer
Last active November 4, 2020 22:09
Show Gist options
  • Save neuschaefer/a12044e51af8a2f9a0767b50703ebe4a to your computer and use it in GitHub Desktop.
Save neuschaefer/a12044e51af8a2f9a0767b50703ebe4a to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# MStar firmware decryption tool
from Crypto.Cipher import AES
import sys
key = 4 * b'\x12\x34\x56\x78'
aes = AES.new(bytes(key), AES.MODE_ECB)
for filename in sys.argv[1:]:
with open(filename, 'rb') as f:
data = f.read()
dec = aes.decrypt(data[:(len(data)-16)&~0xf])
with open(filename + '.out', 'wb') as f:
f.write(dec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment