Ver Fonte

Clean up HTML.

Martin Kleppe há 12 anos atrás
pai
commit
0c79bc540b
11 ficheiros alterados com 99 adições e 768 exclusões
  1. 1 0
      .gitignore
  2. 0 74
      6chars.js
  3. 0 0
      alert.js
  4. 0 62
      characters.txt
  5. 86 2
      index.html
  6. 0 12
      index.js
  7. 0 18
      infinity.txt
  8. 0 274
      js-noalnum_com.html
  9. 0 267
      js_noalnum.html
  10. 12 9
      jsfuck.js
  11. 0 50
      obfuscate.txt

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.DS_Store

+ 0 - 74
6chars.js

@@ -1,74 +0,0 @@
-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 '\\"+(+!+[]+[+[]+[!+[]+!+[]+!+[]]])+"'")()

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
alert.js


+ 0 - 62
characters.txt

@@ -1,62 +0,0 @@
-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")()

+ 86 - 2
index.html

@@ -1,9 +1,93 @@
 <html>
 <head>
-  <title>V2 - V3 Referenz </title>
+  <title>JSFuck - Write any JavaScript with 6 Characters: []()!+</title>
+  <style>
+    
+    body {
+      padding: 20px;
+    }
+    
+    body, * {
+      font-family: monospace;
+      font-size: 14px;
+    }
+    
+    h1 {
+      font-size: 2em;
+    }
+    
+    h3 {
+      font-weight: bold;
+    }
+    
+    textarea {
+      display: block;
+      width: 100%;
+      max-width: 800px;
+      height: 200px;
+      margin: 1em 0;
+    }
+    
+    .checkbox {
+      display: inline-block;
+    }
+    
+  </style>
 </head>
 <body>
-  <h1>Error 404 <br> Document could not be found</h1>
+  <h1>JSFuck []()!+</h1>
+  
+  <p>JSFuck is an esoteric and educational programming style based on the
+  atomic parts of JavaScript. It uses only six different characters to
+  write and execute code.</p>
+
+  <input id="input" type="text" value="alert(1)"/> 
+  <button id="encode" type="text">Encode</button>
+  
+  <div class="checkbox">
+    <input id="eval" type="checkbox" checked />
+    <label for="eval">Eval Source</label>
+  </div>
+  
+  <textarea id="output"></textarea>
+  <div id="stats"></div>
+  
+  <h3>Links</h3>
+  
+  <p>
+    * View source on <a href="http://github.com/aemkei/jsfuck">GitHub</a> <br>
+    * Follow <a href="http://twitter.com/aemkei">@aemkei</a> (Martin Kleppe) <br>
+    * Original discussion at <a href="http://sla.ckers.org/forum/read.php?24,32930">Sla.ckers.org</a>
+  </p>
+
   <script src="jsfuck.js"></script>
+  <script>
+
+    function $(id){
+      return document.getElementById(id);
+    }
+  
+    $("encode").onclick = function(){
+      var output = JSFuck.encode($("input").value, $("eval").checked);
+      $("output").value = output;
+      $("stats").innerHTML = output.length + " chars";
+    }
+    
+    $("encode").onclick();
+  </script>
+  
+  <script type="text/javascript">
+
+    var _gaq = _gaq || [];
+    _gaq.push(['_setAccount', 'UA-57649-11']);
+    _gaq.push(['_trackPageview']);
+
+    (function() {
+      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+    })();
+
+  </script>
 </body>
 </html>

+ 0 - 12
index.js

@@ -1,12 +0,0 @@
-// RUN THIS IN JAVASCRIPT
-
-([]+{}+[])[!!{}+![]]+([]+
-{}+[])[!!{}+!![]]+(!{}+[]
-)[!{}+![]]+([][{}]+[])[!{
-}+![]]+(!{}+[])[![]+!!{}+
-!!{}+!![]]+({}+{})[(!!{}+
-!![])*(!!{}+!![])+!!{}]+(
-{}-{}+[])[!!{}+![]]+([]+!
-!{})[!{}+![]]+([]+!!{})[!
-[]+!!{}+!!{}+!![]]+([][{}
-]+[])[![]+!!{}+!![]] // !

+ 0 - 18
infinity.txt

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

+ 0 - 274
js-noalnum_com.html

