You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def _filterargs(source):
"""Juice from a source file the four args needed by decoder."""
juicers = [ (r"}('(.*)', *(\d+|[]), *(\d+), '(.)'.split('|'), (\d+), (.)))"),
(r"}('(.)', *(\d+|[]), *(\d+), '(.)'.split('|')"),
]
for juicer in juicers:
args = re.search(juicer, source, re.DOTALL)
if args:
a = args.groups()
if a[1] == "[]" :
a = list(a)
a[1] = 62
a = tuple(a)
try:
return a[0], a[3].split('|'), int(a[1]), int(a[2])
except ValueError:
raise UnpackingError('Corrupted p.a.c.k.e.r. data.')
Also added a test sequence to test-packer to test this case:
str = "eval(function(p,a,c,k,e,r){e=function(c){return c.toString(36)};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[0-9ab]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\b'+e(c)+'\b','g'),k[c]);return p}('$(5).a(6(){ $('.8').0(1); $('.b').0(4); $('.9').0(2); $('.7').0(3)})',[],12,'html|52136|555|65103|8088|document|function|r542c|r8ce6|rb0de|ready|rfab0'.split('|'),0,{}))"
expected = "$(document).ready(function() {\n $('.r8ce6').html(52136);\n $('.rfab0').html(8088);\n $('.rb0de').html(555);\n $('.r542c').html(65103)\n})"
res = test_str(str, expected)
Please update packer.py and test-packer.py like above listed. Thank you.
Description
python unpacker can not handle if radix given as [] and not as a number
jsbeautifier.org handles this well.
Input
eval(function(p,a,c,k,e,r){e=function(c){return c.toString(36)};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[0-9ab]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\b'+e(c)+'\b','g'),k[c]);return p}('$(5).a(6(){$('.8').0(1); $ ('.b').0(4); $('.9').0(2); $ ('.7').0(3)})',[],12,'html|52136|555|65103|8088|document|function|r542c|r8ce6|rb0de|ready|rfab0'.split('|'),0,{}))
Expected Output
$(document).ready(function() {
$('.r8ce6').html(52136); $ ('.rfab0').html(8088); $('.rb0de').html(555); $ ('.r542c').html(65103)})
Actual Output
Beautified version of the input code, packing remains unacknowledged.
Steps to Reproduce
Environment
Linux mint 18
Settings
Example:
The text was updated successfully, but these errors were encountered: