MSL.py 文件源码

python
阅读 42 收藏 0 点赞 0 评论 0

项目:plugin.video.netflix 作者: asciidisco 项目源码 文件源码
def __decrypt_payload_chunks(self, payloadchunks):
        decrypted_payload = ''
        for chunk in payloadchunks:
            payloadchunk = json.JSONDecoder().decode(chunk)
            payload = payloadchunk.get('payload')
            decoded_payload = base64.standard_b64decode(payload)
            encryption_envelope = json.JSONDecoder().decode(decoded_payload)
            # Decrypt the text
            cipher = AES.new(
                self.encryption_key,
                AES.MODE_CBC,
                base64.standard_b64decode(encryption_envelope['iv']))
            ciphertext = encryption_envelope.get('ciphertext')
            plaintext = cipher.decrypt(base64.standard_b64decode(ciphertext))
            # unpad the plaintext
            plaintext = json.JSONDecoder().decode(Padding.unpad(plaintext, 16))
            data = plaintext.get('data')

            # uncompress data if compressed
            if plaintext.get('compressionalgo') == 'GZIP':
                decoded_data = base64.standard_b64decode(data)
                data = zlib.decompress(decoded_data, 16 + zlib.MAX_WBITS)
            else:
                data = base64.standard_b64decode(data)
            decrypted_payload += data

        decrypted_payload = json.JSONDecoder().decode(decrypted_payload)[1]['payload']['data']
        decrypted_payload = base64.standard_b64decode(decrypted_payload)
        return json.JSONDecoder().decode(decrypted_payload)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号