Created
November 27, 2018 14:33
-
-
Save andreafortuna/4d32100ae03abead52e8f3f61ab70385 to your computer and use it in GitHub Desktop.
Group Policy Preference Password Decoder
This file contains hidden or 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
#!/usr/bin/env python3 | |
import base64 | |
from Crypto.Cipher import AES | |
def decrypt(encrypt_str): | |
padding = "=" * (4 - len(encrypt_str) % 4) | |
encrypt_str = encrypt_str + padding | |
encrypt_str = base64.b64decode(encrypt_str) | |
# Public available AES key on https://msdn.microsoft.com/en-us/library/2c15cbf0-f086-4c74-8b70-1f2fa45dd4be.aspx?f=255&MSPPError=-2147217396 | |
key = b"\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\x0f\xfe\xe8\xf4\x96\xe8\x06\xcc\x05\x79\x90\x20\x9b\x09\xa4\x33\xb6\x6c\x1b" | |
iv = "\x00" * 16 | |
aes_str = AES.new(key, AES.MODE_CBC, iv).decrypt(encrypt_str) | |
return aes_str.decode() | |
if __name__ == "__main__": | |
import sys | |
if len(sys.argv) != 2: | |
print('python {} <gpp_encrypt_password>'.format(sys.argv[0])) | |
else: | |
print(decrypt(sys.argv[1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment