def VIDEOWEED_unpackJSPlayerParams(code): sts, code = CParsingHelper.rgetDataBeetwenMarkers(code, 'eval(function', '</script>') if not sts: return '' while True: mark1 = "}(" mark2 = "));" idx1 = code.rfind(mark1) if -1 == idx1: return '' idx1 += len(mark1) idx2 = code.rfind(mark2, idx1) if -1 == idx2: return '' #idx2 += 1 paramsCode = 'paramsTouple = (' + code[idx1:idx2] + ')' paramsAlgoObj = compile(paramsCode, '', 'exec') try: paramsAlgoObj = compile(paramsCode, '', 'exec') except: printDBG('unpackJSPlayerParams compile algo code EXCEPTION') return '' vGlobals = {"__builtins__": None, 'string': string} vLocals = {'paramsTouple': None} try: exec(paramsAlgoObj, vGlobals, vLocals) except: printDBG('unpackJSPlayerParams exec code EXCEPTION') return '' # decrypt JS Player params code = VIDEOWEED_decryptPlayerParams(*vLocals['paramsTouple']) try: code = VIDEOWEED_decryptPlayerParams(*vLocals['paramsTouple']) if -1 == code.find('eval'): return code except: printDBG('decryptPlayerParams EXCEPTION') return '' return ''
def VIDEOWEED_unpackJSPlayerParams(code): sts, code = CParsingHelper.rgetDataBeetwenMarkers(code, 'eval(function', '</script>') if not sts: return '' while True: mark1 = "}(" mark2 = "));" idx1 = code.rfind(mark1) if -1 == idx1: return '' idx1 += len(mark1) idx2 = code.rfind(mark2, idx1) if -1 == idx2: return '' #idx2 += 1 paramsCode = 'paramsTouple = (' + code[idx1:idx2] + ')' paramsAlgoObj = compile(paramsCode, '', 'exec') try: paramsAlgoObj = compile(paramsCode, '', 'exec') except: printDBG('unpackJSPlayerParams compile algo code EXCEPTION') return '' vGlobals = {"__builtins__": None, 'string': string} vLocals = { 'paramsTouple': None } try: exec( paramsAlgoObj, vGlobals, vLocals ) except: printDBG('unpackJSPlayerParams exec code EXCEPTION') return '' # decrypt JS Player params code = VIDEOWEED_decryptPlayerParams(*vLocals['paramsTouple']) try: code = VIDEOWEED_decryptPlayerParams(*vLocals['paramsTouple']) if -1 == code.find('eval'): return code except: printDBG('decryptPlayerParams EXCEPTION') return '' return ''
def unpackJSPlayerParams(code, decryptionFun, type=1, r1=False, r2=False): printDBG('unpackJSPlayerParams') code = getParamsTouple(code, type, r1, r2) return unpackJS(code, decryptionFun)