Unable to debug javascript?
        Posted  
        
            by 
                linkme69
            
        on Pro Webmasters
        
        See other posts from Pro Webmasters
        
            or by linkme69
        
        
        
        Published on 2012-10-26T14:25:01Z
        Indexed on 
            2012/10/26
            17:21 UTC
        
        
        Read the original article
        Hit count: 205
        
JavaScript
I’m having some problems debugging an encoded javacscript. This script I’m referring to given in this link over here.
The encoding here is simple and it works by shifting the unicodes values to whatever Codekey was use during encoding. The code that does the decoding is given here in plain English below:-
 <script language="javascript">
 function dF(s){
 var s1=unescape(s.substr(0,s.length-1)); var t='';
 for(i=0;i<s1.length;i++)t+=String.fromCharCode(s1.charCodeAt(i)-s.substr(s.length-1,1));
 document.write(unescape(t));
 }
I’m interested in knowing or understanding the values (e.g s1,t). Like for example when the value of i=0 what values would the following attributes / method would hold
s1.charCodeAt(i) and s.substr(s.length-1,1)
The reason I’m doing this is to understand as to how a CodeKey function really works. I don’t see anything in the code above which tells it to decode on the basis of codekey value. The only thing I can point in the encoding text is the last character which is set to 1 , 2 ,3 or 4 depending upon the codekey selected during encoding process. One can verify using the link I have given above.
However, to debug, I’m using firebug addon with the script running as localhost on my wamp server. I’m able to put a breakpoint on the js using firebug but I’m unable to retrieve any of the user defined parameters or functions I mentioned above.
I want to know under this context what would be best way to debug this encoded js.
© Pro Webmasters or respective owner