tags:

views:

94

answers:

4

Hey,

I'm having some issues trying to decode some javascript.. I have no idea what kind of encoding this is.. i tried base 64 decoders etc. If you can please help me out with this, here's a fragment of the code:

\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x61\x70\x70\x34\x39\x34\x39\x3

Any ways I can get plain text from that?

Thanks!

+2  A: 

The escape() function encodes a string.

This function makes a string portable, so it can be transmitted across any network to any computer that supports ASCII characters.

This function encodes special characters, with the exception of: * @ - _ + . /

The reverse of escape() is the unescape() function.

Try this:

alert(unescape("\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C\x61\x70\x70\x34\x39\x34\x39\x3"));

Edit: As J-P mentioned unescape isn't really needed here after all.

rogeriopvl
I don't think that helps, it's not escaped text..
Alex
@Alex is does work...
rogeriopvl
As a side note, be careful what you do with the unescaped string: many malicious javascript exploits use this function to obfuscate their code. Unless you know exactly where it came from, you should always examine strings passed this way before using them (and *especially* before executing them!).
tloflin
@Alex it does indeed work: that sample string reads: "innerHTMLapp4949"
tloflin
yes, I suck!Very nice thanks a lot! Also.. how can you encode it like this? using the escape function? lol. I'm new to js..
Alex
`unescape()` isn't needed here. Try `alert("\x69\x6E\x6E\x65\x72\x48\x54");` by itself.
J-P
`unescape` isn't doing anything here. `"\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C\x61\x70\x70\x34\x39\x34\x39"` is already exactly equal to `"innerHTMLapp4949"` without calling any function. `unescape` decodes `%xx` hex sequences (like URL-decoding, only broken; it should in general never be used).
bobince
That's great!But what about these: "void (document[_0x89f8[2]](_0x89f8[1])[_0x89f8[0]]=_0x89f8[3]);var ss=document[_0x89f8[2]](_0x89f8[4]);"What does those mean?
Alex
+1  A: 

These are simply hex-values of symbols.

\x69 = i, etc. First several letters: "innerHTML", "ap…"

Alexander Babaev
A: 

I think you should use window.unescape(), or unescape()

Olaseni
+3  A: 

\xNN is an escape sequence. NN is a hexidecimal number (00 to FF) that represents a Latin-1 character.

Escape sequences are interpreted literally within a string. So:

"\x69" === "i" // true
J-P