I have this javascript code that I want to unzip and decorate, it looks something like this:
eval(function(p,a,c,k,e,r){e=String;if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'^$'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('document.body.innerHTML="<iframe width=\'100%\' scrolling=\'no\' height=\'2500\' frameborder=\'0\' src=\'http://www.exmaple.com\'>";',[],1,''.split('|'),0,{}))
When I put this in jsbeautifier.org, I get:
document.body.innerHTML = "<iframe width='100%' scrolling='no' height='2500' frameborder='0' src='http://www.example.com'>";
But when I try to use the python library (using jsbeautifier.beautify), it does not seem to decompress properly:
print al(function (p, a, c, k, e, r) { e = String; if ('0'.replace(0, e) == 0) { while (c--) r[e(c)] = k[c]; k = [ function (e) { return r[e] || e } ]; e = function () { return '^$' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p }('document.body.innerHTML="<iframe width=\'100%\' scrolling=\'no\' height=\'2500\' frameborder=\'0\' src=\'http://www.example.com\'>";', [], 1, ''.split('|'), 0, {}));
What am I doing wrong?
EDIT: Python code:
import jsbeautifier #script needs to have '\n' at the beginning otherwise jsbeautifier throws an error script = """\neval(function(p,a,c,k,e,r){e=String;if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'^$'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('document.body.innerHTML="<iframe width=\'100%\' scrolling=\'no\' height=\'2500\' frameborder=\'0\' src=\'http://www.example.com\'>";',[],1,''.split('|'),0,{}))""" jsbeautifier.beautify(script)