Search code examples
javascriptevaldecode

How I decode eval wise Javascript


I want to use a template on my blogger blog site. But the template has js encoded by eval (wise)... I don't know how to decode it...

Code Simple (Is not original code) :

eval(function(w,i,s,e){var lIll=0;var ll1I=0;var Il1l=0;var ll1l=[];var l1lI=[];while(true){if(lIll<5)l1lI.push(w.charAt(lIll));else if(lIll<w.length)ll1l.push(w.charAt(lIll));lIll++;if(ll1I<5)l1lI.push(i.charAt(ll1I));else if(ll1I<i.length)ll1l.push(i.charAt(ll1I));ll1I++;if(Il1l<5)l1lI.push(s.charAt(Il1l));else if(Il1l<s.length)ll1l.push(s.charAt(Il1l));Il1l++;if(w.length+i.length+s.length+e.length==ll1l.length+l1lI.length+e.length)break;}var lI1l=ll1l.join('');var I1lI=l1lI.join('');ll1I=0;var l1ll=[];for(lIll=0;lIll<ll1l.length;lIll+=2){var ll11=-1;if(I1lI.charCodeAt(ll1I)%2)ll11=1;l1ll.push(String.fromCharCode(parseInt(lI1l.substr(lIll,2),36)-ll11));ll1I++;if(ll1I>=l1lI.length)ll1I=0;}return l1ll.join('');}('','','','3cec1244c096c198fd3597fccab5ca32'));

My Question is, how to decode this type js?


Solution

  • Basically, eval() is a function property of the global object.

    The argument of the eval() function is a string. If the string represents an expression, eval() evaluates the expression. If the argument represents one or more JavaScript statements, eval() evaluates the statements. Do not call eval() to evaluate an arithmetic expression; JavaScript evaluates arithmetic expressions automatically.

    in your code you can just remove eval and unminify your function using

    http://unminify.com/

    it will unminify your function. when I do I got this.

    function(w, i, s, e) {
    var lIll = 0;
    var ll1I = 0;
    var Il1l = 0;
    var ll1l = [];
    var l1lI = [];
    while (true) {
        if (lIll < 5) l1lI.push(w.charAt(lIll));
        else if (lIll < w.length) ll1l.push(w.charAt(lIll));
        lIll++;
        if (ll1I < 5) l1lI.push(i.charAt(ll1I));
        else if (ll1I < i.length) ll1l.push(i.charAt(ll1I));
        ll1I++;
        if (Il1l < 5) l1lI.push(s.charAt(Il1l));
        else if (Il1l < s.length) ll1l.push(s.charAt(Il1l));
        Il1l++;
        if (w.length + i.length + s.length + e.length == ll1l.length + l1lI.length + e.length) break;
    }
    var lI1l = ll1l.join('');
    var I1lI = l1lI.join('');
    ll1I = 0;
    var l1ll = [];
    for (lIll = 0; lIll < ll1l.length; lIll += 2) {
        var ll11 = -1;
        if (I1lI.charCodeAt(ll1I) % 2) ll11 = 1;
        l1ll.push(String.fromCharCode(parseInt(lI1l.substr(lIll, 2), 36) - ll11));
        ll1I++;
        if (ll1I >= l1lI.length) ll1I = 0;
    }
    return l1ll.join('');
    }('', '', '', '3cec1244c096c198fd3597fccab5ca32');
    

    for more reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval