-
Notifications
You must be signed in to change notification settings - Fork 3
/
script.js
350 lines (328 loc) · 10.7 KB
/
script.js
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
let nothing = {} //it just does... nothig
let weirdLetters = {
'a':"ɐΛʌAaÀÁÂÃÄÅÆàáâãäåæĀāĂ㥹ƉǍǎǞǟǠǡǢǣǺǻǼǽȀȁȂȃȦȧȺɑʼΆΑάαӐӑӒӓḀḁẚẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏὰάᾀᾁᾂᾃᾄᾅᾆᾇᾈᾉᾊᾋᾌᾍᾎᾏᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆᾼₐⱥⲀⲁꓮꓯ",
'b':"BbƀƁƂƃɃɓʙΒβБᴃᵬᶀḂḃḄḅḆḇℬBbᴃ",
'c':"CcÇçĆćĈĉĊċČčƇƈȻȼɕͻͼͽᴄℂcC",
'd':"DdÐðĎďĐđƊƋƌDŽDždžDZDzdzȡɖɗɟʄʣʤʥԀԁᴅᴆᴰᵈᵟᵭᶁᶑᶞḊḋḌḍḎḏḐḑḒḓẟðDⅅⅆ",
'e':"EeÈÉÊËÐèéêëĒēĔƏƩĕĖėĘęĚěƩƷƸƹƺǮǯȄȅȆȇȨȩɆɇΈΕέεϵ϶ḔḕḖḗḘḙḚḛḜḝẸẹẺẻẼẽẾếỀềỂểỄễỆệἐἑἒἓἔἕἘἙἚἛἜἝῈΈ⁸₈ₑℯℰⅇꓰꓱⲈⲉ",
'f':"FfƑƒʩFfꜰᵮᶂḞḟℲⅎ",
'g':"GgĜĝĞğĠġĢģƓƔǤǥǦǧǴǵɠɢḠḡꞠꞡGgᴳᵍ",
'h':"HhĤĥĦħƕƛǶȞȟɦɧʜʰʱԦɥԧⲎⲏḩḪḫẖₕℋℌℍꚔꚕᴴḢḣḤḥḦḧḨHhҢңҤҥӇӈӉӊ",
'i':"IiÌÍÎÏìíîïĨĩĪīĬĭĮįİƖƗƾǏǐȈȉȊȋɨɩɪḬḭḮḯỈỉỊịᶖᴵᵢἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὶίῐῑῒΐῖῗῘῙῚΊⁱℐℑIiΊΐΙΪίιϊ",
'j':"JjĴĵǰɈɉʝʲЈјJjᴊᴶᶨⅉⱼ",
'k':"KkĶķĸƘƙǨǩΚκϏЌЖКжкќҖҗҚқҜҝҞҟҠҡӁӂӃӄӜӝԞԟᴋᴷᵏkKḰḱḲḳḴḵₖ",
'l':"LlĹĺĻļĽľĿŀŁłȽɫɬɭɮʪʫԼLlḶḷḸḹḺḻḼḽ",
'm':"MmɱΜМмӍӎḾḿṀṁṂṃᴍᴹᵐᵯᶆꙦꙧⱮⲘⲙɯɰ",
'n':"んNnÑñŃńŅņŇňʼnŊŋƝƞNJNjnjǸǹȠȵɲɳɴṄṅṆṇṈṉṊṋⁿᴺᵑᵰᵸᶇᶮᶯꝴꞐꞑꞤꞥNn",
'o':"OoÒÓÔÕÖØòóôõöøŌōŎŏŐőƆƐƟƠơƢƣǑǒǪǫǬǭǾǿȌȍȎȏȢȣȪȫȬȭȮȯȰȱΌΏΟΩοόώОоӦӧՕօṌṍṎṏṐṑṒṓỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợὀὁὂὃὄὅὈὉὊὋὌὍὨὩὪὫὬὭὮὯὸόᾨᾩᾪᾫᾬᾭᾮᾯῸΌῺΏῼₒℴⓄⓞOoꝊꝋꝌꝍꝎꝏ",
'p':"PpƤƥᴘᴾᵖᵱᵽᶈṔṕṖṗꝐꝑꝒꝓꝔꝕⴔPpπ",
'q':"♀QqȹɊɋʠϘϙҀҁԚԛꝖꝗꝘꝙ",
'r':"RrŔŕŖŗŘřƎƔƪȐȑȒȓɌɍɼɽɾɿʀṘṙṚṛṜṝṞṟῤῥῬℛℜℝᴙᴦRrꝵꝶꝚꝛꞧꞦⱤ",
's':"SsߌśŜŝŞşŠšȘșȿʂᶘṠṡṢṣṤṥṦṧṨṩẞꜱ",
't':"TtŢţŤťŦŧƫƬƭƮȚțȶȾʇʈⲦⲧṪṫṬṭṮṯṰṱẗꚌꚍꚐꚑꓔꓕᵀᶵᵗ",
'u':"UuÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųƯưƱǓǔǕǖǗǘǙǚǛǜȔȕȖȗɄʉʊΰυϋύᵾᵿᶙṲṳṴṵṶṷṸṹṺṻỤụỦủỨứỪừỬửỮữỰựὐὑὒὓὔὕὖὗὺύῠῡῢΰῦῧuꓴꓵμ",
'v':"VvƲʋѴѵѶѷṼṽṾṿ⩡Vvᵛᵥᶌᶹ",
'w':"WwŴŵԜԝⱲⱳẀẁẂẃẄẅẆẇẈẉẘWwꝠꝡ",
'x':"XxˣͯΞΧχ᙭ᚷẊẋẌẍₓXx",
'y':"YÝýÿŶŷŸȲȳɎɏʎʏʸϒϓϔ⅄YyῨῩῪΎὙὛὝὟ",
'z':"ZzŹźŻżŽžƵƶȤȥɀʐʑΖζẐẑẒẓẔẕᴢᵶᶎᶻᶼⱫⱬⱿⲌⲍ"
}
let relatedSymbols = {
'a':"Å@@₳",
'b':"␢฿₿♭",
'c':"℃¢₡₢₵",
'd':"₫∂",
'e':"€€€€℮e∃∈",
'f':"₣℉",
'g':"₲",
'h':"ℏ",
'i':"iI",//null
'j':"jJ",//null
'k':"₭",
'l':"lL£",//null
'm':"₥₥™℠",
'n':"₦",
'o':"oO",//null
'p':"₱℘℗♇¶",
'q':"Qq",//null
'r':"℟℞",
's':"$₷§∫",
't':"₮₸☦☨☩♰♱✝✞✟┬├╦",
'u':"Uu",//null
'v':"√",//null
'w':"₩",
'x':"╳⚔⛌❌❎☠",
'y':"¥",
'z':"Zz"//null
}
let singleCharLeet = {
'a':"4",
'b':"86",
'c':"(<[{",
'd':"d0",
'e':"3&",
'f':"(=}",
'g':"6;",
'h':"#4",
'i':"1!¡':¦]",
'j':"7¿]",
'k':"k",
'l':"1|¬",
'm':"m",
'n':"n",
'o':"0x.*",
'p':"p",
'q':"9,",
'r':"2",
's':"5",
't':"7+",
'u':"vM",
'v':"v",
'w':"w",
'x':"%",
'y':"9j",
'z':"2%"
}
let multiCharLeet = {
'a':["/\\","|\\"],
'b':["|3","|X","|8","|:","/3","[3","[8","(3"],
'c':["c"],
'd':["[)","[>","[}","|)","|}","])"],
'e':["[-"],
'f':["]]=","ph","|#","|=","(="],
'g':["(_+","(_>","[[6","C-","gee","(_-","cj"],
'h':["(-)",")-(","|-|","/-/","]-[","]~[","{-}",":-:","}{","}-{"],
'i':["][","[]",""],
'j':[",|","_|","_/","(/"],
'k':["]{","|(","|<","|\\{","}<","|X"],
'l':["][_","|_","1_"],
'm':["(V)","(u)",".\\\\","//.","ɅɅ","|V|","[V]","em","nn","|v|","^^","|^^|"],
'n':["(\\)","//","ɅV","[\\]","]\\[","^/","|\\|","[]\\"],
'o':["()","[]","oh","<>","( )"],
'p':["][D","[]D","|D","|°","|²","|"],
'q':["(,)","0,","0_","(_,)","O,","(),"],
'r':["|2","1²","P\\","|?","12","/2","l2","|^","|`"],
's':["es","ez","$$"],
't':["']'","']['","-|-","7`","~|~"],
'u':["(_)","/_/","|_|","\\_/","\\_\\","]_[","L|"],
'v':["\\V","\\/"],
'w':["'//","(Ʌ)","///","uu","UU","vv","UU","\\^/"],
'x':[")(","><","}{","ex"],
'y':["'/","V/","_v","`/","`)"],
'z':["\"/_","~/_","7_",">_"]
}
let turnedLetters = {
'a':"∀ɐ",
'b':"q",
'c':"Ɔɔ",
'd':"p",
'e':"Ǝǝ",
'f':"Ⅎɟ",
'g':"ƃ",
'h':"ɥH",
'i':"Iᴉ",
'j':"ſɾ",
'k':"ʞ",
'l':"˥",
'm':"Wɯ",
'n':"Nu",
'o':"oO",
'p':"Ԁd",
'q':"pQ",
'r':"ᴚɹ",
's':"Ss",
't':"⊥ʇ",
'u':"∩n",
'v':"Λʌ",
'w':"Mʍ",
'x':"Xx",
'y':"⅄ʎ",
'z':"Zz"
}
let japaneseVowels = {
'a':"ぁあァア",
'i':"ぃいィイ",
'u':"ぅうゥウ",
'e':"ぇえェエ",
'o':"ぉおォオを"//last one is 'wo'
}
let arabicAlikes = {
'a':"م",
'e':"ﻍﻎﻉﻊ",
'f':"ٲ",
'g':"ۄۅۆۇۈۉۊۋ",
'i':"ﮅﮆﮇﮈﮉ",
'j':"ݫݬﮊﮋﮌﮍ",
'l':"ﭑ",
'm':"ﱰﱱ",
'o':"٥",
'q':"۹",
's':"ﻰﻱﻲﻯﳒﳓﳔﱯﳕ",
'y':"٧۲۳",
'z':"ﱀﱁ"
}
let weirdNumbers = {
'1':"¹⅐⅑⅒¼½⅙①⑴⒈⓵❶➀➊႑|I∞۰",
'2':"²Ƨƨƻ2②⑵⒉⓶⚇⚉⛖⛗₂⅔⅖२২৵੨∞:",
'3':"³¾⅗⅜੩3❸➂➌③⑶⒊⓷⸫∞",
'4':"⅘⁞⁴₄④⑷⒋⓮⓸⛶✤✦✧㍜㏣∞",
'5':"Ƽƽ⑤⑸⒌⓹❺➄➎V⅚∞",
'6':"Ƅƅ⑥⑯⑹⒃⒍⒗⓰⓺♬❻➅➏꘦㍞㍨㏥㏯6∞",
'7':"⁷₇⅐⅞⑦⑰⑺⒄⒎⒘⓱⓻❼㍟㏦∞",
'8':"∞⑧⑱⑻⒅⒏⒙⓲⓼㉏㍠㏧♫❽",
'9':"∞٩۹߉९㍡㏨⁹₉Ⅸⅸ⑨⑲⑼⒆⒐⒚⓳⓽❾➈➒",
'0':"۰०০੦૦୦௦౦౸೦൦๐໐༠༳၀႐០᠐᱐⁰₀↉⓪⓿〇㍘꘠"
}
let variationsOfPunctuations = {
'.':"°*·",
',':";ʻʽ̦̒̓̔̕՝،߸፣᠂᠈⍪❛❜❝❞❟❠︐︑﹐﹑,、",
':':";╎ː꞉∶",
';':"؛",
' ':"_-_`",
'!':'¡?¿!!',
'?':'??¿¡'
}
let emojis = {
'o':"☠⚙☢♉⛔☭⛧",
}
let tailChars = ",!*¿("
const letterWeight = [
[nothing,135],
[weirdLetters,7],
[relatedSymbols,5],
[singleCharLeet,6],
[multiCharLeet,1],
[arabicAlikes,3]
]
const vowelWeight = [
[nothing,70],
[weirdLetters,7],
[relatedSymbols,3],
[singleCharLeet,5],
[multiCharLeet,1],
[arabicAlikes,1],
[japaneseVowels,2]
]
const numberWeight = [
[nothing,15],
[weirdNumbers,5]
]
const elseWeight = [
[nothing,13],
[variationsOfPunctuations,5]
]
function getRandomVariation(data) {
var total = 0
for (let i = 0; i < data.length; ++i) {
total += data[i][1];
}
const threshold = Math.random() * total;
var sum = 0
for (let i = 0; i < data.length; i++) {
sum += data[i][1];
if (sum >= threshold) {
return data[i][0];
}
}
return data[data.length - 1][0];
}
String.prototype.isLetter = function(){
return (/[a-zA-Z]/).test(this)
}
String.prototype.isVowel = function(){
return "aeiou".includes(this)
}
String.prototype.isNumber = function(){
return "0123456789".includes(this);
}
function escapeStringForHTML(s){
return s.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
}
function clearDiv(id) {
let div = document.getElementById(id);
while (div.firstChild) {
div.removeChild(div.firstChild);
}
}
function setText(id,text){
document.getElementById(id).innerHTML = escapeStringForHTML(text);
}
function getText(id){
return document.getElementById(id).firstChild.nodeValue;
}
function addLineToText(id,text){
let div = document.getElementById(id)
div.insertAdjacentHTML('afterbegin',escapeStringForHTML(text)+"<br/>");
}
function randomInt(min,max){
return Math.round(Math.random()*(max-min)+min);
}
function getOptionFrom(ch, charmap) {
try {
const source = charmap[ch.toLowerCase()];
const length = source.length;
const i = randomInt(0, length - 1);
return source[i];
} catch {
return ch;
}
}
function getCharWeight(ch) {
var weight = elseWeight;
if (ch.isLetter())
if (ch.isVowel()) weight = vowelWeight;
else weight = letterWeight;
else if (ch.isNumber()) weight = numberWeight;
else weight = elseWeight;
return weight
}
function hackString(s, out) {
const amt = Math.round((Math.random() * s.length) / 2);
for (let i = 0; i < amt; i++) {
let j = Math.floor(Math.random() * s.length);
var weight = getCharWeight(s[j])
const source = getRandomVariation(weight);
out[j] = getOptionFrom(s[j], source);
}
return out.join("");
}
function start(ogtext, caller, isAcc, rateValue) {
let arr = Array.from(ogtext);
return setInterval(function() {
if(isAcc)
addLineToText("hacktext", hackString(ogtext, arr))
else
setText("hacktext", hackString(ogtext, arr));
}, rateValue || 300);
}
document.addEventListener(
"DOMContentLoaded",
function() {
var txt = document.getElementById("txt")
var button = document.getElementById("button")
var acc = document.getElementById("acc")
var rate = document.getElementById("rate")
var defaultText = document.getElementById("hacktext").firstChild.nodeValue
txt.value = defaultText
var hacking = start(defaultText);
function restartHacking(text, isAcc, rateValue) {
clearInterval(hacking);
if(!isAcc)
clearDiv("hacktext")
hacking = start(text, hacking, isAcc, rateValue);
}
button.addEventListener("click", function() {
const isAcc = acc.checked
const text = txt.value ? txt.value : defaultText
const rateValue = rate.value
restartHacking(text, isAcc, rateValue);
});
acc.addEventListener("click", function() {
button.click()
});
rate.addEventListener("input", function() {
button.click()
});
},
false
);