forked from aemkei/jsfuck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
190 lines (153 loc) · 5.12 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<html>
<head>
<title>JSFuck - Write any JavaScript with 6 Characters: []()!+</title>
<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 to execute code.">
<meta charset="utf-8" />
<meta property="og:image" content="http://www.jsfuck.com/preview.png" />
<meta name="viewport" content="width=device-width" />
<style>
body {
padding: 20px;
}
body, * {
font-family: monospace;
font-size: 14px;
line-height: 1.4em;
}
h1 {
font-size: 2em;
position: absolute;
top: 70px;
font-weight: normal;
left: 140px;
}
h2 {
width: 90px;
text-align: right;
padding: 50px 5px 5px;
background: #F0DB4E;
color: #323230;
font-weight: bold;
font-size: 20px;
line-height: 1em;
}
h3 {
font-weight: bold;
}
p, li, textarea, .actions {
width: 100%;
max-width: 600px;
}
textarea {
display: block;
height: 200px;
margin: 1em 0;
}
ul.pre li{
white-space: pre;
}
.checkbox {
display: inline-block;
}
.actions a {
float: right;
}
.actions {
clear: both;
}
</style>
</head>
<body>
<h1>JSFuck</h1>
<h2>()+<br>[]!</h2>
<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>
<p>It does not depend on a browser, so you can even run it on Node.js.</p>
<p>Use the form below to convert your own script. Uncheck "eval source" to
get back a plain string.</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>
<div class="checkbox">
<input id="scope" type="checkbox" checked />
<label for="scope">Run In Parent Scope</label>
</div>
<textarea id="output"></textarea>
<div class="actions">
<span id="stats">…</span>
<a id="run" href="#">Run This</a>
</div>
<h3>Links</h3>
<ul>
<li>
Share on
<a href="https://twitter.com/intent/tweet?text=This%20project%20is%20crazy:%20http://jsfuck.com%20%E2%80%93%20Write%20any%20JavaScript%20with%206%20characters%20[]()!+%20//%20via%20@aemkei" target="_blank">Twitter</a>,
<a href="https://plus.google.com/share?url=http://www.jsfuck.com" target="_blank">Google+</a>
</li>
<li>View source on <a href="http://github.com/aemkei/jsfuck">GitHub</a></li>
<li>Follow <a href="http://twitter.com/aemkei">@aemkei</a> (Martin Kleppe)</li>
<li>Original discussion at <a href="http://sla.ckers.org/forum/read.php?24,32930">Sla.ckers.org</a></li>
</ul>
<h3>Alternatives</h3>
<ul>
<li><a href="http://patriciopalladino.com/files/hieroglyphy/">Hieroglyphy</a> (8 chars, browser only)</li>
<li><a href="http://utf-8.jp/public/jsfuck.html">utf-8.jp</a> (broken)</li>
<li><a href="http://discogscounter.getfreehosting.co.uk/js-noalnum.php">JS-NoAlnum</a> (broken)</li>
</ul>
<h3>Basics</h3>
<ul class="pre">
<li>false => ![]</li>
<li>true => !![]</li>
<li>undefined => [][[]]</li>
<li>NaN => +[![]]</li>
<li>0 => +[]</li>
<li>1 => +!+[]</li>
<li>2 => !+[]+!+[]</li>
<li>10 => [+!+[]]+[+[]]</li>
<li>Array => []</li>
<li>Number => +[]</li>
<li>String => []+[]</li>
<li>Boolean => ![]</li>
<li>Function => []["filter"]</li>
<li>eval => []["filter"]["constructor"]( CODE )()</li>
<li>window => []["filter"]["constructor"]("return this")()</li>
</ul>
<p>See the full list <a href="https://github.com/aemkei/jsfuck/blob/master/jsfuck.js">here</a>.</p>
<script src="jsfuck.js"></script>
<script>
function $(id){
return document.getElementById(id);
}
function encode(){
var output = JSFuck.encode($("input").value, $("eval").checked, $("scope").checked);
$("output").value = output;
$("stats").innerHTML = output.length + " chars";
}
$("encode").onclick = encode;
$("eval").onchange = encode;
$("scope").onchange = encode;
encode();
$("run").onclick = function(){
value = eval($("output").value);
if (!$("eval").checked){
alert('"' + value + '"');
}
return false;
};
</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>