<s> import base64 <EOL> import hashlib <EOL> from Crypto import Random <EOL> from Crypto . Cipher import AES , AES_CBC <EOL> class AESCipher ( object ) : <EOL> def __init__ ( self , key ) : <EOL> self . bs = <NUM_LIT:32> <EOL> self . key = hashlib . sha256 ( key . encode ( ) ) . digest ( ) <EOL> def encrypt ( self , raw ) : <EOL> raw = self . _pad ( raw ) <EOL> iv = Random . new ( ) . read ( AES . block_size ) <EOL> cipher = AES . new ( self . key , AES . MODE_CBC , iv ) <EOL> return base64 . b64encode ( iv + cipher . encrypt ( raw ) ) <EOL> def decrypt ( self , enc ) : <EOL> enc = base64 . b64decode ( enc ) <EOL> iv = enc [ : AES . block_size ] <EOL> cipher = AES . new ( self . key , AES . MODE_CBC , iv ) <EOL> return self . _unpad ( cipher . decrypt ( enc [ AES . block_size : ] ) ) . decode ( '<STR_LIT:utf-8>' ) <EOL> def _pad ( self , s ) : <EOL> return s + ( self . bs - len ( s ) % self . bs ) * chr ( self . bs - len ( s ) % self . bs ) <EOL> @ staticmethod <EOL> def _unpad ( s ) : <EOL> return s [ : - ord ( s [ len ( s ) - <NUM_LIT:1> : ] ) ] <EOL> from hashlib import md5 <EOL> import binascii <EOL> def CryptoJS_AES_decrypt ( encrypted , password , key_length = <NUM_LIT:32> ) : <EOL> def derive_key_and_iv ( password , salt , key_length , iv_length ) : <EOL> d = d_i = '<STR_LIT>' <EOL> while len ( d ) < key_length + iv_length : <EOL> d_i = md5 ( d_i + password + salt ) . digest ( ) <EOL> d += d_i <EOL> return d [ : key_length ] , d [ key_length : key_length + iv_length ] <EOL> bs = <NUM_LIT:16> <EOL> salt = encrypted [ len ( '<STR_LIT>' ) : bs ] <EOL> key , iv = derive_key_and_iv ( password , salt , key_length , bs ) <EOL> cipher = AES_CBC ( key = key , keySize = <NUM_LIT:32> ) <EOL> return cipher . decrypt ( encrypted [ bs : ] , iv ) <EOL> ct = "<STR_LIT>" <EOL> iv = "<STR_LIT>" <EOL> s = "<STR_LIT>" <EOL> password = "<STR_LIT>" <EOL> streamUrl = byteify ( json . loads ( window [ '<STR_LIT>' ] ) ) <EOL> ciphertext = base64 . b64decode ( streamUrl [ '<STR_LIT>' ] ) <EOL> iv = a2b_hex ( streamUrl [ '<STR_LIT>' ] ) <EOL> salt = a2b_hex ( streamUrl [ '<STR_LIT:s>' ] ) <EOL> url = self . cryptoJS_AES_decrypt ( ciphertext , '<STR_LIT>' , salt ) <EOL> baseUrl = byteify ( json . loads ( url ) ) <EOL> url = baseUrl + "<STR_LIT>" + window [ '<STR_LIT>' ] + "<STR_LIT>" + window [ '<STR_LIT>' ] </s>
