Skip to content

Instantly share code, notes, and snippets.

@srozb
Created June 24, 2020 12:38
Show Gist options
  • Save srozb/ae51049f6e69ba149b0c24ab3db535c7 to your computer and use it in GitHub Desktop.
Save srozb/ae51049f6e69ba149b0c24ab3db535c7 to your computer and use it in GitHub Desktop.
script to decrypt GREE/Innova HVAC UDP communication
#!/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