index.html 3.7 KB

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