Skip to content

Instantly share code, notes, and snippets.

@aemkei
Created July 16, 2012 13:16
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aemkei/3122658 to your computer and use it in GitHub Desktop.
Save aemkei/3122658 to your computer and use it in GitHub Desktop.
Obfuscate JS
http://www.jsfuck.com/
// RUN THIS IN JAVASCRIPT
([]+{}+[])[!!{}+![]]+([]+
{}+[])[!!{}+!![]]+(!{}+[]
)[!{}+![]]+([][{}]+[])[!{
}+![]]+(!{}+[])[![]+!!{}+
!!{}+!![]]+({}+{})[(!!{}+
!![])*(!!{}+!![])+!!{}]+(
{}-{}+[])[!!{}+![]]+([]+!
!{})[!{}+![]]+([]+!!{})[!
[]+!!{}+!!{}+!![]]+([][{}
]+[])[![]+!!{}+!![]] // !
[Update]: Now with eval(): http://jsbin.com/usumaq/quiet
possible characters: abcdefijlnorstuy NOI []
sample string: obfuscated
undefined = ([][{}]+[])
[object Object] = ({}+[])
false = (!{}+[])
true = ([]+!!{})
NaN = ({}-{}+[])
Infinity = (!!{}/![]+[])
0 = !{}+![]
0 = +!{}
1 = !!{}+![]
1 = +!![]
1 = +!+{}
2 = ![]+!!{}+!![]
2 = !!{}+!![]
2 = +!+[]+!!{}
3 = ![]+!!{}+!!{}+!![]
5 = (!!{}+!![])*(![]+!!{}+!![])+!!{}
o ([]+{}+[])[1]
b ([]+{}+[])[2]
f (!{}+[])[0]
u ([][{}]+[])[0]
s (!{}+[])[3]
c ({}+{})[5]
a ({}-{}+[])[1]
t ([]+!!{})[0]
e ([]+!!{})[3]
d ([][{}]+[])[2]
([]+{}+[])[!!{}+![]]+
([]+{}+[])[!!{}+!![]]+
(!{}+[])[!{}+![]]+
([][{}]+[])[!{}+![]]+
(!{}+[])[![]+!!{}+!!{}+!![]]+
({}+{})[(!!{}+!![])*(!!{}+!![])+!!{}]+
({}-{}+[])[!!{}+![]]+
([]+!!{})[!{}+![]]+
([]+!!{})[![]+!!{}+!!{}+!![]]+
([][{}]+[])[![]+!!{}+!![]]
([]+{}+[])[!!{}+![]]+([]+{}+[])[!!{}+!![]]+(!{}+[])[!{}+![]]+([][{}]+[])[!{}+![]]+(!{}+[])[![]+!!{}+!!{}+!![]]+({}+{})[(!!{}+!![])*(!!{}+!![])+!!{}]+({}-{}+[])[!!{}+![]]+([]+!!{})[!{}+![]]+([]+!!{})[![]+!!{}+!!{}+!![]]+([][{}]+[])[![]+!!{}+!![]]
@maettig
Copy link

maettig commented Jul 17, 2012

Brilliant. Now implement this in Brainfuck or vice versa. ;-)

@ForestMars
Copy link

([][{}]+[])[6]+([][{}]+[])[5]+({}+{})[5]+([][{}]+[])[3]+"!"

@tsaniel
Copy link

tsaniel commented Jul 19, 2012

Actually there is a tool : http://utf-8.jp/public/jsfuck.html

@aemkei
Copy link
Author

aemkei commented Jul 19, 2012

@tsaniel Damn, I thought I'm the first one who worked that out.
Just got the crazy constructor thing working to get the latest missing chars:

m = (0..constructor+"")[11]

@aemkei
Copy link
Author

aemkei commented Jul 19, 2012

But the tools seems to be broken in Node and Chrome.

Array.prototype.sort called on null or undefined

I guess that's an issue when they try to get "w" using this:

[].sort.call()

In old browsers it returned window but now it doesn't.

Ps: The source of this converter is a bit more readable:
http://discogscounter.getfreehosting.co.uk/js-noalnum.php?txt=%22abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment