Python module for converting javascript files to glyph like sequences that run in the browser .
input file:
(function(n){
console.log(n*n);
})(5);
output file:
eval('('+((!!+[]+"")[+[]])+((!+[]+"")[(+!![])+(+!![])])+((+!![]/+[]+"")[+!![]])+((({})+"")[(+!![])+(+!![])+(+!![])+(+!![])+(+!![])])+((!+[]+"")[+[]])+((+!![]/+[]+"")[(+!![])+(+!![])+(+!![])])+((({})+"")[+!![]])+((+!![]/+[]+"")[+!![]])+'('+((+!![]/+[]+"")[+!![]])+')'+'{'+((({})+"")[(+!![])+(+!![])+(+!![])+(+!![])+(+!![])])+((({})+"")[+!![]])+((+!![]/+[]+"")[+!![]])+((!!+[]+"")[(+!![])+(+!![])+(+!![])])+((({})+"")[+!![]])+((!!+[]+"")[(+!![])+(+!![])])+((!!+[]+"")[(+!![])+(+!![])+(+!![])+(+!![])])+'.'+((!!+[]+"")[(+!![])+(+!![])])+((({})+"")[+!![]])+"\x67"+'('+((+!![]/+[]+"")[+!![]])+'*'+((+!![]/+[]+"")[+!![]])+')'+';'+'}'+')'+'('+((+!![])+(+!![])+(+!![])+(+!![])+(+!![]))+')'+';');
Requirements:
I am using slimit module to parse javascript input , make sure it is installed pip install slimit
Standalone:
Script expects only 1 argument, File or Directory , in the second case all .js files inside Directory and it's parents will be converted .
As Module:
From python repl:
>>> import smuggler
>>> print smuggler.convert_str('console.log("hi");',True)
eval(((({})+"")[(+!![])+(+!![])+(+!![])+(+!![])+(+!![])])+((({})+"")[+!![]])+((+!![]/+[]+"")[+!![]])+((!!+[]+"")[(+!!
[])+(+!![])+(+!![])])+((({})+"")[+!![]])+((!!+[]+"")[(+!![])+(+!![])])+((!!+[]+"")[(+!![])+(+!![])+(+!![])+(+!![])])+
'.'+((!!+[]+"")[(+!![])+(+!![])])+((({})+"")[+!![]])+"\x67"+'('+'"'+"\x68"+((+!![]/+[]+"")[(+!![])+(+!![])+(+!![])])+
'"'+')'+';');
>>>
Now paste the following inside your browser console session .