index.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <html>
  2. <head>
  3. <title>JSFuck - Write any JavaScript with 6 Characters: []()!+</title>
  4. <style>
  5. body {
  6. padding: 20px;
  7. max-width: 800px;
  8. }
  9. body, * {
  10. font-family: monospace;
  11. font-size: 14px;
  12. }
  13. h1 {
  14. font-size: 2em;
  15. }
  16. h3 {
  17. font-weight: bold;
  18. }
  19. textarea {
  20. display: block;
  21. width: 100%;
  22. height: 200px;
  23. margin: 1em 0;
  24. }
  25. .checkbox {
  26. display: inline-block;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <h1>JSFuck []()!+</h1>
  32. <p>JSFuck is an esoteric and educational programming style based on the
  33. atomic parts of JavaScript. It uses only six different characters to
  34. write and execute code.</p>
  35. <p>It does not depend on a browser, so you can even run it on Node.js.</p>
  36. <input id="input" type="text" value="alert(1)"/>
  37. <button id="encode" type="text">Encode</button>
  38. <div class="checkbox">
  39. <input id="eval" type="checkbox" checked />
  40. <label for="eval">Eval Source</label>
  41. </div>
  42. <textarea id="output"></textarea>
  43. <div id="stats"></div>
  44. <h3>Links</h3>
  45. <p>
  46. * View source on <a href="http://github.com/aemkei/jsfuck">GitHub</a> <br>
  47. * Follow <a href="http://twitter.com/aemkei">@aemkei</a> (Martin Kleppe) <br>
  48. * Original discussion at <a href="http://sla.ckers.org/forum/read.php?24,32930">Sla.ckers.org</a>
  49. </p>
  50. <h3>Basics</h3>
  51. <pre>
  52. * 'false' => ![]
  53. * 'true' => !![]
  54. * 'undefined' => [][[]]
  55. * 'NaN' => +[![]]
  56. * 'Array' => []
  57. * 'Number' => +[]
  58. * 'String' => []+[]
  59. * 'Boolean' => ![]
  60. * 'Function' => []["sort"]
  61. * eval => []["sort"]["constructor"]( CODE )()
  62. * window => []["sort"]["constructor"]("return this")()
  63. </pre>
  64. <p>See the full list <a href="https://github.com/aemkei/jsfuck/blob/master/jsfuck.js">here.</a></p>
  65. <script src="jsfuck.js"></script>
  66. <script>
  67. function $(id){
  68. return document.getElementById(id);
  69. }
  70. $("encode").onclick = function(){
  71. var output = JSFuck.encode($("input").value, $("eval").checked);
  72. $("output").value = output;
  73. $("stats").innerHTML = output.length + " chars";
  74. }
  75. $("encode").onclick();
  76. </script>
  77. <script type="text/javascript">
  78. var _gaq = _gaq || [];
  79. _gaq.push(['_setAccount', 'UA-57649-11']);
  80. _gaq.push(['_trackPageview']);
  81. (function() {
  82. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  83. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  84. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  85. })();
  86. </script>
  87. </body>
  88. </html>