Browse Source

First run.

Martin Kleppe 13 years ago
parent
commit
c77857ce64
9 changed files with 708 additions and 51 deletions
  1. 74 0
      6chars.js
  2. 0 0
      alert.js
  3. 62 0
      characters.txt
  4. 9 0
      index.html
  5. 18 0
      infinity.txt
  6. 46 45
      js-noalnum_com.html
  7. 267 0
      js_noalnum.html
  8. 222 0
      jsfuck.js
  9. 10 6
      obfuscate.txt

+ 74 - 0
6chars.js

@@ -0,0 +1,74 @@
+http://discogscounter.getfreehosting.co.uk/js-noalnum.php
+
+a     false
+b     Number        // "".constructor
+c     function      // [].filter
+d     undefined
+e     true
+f     false
+g     String        // "".constructor
+h                   // <a href>
+i     undefined
+j     
+k     
+l     false
+m     Number        // 0..constructor
+n     undefined
+o     function      // [].filter
+p     p             // (33).toString(36)
+q     
+r     true
+s     false
+t     true
+u     undefined
+v     v             // (31).toString(36)
+w     w             // (32).toString(36)
+x     x             // (33).toString(36)
+y     Infinity
+z     z             // (35).toString(36)")()
+      function      // function []["filter"]
+      
+()    filter()      // function []["filter"]
+
+A     
+B     Boolean       // false.constructor
+C     
+D     
+E     
+F     Function      // [].sort.constructor
+G     
+H     
+I     Infinity
+J     
+K     
+L     
+M     
+N     NaN
+O     
+P     
+Q     
+R     
+S     String      ("").constructor
+T     
+U     
+V     
+W     
+X     
+Y     
+Z     
+%     %           // escape
+\     \           // unescape("%5c")[0]
+
+
+
+function split() { [native code] } "".split
+
+(35).toString(36)
+String.fromCharCode(90) 
+
+"%".charCodeAt(0)
+
+global = [].sort.constructor("return this")()
+
+C = [].sort.constructor("return '\\103'")()
+C = []["sort"]["constructor"]("return '\\"+(+!+[]+[+[]+[!+[]+!+[]+!+[]]])+"'")()

File diff suppressed because it is too large
+ 0 - 0
alert.js


+ 62 - 0
characters.txt

@@ -0,0 +1,62 @@
+g h k m p q v w x z
+
+
+a     false, NaN
+b     object
+c     object
+d     undefined
+e     false, true, undefined, object
+f     false, undefined, Infinity
+g     ("").constructor
+h         <a href>
+i     undefined, Infinity
+j     object
+k     
+l     false
+m         <a name>
+n     undefined, Infinity
+o     object
+p     
+q     
+r     true
+s     false
+t     true, object, Infinity
+u     true, undefined
+v     
+w         (32)["toString"](36)
+x     
+y     Infinity
+z
+
+
+I     Infinity
+N     NaN
+O     Object
+S     String      ("").constructor + ""
+B     Boolean     (false).constructor
+
+undefined        = ([][{}]+[])
+[object Object]  = ({}+[])
+false            = (!{}+[])
+true             = ([]+!!{})
+NaN              = ({}-{}+[])
+Infinity         = (!!{}/![]+[])
+
+
+<a name="undefined"></a>     "".anchor()
+<a href="undefined"></a>     "".link()
+
+
+o = ([]["filter"]+[])[6]
+c = ([]["filter"]+[])[3]
+
+
+function split() { [native code] } "".split 
+
+(35).toString(36) z
+String.fromCharCode(90) 
+
+
+
+
+window = []["sort"]["constructor"]("return this")()

+ 9 - 0
index.html

@@ -0,0 +1,9 @@
+<html>
+<head>
+  <title>V2 - V3 Referenz </title>
+</head>
+<body>
+  <h1>Error 404 <br> Document could not be found</h1>
+  <script src="jsfuck.js"></script>
+</body>
+</html>

+ 18 - 0
infinity.txt

@@ -0,0 +1,18 @@
+// +"1e+1000"
+
++(
+  +!+[] +     // 1
+  
+  (
+    !+[]+[]   // false
+  )[
+    !+[] +    // 3
+    !+[] +
+    !+[]
+   ] + 
+   
+   [+!+[]] +  // 1
+   [+[]] +    // 0
+   [+[]] +    // 0
+   [+[]]      // 0
+)

