AES解码TS文件

KEY文件有时是可读的16位字符串,有时是16进制字节

首先需要安装
pip install pycryptodome
执行如下方法,直接调用
def ts_dec():
    ts_file = open("input.ts", "rb")
    data = ts_file.read()
    ts_file.close()

    key_filename = "E:/2/abc.key"
    key_fp = open(key_filename,"rb")
    key = key_fp.read()

    #key = b'\xEF\x46\xC9\xB4\x80\x62\x41\x2E\x72\xF7\xA0\x8E\x15\x2D\x90\x58'
    iv = b'\x00'*16
    
    decrypt_data = decrypt(data, key, iv)
    ts_out = "out.ts"
    out_file = open(ts_out, "wb")
    out_file.write(decrypt_data)
    out_file.close()

 

你可能感兴趣的:(python)