@@ -1,274 +0,0 @@
-
-<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["escape"]("<")[0]',
-/*&*/     '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*/     '[]["sort"]["constructor"]("return \\\"\\103\\\"")()',
-
-/*D*/     'window["atob"](00)[1]',
-/*E*/     'window["atob"](01)[2]',
-/*F*/ '(0+[]["filter"]["constructor"])[10]',
-/*G*/     'window["atob"]("0f")[1]',
-/*H*/     'window["atob"]("0t")[1]',
-/*I*/ '("Infinity")[0]',
-/*J*/     'window["atob"]("00r")[1]',
-/*K*/     'window["atob"]("(")[0]',
-/*L*/     'window["atob"]("/")[0]',
-/*M*/     'window["atob"](0)[0]',
-/*N*/ '("NaN")[0]',
-/*O*/     'window["atob"](8)[0]',
-/*P*/     'window["atob"]("<")[0]',
-/*Q*/     'window["atob"]("a")[1]',
-/*R*/     'window["atob"]("01I")[1]',
-/*S*/ '(String+"")[9]',
-/*T*/     'window["atob"]("N")[0]',
-/*U*/     'window["atob"]("01W")[1]',
-/*V*/     'window["atob"]("01a")[1]',
-/*W*/     '(true+window)[12]',
-/*X*/     'window["atob"]("01i")[1]',
-/*Y*/     'window["atob"]("a")[0]',
-/*Z*/     'window["atob"]("f")[0]',
-
-/*[*/ '(undefined+[]["filter"])[33]',
-/*\*/ 'window["unescape"]("%"+(5)+"c")[0]',
-/*]*/ '(true+[]["filter"])[40]',
-/*^*/     'window["atob"](014)[1]',
-/*_*/     'window["atob"](018)[1]',
-/*`*/     'window["atob"]("02A")[1]',
-
-/*a*/ '("false")[1]',
-/*b*/ '(window+[])[2]',   // "[object"
-/*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]',
-/*z*/ '(+(35))["toString"](36)',
-
-/*{*/ '(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){
-  
-  console.log(":", 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]);
-
-console.log(txt)
-
-/* Loop */
-var it=0;
-var old="";
-
-
-// /* 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);
-
-
-
-/* 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;
-
-}
-
-
-</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">abcdefg</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>
-

+ 0 - 267
js_noalnum.html

@@ -1,267 +0,0 @@
-
-<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>
-

+ 12 - 9
jsfuck.js

@@ -166,12 +166,6 @@
       replace("GLOBAL", GLOBAL);
       replace('\\+""', "+[]");
       replace('""', "[]+[]");
-            
-      try {
-        // eval(value);
-      } catch (e) {
-        throw "Can't convert " + character + "\n" + original + "\n" + value;
-      }
       
       MAPPING[character] = value;
     }
@@ -225,14 +219,23 @@
     }
   }
 
-  function encode(input, recursive){
+  function encode(input, wrapWithEval){
     var output = [];
-    
+        
     input.replace(/./g, function(c){
       output.push(MAPPING[c]);
     });
+
+    output = output.join("+");
+
+    if (wrapWithEval){
+      
+      output = "[][" + encode("filter") + "]" +
+        "[" + encode("constructor") + "]" +
+        "(" + output + ")()"
+    }
     
-    return output.join("+");
+    return output;
   }
       
   var time = new Date();

+ 0 - 50
obfuscate.txt

@@ -1,50 +0,0 @@
-possible characters: abcdefijlnorstuy NOI []
-sample string:       obfuscated
-
-undefined        = [][{}]
-undefined        = [][[]]
-[object Object]  = {}+[]
-false            = ![]
-true             = !![]
-NaN              = {}-{}+[]
-NaN              = +[][[]]
-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]
-
-
-([]+{}+[])[!!{}+![]]+
-([]+{}+[])[!!{}+!![]]+
-(!{}+[])[!{}+![]]+
-([][{}]+[])[!{}+![]]+
-(!{}+[])[![]+!!{}+!!{}+!![]]+
-({}+{})[(!!{}+!![])*(!!{}+!![])+!!{}]+
-({}-{}+[])[!!{}+![]]+
-([]+!!{})[!{}+![]]+
-([]+!!{})[![]+!!{}+!!{}+!![]]+
-([][{}]+[])[![]+!!{}+!![]]
-
-([]+{}+[])[!!{}+![]]+([]+{}+[])[!!{}+!![]]+(!{}+[])[!{}+![]]+([][{}]+[])[!{}+![]]+(!{}+[])[![]+!!{}+!!{}+!![]]+({}+{})[(!!{}+!![])*(!!{}+!![])+!!{}]+({}-{}+[])[!!{}+![]]+([]+!!{})[!{}+![]]+([]+!!{})[![]+!!{}+!!{}+!![]]+([][{}]+[])[![]+!!{}+!![]]

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff