本文整理汇总了Python中core.decoder.Decoder.rExtractWithRegex方法的典型用法代码示例。如果您正苦于以下问题:Python Decoder.rExtractWithRegex方法的具体用法?Python Decoder.rExtractWithRegex怎么用?Python Decoder.rExtractWithRegex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.decoder.Decoder
的用法示例。
在下文中一共展示了Decoder.rExtractWithRegex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: decodeContent
# 需要导入模块: from core.decoder import Decoder [as 别名]
# 或者: from core.decoder.Decoder import rExtractWithRegex [as 别名]
def decodeContent(html): #This method is used to fix a "probably" encoding/decoding problem from provider
#new encoded iframe method
logger.debug("trying new method for encrypted javascript code...")
html2 = Decoder.extractWithRegex("eval(unescape('","'));",html)
html3 = Decoder.rExtractWithRegex("eval(unescape('","'));",html)
html3 = html3.replace("eval(","").replace("unescape(","").replace(" + ","").replace(")","").replace("'","").replace(";","")
logger.debug("extracted code is: "+html3)
decodedHtml = urllib.unquote(html2[:html2.find(";")+1]).decode('utf8')
logger.debug("decypter function in javascript is: "+decodedHtml)
encryptedCall = urllib.unquote(html3).decode('utf8')
#encryptedCall = html3
logger.debug("final html is: "+encryptedCall)
#now extract encrypted string
encryptedCall = Decoder.extract("('","'));",encryptedCall)
splitter = Decoder.extract('s.split("','");',decodedHtml)
logger.debug("splitter: "+splitter)
subfixer = Decoder.extract('tmp[1] + "','");',decodedHtml)
logger.debug("subfixer: "+subfixer)
s = encryptedCall.split(splitter)[0]
k = encryptedCall.split(splitter)[1]+subfixer
xorDiff = int(Decoder.extract("charCodeAt(i))+",");",decodedHtml))
#logger.debug(xorDiff)
r = ""
i = 0
logger.debug("starting loop decoder, s: "+s+", k: "+k)
'''
r += String.fromCharCode((parseInt(k.charAt(i%k.length))^s.charCodeAt(i))+-2);
'''
CORRECTION = 16 #I don't know why but this convert it to legible character (most cases)
mode = 0
while i<len(s): #GO TO HELL, REALLY, I HAVE NO IDEA HOW THERE IS PEOPLE IN THE WORLD DOING THIS THING, DO YOU KNOW AN STANDARD ENCODING? YOU DOOOON'T!!!!
seed = k[(i%len(k))]
#logger.debug("seed: "+seed)
primitive = ord(seed)^ord(s[i])
#logger.debug("xorted: "+str(primitive))
if len(r)==0 and str(primitive)!= '<':
#tryes to check what fix is neccesary
if str(primitive)=='15':
mode = 1
elif str(primitive)=='14':
mode = 2
elif str(primitive)=='4':
mode = 3
elif str(primitive)=='7':
mode = 4
elif str(primitive)=='9':
mode = 5
else:
logger.debug("detected new start value: "+str(primitive)+", probably needs new encoding method")
#mode 1 and mode 2
if (str(primitive) == '1' and mode==1) or (mode==2 and str(primitive)=='0'):
r += "."
elif (str(primitive) == '2' and mode==1) or (mode==2 and (str(primitive)=='1' or str(primitive)=='113')):
r += "/"
elif (str(primitive) == '15' and mode==1) or (mode==2 and str(primitive)=='14') or (mode==3 and str(primitive)=='4') or (mode==4 and str(primitive)=='7') or (mode==5 and str(primitive)=='9'):
r += "<"
elif (str(primitive) == '112' and mode==1) or (mode==2 and str(primitive)=='15') or (str(primitive) == '5' and mode==3) or (str(primitive) == '8' and mode==4) or (mode==5 and str(primitive)=='10'):
r += "="
elif (str(primitive) == '113' and mode==1) or (mode==2 and str(primitive)=='112') or (str(primitive) == '6' and mode==3) or (str(primitive) == '9' and mode==4) or (mode==5 and str(primitive)=='11'):
r += ">"
elif (str(primitive) == '13' and mode==1) or (mode==2 and str(primitive)=='12') or (str(primitive) == '2' and mode==3) or (str(primitive) == '5' and mode==4) or (mode==5 and str(primitive)=='7'):
r += ":"
elif (int(str(primitive))-3<10 and mode==1):
r += str(int(str(primitive))-3)
elif (int(str(primitive))-2<10 and mode==2):
r += str(int(str(primitive))-2)
#mode 3
elif (str(primitive) == '1' and mode==3) or (str(primitive) == '4' and mode==4):
r += "9"
elif (str(primitive) == '1' and mode==4) or (str(primitive) == '3' and mode==5):
r += "6"
elif (str(primitive) == '110' and mode==3):
r += "f"
elif (str(primitive) == '105' and mode==3) or (str(primitive) == '108' and mode==4) or (mode==5 and str(primitive)=='110'):
r += "a"
elif (str(primitive) == '109' and mode==3):
r += "e"
elif (str(primitive) == '40' and mode==3) or (str(primitive) == '43' and mode==4) or (mode==5 and str(primitive)=='45'):
r += " "
elif (str(primitive) == '108' and mode==3):
r += "d"
elif (str(primitive) == '42' and mode==3) or (str(primitive) == '45' and mode==4) or (mode==5 and str(primitive)=='47'):
r += '"'
elif (str(primitive) == '111' and mode==3):
r += 'g'
elif (str(primitive) == '81' and mode==3):
r += 'i'
elif (str(primitive) == '107' and mode==3) or (str(primitive) == '110' and mode==4):
r += 'c'
elif ((str(primitive) == '10' or str(primitive) == '106') and mode==3) or (str(primitive) == '109' and mode==4) or (mode==5 and str(primitive)=='111'):
r += 'b'
#mode 4
elif mode==4 and str(primitive)=='105':
r += 'a'
elif (str(primitive) == '111' and mode==4):
r += 'd'
#mode 5
elif (mode==5 and str(primitive)=='1'):
r += '4'
elif (mode==5 and str(primitive)=='5'):
#.........这里部分代码省略.........