+ 46 - 45
js-noalnum_com.html

@@ -9,10 +9,10 @@
 var replacement_chars=[
 /* */ '(NaN+[]["filter"])[11]',
 /*!*/     'window["atob"]("If")[0]',
-/*"*/ '("").fontcolor()[12]',
+/*"*/ '("")["fontcolor"]()[12]',
 /*#*/     'window["atob"]("0iN")[1]',
 /*$*/     'window["atob"]("0iT")[1]',
-/*%*/     'window["atob"]("0iW")[1]',
+/*%*/ 'window["escape"]("<")[0]',
 /*&*/     'window["atob"]("0ia")[1]',
 /*'*/     'window["atob"]("0if")[1]',
 /*(*/ '(false+[]["filter"])[20]',
@@ -20,23 +20,24 @@ var replacement_chars=[
 /***/     'window["atob"]("0ir")[1]',
 /*+*/     'window["atob"]("0it")[1]',
 /*,*/     'window["atob"]("0iy")[1]',
-/*-*/ '(NaN+window["Date"]())[31]',
+/*-*/     '(NaN+window["Date"]())[31]',
 /*.*/     'window["atob"]("1i4")[1]',
 /*/*/ '(true+("")["sub"]())[10]',
 
 /*0-9 ignored*/ ,,,,,,,,,,
 
-/*:*/ 'window["Date"]()[21]',
+/*:*/     'window["Date"]()[21]',
 /*;*/     'window["atob"]("O0")[0]',
 /*<*/ '("")["sub"]()[0]',
-/*=*/ '("").fontcolor()[11]',
+/*=*/ '("")["fontcolor"]()[11]',
 /*>*/ '("")["sub"]()[10]',
 /*?*/     'window["atob"]("0j9")[1]',
 /*@*/     'window["atob"]("00A")[1]',
 
 /*A*/ '(+[]+[]["constructor"])[10]',
 /*B*/ '(+[]+(false)["constructor"])[10]',
-/*C*/     'window["atob"]("00N")[1]',
+/*C*/     '[]["sort"]["constructor"]("return \\\"\\103\\\"")()',
+
 /*D*/     'window["atob"](00)[1]',
 /*E*/     'window["atob"](01)[2]',
 /*F*/ '(0+[]["filter"]["constructor"])[10]',
@@ -62,7 +63,7 @@ var replacement_chars=[
 /*Z*/     'window["atob"]("f")[0]',
 
 /*[*/ '(undefined+[]["filter"])[33]',
-/*\*/     'window["atob"]("01y")[1]',
+/*\*/ 'window["unescape"]("%"+(5)+"c")[0]',
 /*]*/ '(true+[]["filter"])[40]',
 /*^*/     'window["atob"](014)[1]',
 /*_*/     'window["atob"](018)[1]',
@@ -115,18 +116,23 @@ function makeDigit(d){
     res=res.substr(1);
   return res;
 }
+
 function makeNumberStr(r){
   var res=makeDigit(r[0]);
   if (r.length>1)
     res+="+["+makeNumberStr(r.substr(1))+"]";
   return res;
 }
+
 function makeNumber(r){
   return "+("+makeNumberStr(r)+")";
 }
 
 
 function swapString(s){
+  
+  console.log(":", s)
+  
   s=s.substring(1,s.length-1);
   s=s.replace(/\"/g,replacement_chars[2]);
   
@@ -168,8 +174,8 @@ function noalnum(){
 
 txt=" "+document.getElementById("txt").value+" ";
 
-/* 1. FORMAT REFERENCES USING BRACKETS */
-txt=txt.replace(/\.([a-zA-Z0-9_$]+)/gi,"[\"$1\"]");
+// /* 1. FORMAT REFERENCES USING BRACKETS */
+// txt=txt.replace(/\.([a-zA-Z0-9_$]+)/gi,"[\"$1\"]");
 
 
 /* 2. GROUND GLOBAL REFERENCES */
@@ -177,54 +183,49 @@ txt=txt.replace(/([\s()\[\]{};+])(alert|eval|atob|btoa|document)/g,"$1(window[\"
 
 
 /* 3. REPLACE ESCAPED QUOTES */
-txt=txt.replace(/\\"/g,replacement_chars[92-32]+replacement_chars[34-32]);
-txt=txt.replace(/\\'/g,replacement_chars[92-32]+replacement_chars[39-32]);
+txt=txt.replace(/\\"/g,replacement_chars[92-32]+"+"+replacement_chars[34-32]);
+txt=txt.replace(/\\'/g,replacement_chars[92-32]+"+"+replacement_chars[39-32]);
 
+console.log(txt)
 
 /* Loop */
 var it=0;
 var old="";
-while (txt!=old){
-old=txt;
-
 
-/* 3. REPLACE OBJECTS */
-var objs=['String','Boolean','Function','Array','Number','Date','Object','window'];
-var objs_r=['("")["constructor"]','(false)["constructor"]','[]["filter"]["constructor"]','[]["constructor"]','(0)["constructor"]','window["Date"]','(window["constructor"])["constructor"]','[]["sort"]["constructor"]("return this")()'];
 
-for (i=0;i<objs.length;i++){
-  reg=new RegExp("([\\s()\\[\\]{};,.+])"+objs[i]+"([\\s()\\[\\]{};,.+])","g");
-  txt=txt.replace(reg,"$1"+objs_r[i]+"$2");
-}
-
-
-/* 4. REPLACE CONSTANTS */
-var cons=['false','true','NaN','Infinity','undefined'];
-var cons_r=['![]','!![]','+[![]]','+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])','[][[]]'];
-
-for (i=0;i<cons.length;i++){
-  reg=new RegExp("([\\s()\\[\\]{};,.+])"+cons[i]+"([\\s()\\[\\]{};,.+])","g");
-  txt=txt.replace(reg,"$1"+cons_r[i]+"$2");
-}
-txt=txt.replace(/([\(\)\[\]])("")([\(\)\[\]])/g,"$1[]+[]$3");
-txt=txt.replace(/""/g,"([]+[])");
-
-/* 5. REPLACE STRINGS */
+// /* 3. REPLACE OBJECTS */
+// var objs=['String','Boolean','Function','Array','Number','Date','Object','window'];
+// var objs_r=['("")["constructor"]','(false)["constructor"]','[]["filter"]["constructor"]','[]["constructor"]','(0)["constructor"]','window["Date"]','(window["constructor"])["constructor"]','[]["sort"]["constructor"]("return this")()'];
+// 
+// for (i=0;i<objs.length;i++){
+//   reg=new RegExp("([\\s()\\[\\]{};,.+])"+objs[i]+"([\\s()\\[\\]{};,.+])","g");
+//   txt=txt.replace(reg,"$1"+objs_r[i]+"$2");
+// }
+// 
+// 
+// /* 4. REPLACE CONSTANTS */
+// var cons=['false','true','NaN','Infinity','undefined'];
+// var cons_r=['![]','!![]','+[![]]','+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])','[][[]]'];
+// 
+// for (i=0;i<cons.length;i++){
+//   reg=new RegExp("([\\s()\\[\\]{};,.+])"+cons[i]+"([\\s()\\[\\]{};,.+])","g");
+//   txt=txt.replace(reg,"$1"+cons_r[i]+"$2");
+// }
+// txt=txt.replace(/([\(\)\[\]])("")([\(\)\[\]])/g,"$1[]+[]$3");
+// txt=txt.replace(/""/g,"([]+[])");
+// 
+// /* 5. REPLACE STRINGS */
 txt=txt.replace(/"([^"]+)"/g,swapString);
-txt=txt.replace(/'([^']+)'/g,swapString);
+txt=txt.replace(/([^']+)/g,swapString);
 
-if (step==it)
-  break;
-it++;
-}
 
 
 /* 6. REPLACE NUMBERS */
-txt=txt.replace(/([\(\)\[\]])([0-9]+)([\(\)\[\]])/g,function(a,b,c,d){return b+makeNumberStr(c)+d;});
-txt=txt.replace(/[0-9]+/g,makeNumber);
+ txt=txt.replace(/([\(\)\[\]])([0-9]+)([\(\)\[\]])/g,function(a,b,c,d){return b+makeNumberStr(c)+d;});
+ txt=txt.replace(/[0-9]+/g,makeNumber);
 
 document.getElementById("len").value=txt.length-2;
-document.getElementById("out").value=txt.substring(1,txt.length-1);
+document.getElementById("out").value=txt;
 
 }
 
@@ -233,7 +234,7 @@ document.getElementById("out").value=txt.substring(1,txt.length-1);
 
 </head>
 
-<body bgcolor="FFFF99"  >
+<body bgcolor="FFFF99">
 
 <p>Converts javascript command into no alnum version using only []()+! characters (unless you input extras).</p>
 
@@ -256,7 +257,7 @@ Example:
 <p>Let me know if you find any improvements! Page tested with Firefox only.</p>
 
 <br>Input:
-<br><textarea id="txt" cols="80" rows="2">alert("Type your code here!")</textarea>
+<br><textarea id="txt" cols="80" rows="2">abcdefg</textarea>
 <br>
 <input type="button" value="Convert" onclick="step=-1;noalnum()" />
 <input type="button" value="Step" onclick="step++;noalnum()" />

+ 267 - 0
js_noalnum.html

@@ -0,0 +1,267 @@
+
+<html>
+
+<head>
+
+<script>
+
+/* Supported letters & symbols */
+var replacement_chars=[
+/* */ '(NaN+[]["filter"])[11]',
+/*!*/ 'window["atob"]("If")[0]',
+/*"*/ '("").fontcolor()[12]',
+/*#*/ 'window["atob"]("0iN")[1]',
+/*$*/ 'window["atob"]("0iT")[1]',
+/*%*/ 'window["atob"]("0iW")[1]',
+/*&*/ 'window["atob"]("0ia")[1]',
+/*'*/ 'window["atob"]("0if")[1]',
+/*(*/ '(false+[]["filter"])[20]',
+/*)*/ '(false+[]["filter"])[21]',
+/***/ 'window["atob"]("0ir")[1]',
+/*+*/ 'window["atob"]("0it")[1]',
+/*,*/ 'window["atob"]("0iy")[1]',
+/*-*/ '(NaN+window["Date"]())[31]',
+/*.*/ 'window["atob"]("1i4")[1]',
+/*/*/ '(true+("")["sub"]())[10]',
+/*0-9 ignored*/ ,,,,,,,,,,
+/*:*/ 'window["Date"]()[21]',
+/*;*/ 'window["atob"]("O0")[0]',
+/*<*/ '("")["sub"]()[0]',
+/*=*/ '("").fontcolor()[11]',
+/*>*/ '("")["sub"]()[10]',
+/*?*/ 'window["atob"]("0j9")[1]',
+/*@*/ 'window["atob"]("00A")[1]',
+/*A*/ '(+[]+[]["constructor"])[10]',
+/*B*/ '(+[]+(false)["constructor"])[10]',
+/*C*/ 'window["atob"]("00N")[1]',
+/*D*/ 'window["btoa"](00)[1]',
+/*E*/ 'window["btoa"](01)[2]',
+/*F*/ '(0+[]["filter"]["constructor"])[10]',
+/*G*/ 'window["btoa"]("0f")[1]',
+/*H*/ 'window["btoa"]("0t")[1]',
+/*I*/ '("Infinity")[0]',
+/*J*/ 'window["atob"]("00r")[1]',
+/*K*/ 'window["btoa"]("(")[0]',
+/*L*/ 'window["btoa"]("/")[0]',
+/*M*/ 'window["btoa"](0)[0]',
+/*N*/ '("NaN")[0]',
+/*O*/ 'window["btoa"](8)[0]',
+/*P*/ 'window["btoa"]("<")[0]',
+/*Q*/ 'window["btoa"]("a")[1]',
+/*R*/ 'window["atob"]("01I")[1]',
+/*S*/ '(String+"")[9]',
+/*T*/ 'window["btoa"]("N")[0]',
+/*U*/ 'window["atob"]("01W")[1]',
+/*V*/ 'window["atob"]("01a")[1]',
+/*W*/ '(true+window)[12]',
+/*X*/ 'window["atob"]("01i")[1]',
+/*Y*/ 'window["btoa"]("a")[0]',
+/*Z*/ 'window["btoa"]("f")[0]',
+/*[*/ '(undefined+[]["filter"])[33]',
+/*\*/ 'window["atob"]("01y")[1]',
+/*]*/ '(true+[]["filter"])[40]',
+/*^*/ 'window["atob"](014)[1]',
+/*_*/ 'window["atob"](018)[1]',
+/*`*/ 'window["atob"]("02A")[1]',
+/*a*/ '("false")[1]',
+/*b*/ '(window+[])[2]',
+/*c*/ '([]["filter"]+[])[3]',
+/*d*/ '("undefined")[2]',
+/*e*/ '("true")[3]',
+/*f*/ '("false")[0]', 
+/*g*/ '([]+("")["constructor"])[14]',
+/*h*/ '(+(+!+[]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]))["toString"](18)',
+/*i*/ '([false]+undefined)[10]',
+/*j*/ '(window+[])[3]',
+/*k*/ 'window["atob"]("a0")[0]',
+/*l*/ '("false")[2]',
+/*m*/ '(Number+[])[11]',
+/*n*/ '("undefined")[1]',
+/*o*/ '(true+[]["filter"])[10]',
+/*p*/ 'window["atob"]("cN")[0]',
+/*q*/ 'window["atob"]("cf")[0]',
+/*r*/ '("true")[1]',
+/*s*/ '("false")[3]',
+/*t*/ '("true")[0]',
+/*u*/ '("undefined")[0]',
+/*v*/ '(0+[]["filter"])[30]',
+/*w*/ '(window+"")[13]',
+/*x*/ 'window["atob"]("eN")[0]',
+/*y*/ '(NaN+[Infinity])[10]',
+/*z*/ 'window["atob"]("et")[0]',
+/*{*/ '(NaN+[]["filter"])[21]',
+/*|*/ 'window["atob"]("03y")[1]',
+/*}*/ '(NaN+[]["filter"])[41]',
+/*~*/ 'window["atob"](234)[1]'
+]
+
+var reg;
+var step=-1;
+
+function makeDigit(d){
+  var n=parseInt(d);
+  var res="+[]";
+  if (n>0)
+    res="+!"+res;
+  for (i=1;i<n;i++)
+    res="+!+[]"+res;
+  if (n>1)
+    res=res.substr(1);
+  return res;
+}
+function makeNumberStr(r){
+  var res=makeDigit(r[0]);
+  if (r.length>1)
+    res+="+["+makeNumberStr(r.substr(1))+"]";
+  return res;
+}
+function makeNumber(r){
+  return "+("+makeNumberStr(r)+")";
+}
+
+
+function swapString(s){
+  s=s.substring(1,s.length-1);
+  s=s.replace(/\"/g,replacement_chars[2]);
+  
+  var constr=['false','true','NaN','Infinity','undefined'];
+  var constr_r=['![]','!![]','+[![]]','+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])','[][[]]'];
+
+  function swapInner(str,f){
+    if (str=="") return "";
+    var rep="";
+    var up=1;
+    var enc=true;
+    for (i=0;i<constr.length;i++)
+      if (str.indexOf(constr[i])==0){
+         rep=constr_r[i];
+         up=constr[i].length;
+         if (f&&str.length==up)
+           rep+="+[]";
+      }
+    if (rep==""){
+      rep=(/[0-9]+/).exec(str);
+      if (rep!=null && str.indexOf(rep=String(rep))==0){
+        up=rep.length;
+        rep=makeNumberStr(rep);
+      }
+      else {
+        enc=false;
+        rep=replacement_chars[str.charCodeAt(0)-32];
+      }
+    }
+    if (f)
+      enc=false;
+    return (f?"":"+")+(enc?"[":"")+rep+(enc?"]":"")+swapInner(str.substr(up),false);
+  }
+  return swapInner(s,true);
+}
+
+
+function noalnum(){
+
+txt=" "+document.getElementById("txt").value+" ";
+
+/* 1. FORMAT REFERENCES USING BRACKETS */
+txt=txt.replace(/\.([a-zA-Z0-9_$]+)/gi,"[\"$1\"]");
+
+
+/* 2. GROUND GLOBAL REFERENCES */
+txt=txt.replace(/([\s()\[\]{};+])(alert|eval|atob|btoa|document)/g,"$1(window[\"$2\"])");
+
+
+/* 3. REPLACE ESCAPED QUOTES */
+txt=txt.replace(/\\"/g,replacement_chars[92-32]+replacement_chars[34-32]);
+txt=txt.replace(/\\'/g,replacement_chars[92-32]+replacement_chars[39-32]);
+
+
+/* Loop */
+var it=0;
+var old="";
+while (txt!=old){
+old=txt;
+
+
+/* 3. REPLACE OBJECTS */
+var objs=['String','Boolean','Function','Array','Number','Date','Object','window'];
+var objs_r=['("")["constructor"]','(false)["constructor"]','[]["filter"]["constructor"]','[]["constructor"]','(0)["constructor"]','window["Date"]','(window["constructor"])["constructor"]','[]["sort"]["constructor"]("return this")()'];
+
+for (i=0;i<objs.length;i++){
+  reg=new RegExp("([\\s()\\[\\]{};,.+])"+objs[i]+"([\\s()\\[\\]{};,.+])","g");
+  txt=txt.replace(reg,"$1"+objs_r[i]+"$2");
+}
+
+
+/* 4. REPLACE CONSTANTS */
+var cons=['false','true','NaN','Infinity','undefined'];
+var cons_r=['![]','!![]','+[![]]','+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])','[][[]]'];
+
+for (i=0;i<cons.length;i++){
+  reg=new RegExp("([\\s()\\[\\]{};,.+])"+cons[i]+"([\\s()\\[\\]{};,.+])","g");
+  txt=txt.replace(reg,"$1"+cons_r[i]+"$2");
+}
+txt=txt.replace(/([\(\)\[\]])("")([\(\)\[\]])/g,"$1[]+[]$3");
+txt=txt.replace(/""/g,"([]+[])");
+
+/* 5. REPLACE STRINGS */
+txt=txt.replace(/"([^"]+)"/g,swapString);
+txt=txt.replace(/'([^']+)'/g,swapString);
+
+if (step==it)
+  break;
+it++;
+}
+
+
+/* 6. REPLACE NUMBERS */
+txt=txt.replace(/([\(\)\[\]])([0-9]+)([\(\)\[\]])/g,function(a,b,c,d){return b+makeNumberStr(c)+d;});
+txt=txt.replace(/[0-9]+/g,makeNumber);
+
+document.getElementById("len").value=txt.length-2;
+document.getElementById("out").value=txt.substring(1,txt.length-1);
+
+}
+
+
+</script>
+
+</head>
+
+<body bgcolor="FFFF99"  >
+
+<p>Converts javascript command into no alnum version using only []()+! characters (unless you input extras).</p>
+
+<p>Intended input: one line, no whitespace, no variables, function definitions or conditionals.</p>
+
+<p>Note:
+<br>~ Some obscure letters/symbols might not be implemented (will remain as they are in the output)
+<br>~ A precise syntax is required:
+<br> - Infinity, NaN, or any number needs to be enclosed when being added to something from behind
+<br> - Numbers outside strings, ie. "abc"+123
+<br> - Strings in double quotations, not nested
+<br>~ Most problems caused by missing parentheses around strings
+</p>
+
+<p>
+Example:
+<br>alert(document.getElementById("txt").value+String.fromCharCode(33))
+</p>
+
+<p>Let me know if you find any improvements! Page tested with Firefox only.</p>
+
+<br>Input:
+<br><textarea id="txt" cols="80" rows="2">alert("Type your code here!")</textarea>
+<br>
+<input type="button" value="Convert" onclick="step=-1;noalnum()" />
+<input type="button" value="Step" onclick="step++;noalnum()" />
+<input type="button" value="eval(--v)" onclick="eval(document.getElementById('out').value);" />
+<input type="button" value="alert(eval(--v))" onclick="alert(eval(document.getElementById('out').value));" />
+<input type="button" value="Clear--^" onclick="document.getElementById('txt').value=''" />
+<input type="button" value="Clear--v" onclick="document.getElementById('out').value=''" />
+Output Length: <input type="text" size="12" id="len" />
+<br>
+<textarea id="out" cols="80" rows="30">alert("  Result shows here. ")</textarea>
+
+</body>
+</html>
+

+ 222 - 0
jsfuck.js

@@ -0,0 +1,222 @@
+(function(){
+  
+  var USE_CHAR_CODE = "USE_CHAR_CODE";
+  
+  var MIN = 32, MAX = 126;
+  
+  var MAPPING = {
+    "a":   '("false")[1]',
+    "b":   '(window+[])[2]',
+    "c":   '([]["filter"]+[])[3]',
+    "d":   '("undefined")[2]',
+    "e":   '("true")[3]',
+    "f":   '("false")[0]', 
+    "g":   '([]+("")["constructor"])[14]',
+    "h":   '(+(17))["toString"](18)',
+    "i":   '([false]+undefined)[10]',
+    "j":   '(window+"")[3]',
+    "k":   '(+(20))["toString"](21)',
+    "l":   '("false")[2]',
+    "m":   '(Number+"")[11]',
+    "n":   '("undefined")[1]',
+    "o":   '(true+[]["filter"])[10]',
+    "p":   '(+(25))["toString"](30)',
+    "q":   '(+(26))["toString"](30)',
+    "r":   '("true")[1]',
+    "s":   '("false")[3]',
+    "t":   '("true")[0]',
+    "u":   '("undefined")[0]',
+    "v":   '(+(31))["toString"](32)',
+    "w":   '(+(32))["toString"](33)',
+    "x":   '(+(33))["toString"](34)',
+    "y":   '(NaN+[Infinity])[10]',  // TODO: Shorten  
+    "z":   '(+(35))["toString"](36)',
+
+    "A":   '("function Array")[9]',
+    "B":   '("function Boolean")[9]',
+    "C":   'Function("return \'\\\\"+(103)+"\'")()',
+    "D":   USE_CHAR_CODE,
+    "E":   USE_CHAR_CODE,
+    "F":   '("function Function")[9]',
+    "G":   USE_CHAR_CODE,
+    "H":   USE_CHAR_CODE,
+    "I":   '("Infinity")[0]',
+    "J":   USE_CHAR_CODE,
+    "K":   USE_CHAR_CODE,
+    "L":   USE_CHAR_CODE,
+    "M":   USE_CHAR_CODE,
+    "N":   '("NaN")[0]',
+    "O":   USE_CHAR_CODE,
+    "P":   USE_CHAR_CODE,
+    "Q":   USE_CHAR_CODE,
+    "R":   USE_CHAR_CODE,
+    "S":   '("function String")[9]',
+    "T":   USE_CHAR_CODE,
+    "U":   USE_CHAR_CODE,
+    "V":   USE_CHAR_CODE,
+    "W":   USE_CHAR_CODE,
+    "X":   USE_CHAR_CODE,
+    "Y":   USE_CHAR_CODE,
+    "Z":   USE_CHAR_CODE,
+
+    " ":   '([]["filter"]+[])[8]',
+    "!":   USE_CHAR_CODE,
+    "\"":  '("")["link"]()[8]',
+    "#":   USE_CHAR_CODE,
+    "$":   USE_CHAR_CODE,
+    "%":   'window["escape"]("<")[0]',
+    "&":   USE_CHAR_CODE,
+    "'":   USE_CHAR_CODE,
+    "(":   '([]["filter"]+"")[15]',
+    ")":   '([]["filter"]+"")[16]',
+    "*":   USE_CHAR_CODE,
+    "+":   USE_CHAR_CODE,
+    ",":   USE_CHAR_CODE,
+    "-":   USE_CHAR_CODE,
+    ".":   USE_CHAR_CODE,
+    "/":   '("")["sub"]()[6]',
+    ":":   'window["Date"]()[21]',
+    ";":   USE_CHAR_CODE,
+    "<":   '("")["sub"]()[0]',
+    "=":   '("")["fontcolor"]()[11]',
+    ">":   '("")["sub"]()[10]',
+    "?":   USE_CHAR_CODE,
+    "@":   USE_CHAR_CODE,
+    "[":   USE_CHAR_CODE,
+    "\\":  'window["unescape"]("%"+(5)+"c")[0]',
+    "]":   USE_CHAR_CODE,
+    "^":   USE_CHAR_CODE,
+    "_":   USE_CHAR_CODE,
+    "`":   USE_CHAR_CODE,
+    "{":   '([]["filter"]+"")[18]',
+    "|":   USE_CHAR_CODE,
+    "}":   USE_CHAR_CODE,
+    "~":   USE_CHAR_CODE
+  };
+  
+  var CONST = {
+    'false':      '![]',
+    'true':       '!![]',
+    'undefined':  '[][[]]',
+    'NaN':        '+[![]]',
+    'Infinity':   '+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])'
+  };
+  
+  
+  function fillMissingChars(){
+    for (var key in MAPPING){
+      if (MAPPING[key] === USE_CHAR_CODE){
+        MAPPING[key] = 'window["String"]["fromCharCode"](' + key.charCodeAt(0) + ')';
+      }
+    }
+  }
+  
+  function fillMissingDigits(){
+    var output, number, i;
+    
+    for (number=0; number<10; number++){
+      
+      output = "+[]";
+      
+      if (number > 0){ output = "+!" + output; }
+      for (i=1; i < number; i++){ output = "+!+[]" + output; }
+      if (number > 1){ output = output.substr(1); }
+      
+      MAPPING[number] = "[" + output + "]";
+    }
+  }
+  
+  function replaceMap(){
+    var character = "", value, original, regEx, replacement;
+    
+    for (var i = MIN; i <= MAX; i++){
+      character = String.fromCharCode(i);
+      value = MAPPING[character];
+      original = value;
+      
+      for (key in CONST){
+        replacement = CONST[key];
+        
+        // replace quotes symbols
+        regEx = new RegExp('"' + key + '"', "gi");
+        value = value.replace(regEx, replacement + "+[]");
+
+        // replace left symbols
+        regEx = new RegExp(key, "gi");        
+        value = value.replace(regEx, "(" + replacement + ")");
+      }
+      
+      for (key = 0; key < 10; key++){
+        regEx = new RegExp(key, "gi");        
+        value = value.replace(regEx, "+[" + MAPPING[key] + "]");
+      }
+      
+      value = value.replace(/""/gi, "[]+[]");
+      
+      try {
+        eval(value);
+      } catch (e) {
+        throw "Can't convert " + character + "\n" + original + "\n" + value;
+      }
+      
+      MAPPING[character] = value;
+    }
+  }
+
+  function swap(input, recursive){
+    
+    if (input == "") { return ""; }
+    
+    var character = input[0], 
+      length = 1, 
+      replacement, 
+      key;
+    
+    for (key in CONST){
+      if (input.indexOf(key) === 0){
+        replacement = CONST[key];
+        length = key.length;
+        if (recursive && input.length === length) {
+          replacement += "+[]";
+        }
+      }
+    }
+    
+    replacement = replacement || MAPPING[character];
+    
+    input = input.substr(length);
+    
+    return (recursive ? "" : " + \n" ) + replacement + swap(input, false);
+  }
+  
+  window = this;
+  
+  function encode(input){
+    var output = swap(input, true);
+    var evaluated = eval(output);
+    
+    
+    if (input == evaluated){
+      console.log(output);
+      console.log(input);
+    } else {
+      console.error("FAILED");
+      console.log(input);
+      console.log(evaluated);
+    }
+  }
+  
+  fillMissingDigits();
+  fillMissingChars();
+  replaceMap();
+  
+  var input = "true\"false\"InfinityundefinedNaNalert(1);";
+  for (var i = MIN; i <= MAX; i++){
+    input += String.fromCharCode(i);
+  }
+  encode(input);
+  //encode("f")
+  
+  console.log("\nDONE")
+  
+})();

+ 10 - 6
obfuscate.txt

@@ -1,12 +1,16 @@
 possible characters: abcdefijlnorstuy NOI []
 sample string:       obfuscated
 
-undefined        = ([][{}]+[])
-[object Object]  = ({}+[])
-false            = (!{}+[])
-true             = ([]+!!{})
-NaN              = ({}-{}+[])
-Infinity         = (!!{}/![]+[])
+undefined        = [][{}]
+undefined        = [][[]]
+[object Object]  = {}+[]
+false            = ![]
+true             = !![]
+NaN              = {}-{}+[]
+NaN              = +[][[]]
+NaN              = +[![]]
+Infinity         = !!{}/![]+[]
+
 
 0 = !{}+![]
 0 = +!{}

Some files were not shown because too many files changed in this diff