News for hackers. Stuff that matters.
Re:New Statistical De-minifier and De-obfuscator for JavaScript by pajtai on Monday June 02, 2014 @05:56PM (#7836732)
I took the code presented and put it into packer - http://dean.edwards.name/packer/ , and the "nice" output was not very helpful in that it still looked obfuscated. Maybe I'm misunderstanding something.

So the input to js nice was the packed generateSeries function:

eval(function(p,a,c,k,e,r){e=function(c) {return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35? String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/, String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c-- )if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4 3(e){2 t=[];2 n=f+e;2 r=6+e;k(i=1;i<=6;i++){2 s=5.y(5.a()*(r- n+1)+n);t.b([i,s]);n++;r++}c t}$(d).B(4(){2 e=3(0);2 t=3(g);$.h($("#j"),[{7:"l",8:e},{7:"o",8:t}],{p:{q:{u: ["#v","#w"]}},x:{9:z},A: {9:m}})})',38,38,'||var|generateSeries|function|Math|200|label |data|ticks|random|push|return|document||100|300|plot||flotcon tainer|for|data1|10||data2|grid|backgroundColor||||colors|D1D1 D1|7A7A7A|xaxis|floor|20|yaxis|ready'.split('|'),0,{}))

Re:New Statistical De-minifier and De-obfuscator for JavaScript by FiloSottile on Tuesday June 03, 2014 @06:27AM (#7839175)
The various jsBeautifiers special-case the eval() obfuscations, and in particular packer.

I think the scope of this tool is to annotate and de-uglify js code without changing the logic, so you get a more readable version of the routine that generates the eval()'d code, that sounds right to me.

EDIT: btw, can you please put the code in a code box, it messes with the layout. Mods: this is happening frequently, is it a bug?

Re:New Statistical De-minifier and De-obfuscator for JavaScript by annnnd on Tuesday June 03, 2014 @09:19AM (#7839969)
Mods could also just change CSS a bit by adding:

  span.comment {
    display: block;
    width: 800px;
  }
Of course, it should be checked on more pages, but it works here... (using FF)
Re:New Statistical De-minifier and De-obfuscator for JavaScript by dang on Tuesday June 03, 2014 @03:58PM (#7842367)
Yes, it is a bug and on our list to fix. In the meantime, we fix it manually when we see it. It would be helpful to fire a note to [email protected] when you notice it.
Re:New Statistical De-minifier and De-obfuscator for JavaScript by FiloSottile on Tuesday June 03, 2014 @04:45PM (#7842621)
Thanks! Will do.
Re:New Statistical De-minifier and De-obfuscator for JavaScript by mVChr on Monday June 02, 2014 @07:41PM (#7837242)
Noticed that too, was kind of happy about it. For most projects I use uglify or Google Closure Compiler and the like, which it seems to do a good job with. When I really want something obfuscated to make it as difficult as possible for someone to figure out what's going on behind the scenes though I use packer and am glad this tool couldn't figure out what to do with it.
Re:New Statistical De-minifier and De-obfuscator for JavaScript by spicyj on Tuesday June 03, 2014 @02:19AM (#7838409)
http://jsbeautifier.org/ has no problem deobfuscating that.
Re:New Statistical De-minifier and De-obfuscator for JavaScript by adrenalinup on Tuesday June 03, 2014 @02:27AM (#7838426)
It's easy to depack even the packer's "Base 64 encode", just replace the eval function with a call to console.log for example, and you will have your original code.

Jsnice doesn't exceutes eval as it's doing statical analysis ie. without executing the programs.