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:-
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.
@blueberryfields Thanks for the neat code review.
I changed my focus as someone on stackexchange told me to use dragonfly (opera) as i did I was able to retrieve the variable and their values with the breakpoint statement. For other values i just did
document.write to get desired results. Here is the link of the screenshot.
I was more interested in understanding the part of coding that actually tell the program to shift-back the unicode character based upon code key value. That part of code was
s.substr(s.length-1,1). He just extracted the last character which is the codekey number and then use it in calculating the matching charcode value.
If you unescape this shift-1 code
%264DTDSJQU%2631MBOHVBHF%264E%2633kbwbtdsjqu%2633%264F%261Bbmfsu%2639%2638Ifmmp%2631Xpsme%2638%263%3A%264C%261B%264D0TDSJQU%264F%261B%261%3A%261%3A%261%3A1 you would get
&4DTDSJQU&31MBOHVBHF&4E&33kbwbtdsjqu&33&4F&1Bbmfsu&39&38Ifmmp&31Xpsme&38&3:&4C&1B&4D0TDSJQU&4F&1B&1:&1:&1:1 Although those last chars not required but were intentionally added so it helps in decoding.