2

I am getting weird characters on a script of a web page. This is part of the script

___=~[];___={___:++___,$$$$:(![]+"")[___],__$:++___,$_$_:(![]+"")[___],_$_:++___,$_$$:({}+"")[___],$$_$:(___[___]+"")[___],_$$:++___,$$$_:(!""+"")[___],$__:++___,$_$:++___,$$__:({}+"")[___],$$_:++___,$$$:++___,$___:++___,$__$:++___};___.$_=(___.$_=___+"")[___.$_$]+(___._$=___.$_[___.__$])+(___.$$=(___.$+"")[___.__$])+((!___)+"")[___._$$]+(___.__=___.$_[___.$$_])+(___.$=(!""+"")[___.__$])+(___._=(!""+"")[___._$_])+___.$_[___.$_$]+___.__+___._$+___.$;___.$$=___.$+(!""+"")[___._$$]+___.__+___._+___.$+___.$$;___.$=(___.___)[___.$_][___.$_];___.$(___.$(___.$$+"\""+"\\"+___.__$+___.$$_+___.$$_+___.$_$_+"\\"+___.__$+___.$$_+___._$_+"\\"+___.$__+___.___+___._$+___.$_$$+"\\"+___.__$+___.$_$+___._$_+"\\"+___.$__+___.___+"=\\"+___.$__+___.___+"{\\"+___.$__+___.___+"};\\"+___.__$+___._$_+___._$+___.$_$$+"\\"+___.__$+___.$_$+___._$_+".\\"+___.__$+___.$$_+___._$$+___.$$$_+___.$$__+"\\"+___.__$+___.$$_+___._$_+___.$$$_+___.__+"\\"+___.$__+___.___+"=\\"+___.$__+___.___+"\\\"\\"+___.__$+___.___+___.__$+"\\"+___.__$+___.$_$+___.$$_+"\\"+___.__$+___.$__+___.$$$+___.$$$_+(![]+"")[___._$_]+"\\"+___.__$+___.$_$+___.__$+"\\"+___.__$+___.$_$+___.$$_+___.$_$_+"\\"+___.$__+___.___+"\\"+___.

This translates in a weird way to alert("why"). How is that possible?

一二三
  • 21,059
  • 11
  • 65
  • 74
Keeto
  • 4,074
  • 9
  • 35
  • 58
  • simply because each part evaluates correctly. Many of those characters are valid variable names, whether you realize it or not. – zzzzBov Dec 02 '11 at 19:05
  • "Part of the script"... It's not sufficient to fully answer the question. – Rob W Dec 02 '11 at 19:06

1 Answers1

1

This is called code obfuscation, using utf-8 characters that are other than our english alphabet. The variables have valid names, and there are usually calls to functions that will do conversions to supply english text for output via alerts, etc.

See here for a good discussion: How can I obfuscate (protect) JavaScript?

Community
  • 1
  • 1
Jonathan M
  • 17,145
  • 9
  • 58
  • 91