I was given this script (without the comments), and I need to figure out what it does. I've added the comments as a guess as to what it does, but I have never done any javascript before. So clarifications would be appreciated.
var _0x39e7=["\x76\x61\x6C\x75\x65", // value
"\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64", // getElementById
"\x3C", // <
"\x26\x6C\x74\x3B", // <
"\x72\x65\x70\x6C\x61\x63\x65", // replace
"\x3E", // >
"\x26\x67\x74\x3B", // >
"\x5C\x22"]; // \"
function sanitize(_0xe049x2){
var _0xe049x3=document[_0x39e7[1]](_0xe049x2)[_0x39e7[0]]; // x = document.getElementById(BLAH).value
var _0xe049x4=_0xe049x3[_0x39e7[4]](_0x39e7[2],_0x39e7[3]); // y = x.replace(<, <);
_0xe049x4=_0xe049x4[_0x39e7[4]](_0x39e7[5],_0x39e7[6]); // y = y.replace(>, >);
_0xe049x4=_0xe049x4[_0x39e7[4]](/"/g,_0x39e7[7]); // y = y.replace(/"/g, "\"");
document[_0x39e7[1]](_0xe049x2)[_0x39e7[0]]=_0xe049x4; // document.getElementById(BLAH).value = y
} ;
So if all of my comments are indeed correct, what does the replace(/"/g, "\"") call do? It seems like we are replacing quotes by quotes ... or something? Doesn't seem to make much sense to me...
Thanks!

New Topic/Question
Reply


MultiQuote



|