# https://techtutorialsx.com/2018/04/09/python-pycrypto-using-aes-128-in-ecb-mode/ from Crypto.Cipher import AES import fileinput import json key = bytes([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]) decipher = AES.new(key, AES.MODE_ECB) for line in fileinput.input(): try: data = json.loads(line) print('Payload') print(data.get('payload')) data_bytes = bytes(data.get('payload')) print('Decoded') print(decipher.decrypt(data_bytes).partition(b'\x00')[0].decode('utf-8')) except Exception as e: print(e) print('Err : ',json.loads(line))