Created
June 24, 2020 12:38
-
-
Save srozb/ae51049f6e69ba149b0c24ab3db535c7 to your computer and use it in GitHub Desktop.
script to decrypt GREE/Innova HVAC UDP communication
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
#!/usr/bin/env python3 | |
import base64 | |
import json | |
import sys | |
from Crypto.Cipher import AES | |
key = b"a3K8Bx%2r8Y7#xDh" # default key (for scanning) - replace if needed. | |
cipher = AES.new(key, AES.MODE_ECB) | |
def decrypt(ciphertext): | |
return cipher.decrypt(base64.b64decode(ciphertext)) | |
def parse(plaintext): | |
plaintext = plaintext[:plaintext.rfind(b'}')+1].decode('utf-8') | |
return json.loads(plaintext) | |
if __name__ == "__main__": | |
print(parse(decrypt(sys.argv[1]))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment