-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs.lua
More file actions
612 lines (602 loc) · 19.4 KB
/
js.lua
File metadata and controls
612 lines (602 loc) · 19.4 KB
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
return function(notif)
local req = request;
local notif = (notif == nil) and true or notif;
local getmeta = getrawmetatable;
local StarterGui = game:GetService("StarterGui");
local MarketplaceService = game:GetService("MarketplaceService");
local JSLuaIcon = 6603478410;
function GetImageID(DecalID)
local Result;
if (req) then
Result = req({
Url = ("https://rbxdecal.glitch.me/"..DecalID),
Method = "GET"
}).Body;
else
Result = game:HttpGet("https://rbxdecal.glitch.me/"..DecalID);
end;
return "rbxassetid://"..Result;
end;
JSLuaIcon = GetImageID(JSLuaIcon);
function SendNotification(Config)
Config.Icon = JSLuaIcon;
StarterGui:SetCore("SendNotification", Config);
end;
function c(Closure)
return newcclosure(Closure);
end;
function SearchToInsensitive(Search)
local Build = "";
local Chars = string.split(Search, "");
for _, Char in next, Chars do
Build = Build.."["..string.upper(Char)..string.lower(Char).."]";
end;
return Build;
end;
JsLuaFunctions = {
prototype = c(function()
return setmetatable({}, {
__newindex = function(t, k, v)
rawset(JsLuaFunctions, k, (typeof(v) == "function") and c(function(...) return function(...) return v(...) end end) or c(function() return v end));
end;
});
end);
fromCharCode = c(function(i)
return string.char(i);
end);
length = c(function(i)
return string.len(i);
end);
toLowerCase = c(function(i)
return string.lower(i);
end);
toUpperCase = c(function(i)
return string.upper(i);
end);
indexOf = c(function(i)
return function(v, r)
local s = string.find(i, v, r or 0);
return s;
end;
end);
lastIndexOf = c(function(i)
return function(v, r)
local t = {};
local f = string.find(i, v, r or 0);
if (f) then
table.insert(t, f);
local f2 = f;
repeat
f2 = string.find(i, v, f2 + 1);
table.insert(t, f2);
until f2 == nil;
return t[#t];
end;
end;
end);
search = c(function(i)
return function(v)
local s = string.find(i, v);
return s;
end;
end);
slice = c(function(i)
return function(v, r)
v = v or 1;
return string.sub(i, v, r or string.len(i));
end;
end);
substring = c(function(i)
return function(v, r)
v = v or 1;
return string.sub(i, v, r or string.len(i));
end;
end);
substr = c(function(i)
return function(v, r)
v = v or 1;
return string.sub(i, v, (v - 1) + (r or (string.len(i) - v)));
end;
end);
replace = c(function(i)
return function(v, r)
local insensitive = false;
local global = false;
local case = string.find(v, "/i");
local case2 = string.find(v, "/g");
local c = 0;
if (case) then
insensitive = (case == (string.len(v) - 3)) or (case == (string.len(v) - 1));
if (insensitive) then
c = c + 2;
end;
end;
if (case2) then
global = (case2 == (string.len(v) - 3)) or (case2 == (string.len(v) - 1));
if (global) then
c = c + 2;
end;
end;
v = string.sub(v, 1, string.len(v) - c);
local o = (global and string.len(i) or 1);
local res;
a = (insensitive) and (SearchToInsensitive(v)) or v;
f = function(w)
return r or w;
end;
res = string.gsub(i, a, f, o);
return res;
end;
end);
concat = c(function(i)
return function(...)
local nt = {i, ...};
return table.concat(nt, "");
end;
end);
trim = c(function(i)
return function()
local s = string.find(i, "[^%s]");
local r = string.sub(i, s, string.len(i));
for k = 1, string.len(r) do
local c = string.sub(r, -k);
if (string.match(c, "[^%s]")) then
r = string.sub(r, 1, string.len(r) - (k - 1));
break;
end;
end;
return r;
end;
end);
padStart = c(function(i)
return function(s, r)
s = s - (string.len(i));
if (s > 0) then
for k = 1, s do
i = r .. i;
end;
end;
return i;
end;
end);
padEnd = c(function(i)
return function(s, r)
s = s - (string.len(i));
if (s > 0) then
for k = 1, s do
i = i .. r;
end;
end;
return i;
end;
end);
charAt = c(function(i)
return function(p)
return string.sub(i, p, p);
end;
end);
charCodeAt = c(function(i)
return function(p)
return string.byte(string.sub(i, p, p));
end;
end);
endsWith = c(function(i)
return function(s)
return (string.sub(i, string.len(i) + 1 - string.len(s), string.len(i)) == s);
end;
end);
includes = c(function(i)
return function(s)
return (string.find(i, s) and true or false);
end;
end);
localeCompare = c(function(i)
return function(c)
if (i == c) then
return 0;
end;
local t = {i, c};
table.sort(t, function(a, b)
return a < b;
end);
local i1, i2 = table.find(t, i), table.find(t, c);
return (i1 < i2) and -1 or 1;
end;
end);
match = c(function(i)
return function(v)
local insensitive = false;
local global = false;
local case = string.find(v, "/i");
local case2 = string.find(v, "/g");
local c = 0;
if (case) then
insensitive = (case == (string.len(v) - 3)) or (case == (string.len(v) - 1));
if (insensitive) then
c = c + 2;
end;
end;
if (case2) then
global = (case2 == (string.len(v) - 3)) or (case2 == (string.len(v) - 1));
if (global) then
c = c + 2;
end;
end;
v = string.sub(v, 1, string.len(v) - c);
local o = (global and string.len(i) or 1);
local res;
a = (insensitive) and (SearchToInsensitive(v)) or v;
f = function(w)
return r;
end;
_, res = string.gsub(i, a, f, o);
return table.create(res, v);
end;
end);
startsWith = c(function(i)
return function(c)
return (string.sub(i, 1, string.len(c)) == c);
end;
end);
valueOf = c(function(i)
return function()
return i;
end;
end);
};
function NewType(Type)
local Types = {
table = Wrap({}),
number = 0,
string = ""
}
return Types[Type];
end;
JsArrayFunctions = {
prototype = c(function()
return setmetatable({}, {
__newindex = function(t, k, v)
rawset(JsArrayFunctions, k, (typeof(v) == "function") and c(function(...) return function(...) return v(...) end end) or c(function() return v end));
end;
});
end);
length = c(function(i)
return #i;
end);
push = c(function(i)
return function(...)
local ToInsert = {...};
table.foreach(ToInsert, function(k, v)
table.insert(i, v);
end);
return i;
end;
end);
pop = c(function(i)
return function()
return table.remove(i);
end;
end);
shift = c(function(i)
return function()
return table.remove(i, 1);
end;
end);
unshift = c(function(i)
return function(n)
return table.insert(i, 1, n);
end;
end);
indexOf = c(function(i)
return function(e)
return table.find(i, e);
end;
end);
splice = c(function(i)
return function(s, e)
local rs = math.min(s, e);
local re = math.max(s, e);
local sh = 0;
local ri = {};
for k = rs, re, 1 do
local di = table.remove(i, k - sh);
table.insert(ri, di);
sh = sh + 1;
end;
return ri;
end;
end);
slice = c(function(i)
return function()
local nt = {};
setmetatable(nt, getmeta(i));
for k, v in next, i do
nt[k] = v;
end;
return nt;
end;
end);
keys = c(function(i)
return function()
local kt = {};
table.foreach(i, function(k, _)
table.insert(kt, k);
end);
return setmetatable(kt, getmeta(i));
end;
end);
from = c(function(i)
return function(e, f)
if (typeof(e) == "string") then
return setmetatable(string.split(e, ""), getmeta(i));
else
if (typeof(e) == "table") then
local nt = {};
table.foreach(e, function(k, v)
table.insert(nt, f(v));
end);
return setmetatable(nt, getmeta(i));
end;
end;
end;
end);
isArray = c(function(i)
return function(e)
return (typeof(e) == "table");
end;
end);
entries = c(function(i)
return function()
local NewIterator = {};
local Pointer = 0;
function NewIterator.next()
Pointer = Pointer + 1;
return {value = rawget(i, Pointer)};
end;
return NewIterator;
end;
end);
every = c(function(i)
return function(f)
for _, v in next, i do
if (not f(v)) then
return false;
end;
end;
return true;
end;
end);
fill = c(function(i)
return function(v, s, e)
local rv = v;
local s = s or 1;
local e = e or #i;
local rs = math.min(s, e);
local re = math.max(s, e);
for k = rs, re, 1 do
rawset(i, k, rv);
end;
return i;
end;
end);
filter = c(function(i)
return function(f)
local nt = {};
for _, v in next, i do
if (f(v)) then
table.insert(nt, v);
end;
end;
return setmetatable(nt, getmeta(i));
end;
end);
find = c(function(i)
return function(f)
for _, v in next, i do
if (f(v)) then
return v;
end;
end;
return nil;
end;
end);
findIndex = c(function(i)
return function(f)
for k, v in next, i do
if (f(v)) then
return k;
end;
end;
return -1;
end;
end);
includes = c(function(i)
return function(e)
return table.find(i, e) and true or false;
end;
end);
join = c(function(i)
return function(s)
return table.concat(i, s);
end;
end);
map = c(function(i)
return function(f)
local nt = {};
table.foreach(i, function(k, v)
nt[k] = f(v);
end);
return setmetatable(nt, getmeta(i));
end;
end);
reduce = c(function(i)
return function(f, s, k)
local a = s and NewType(s) or NewType(typeof(i[1]));
for p, v in next, i do
if (p >= (k or 1)) then
a = f(a, v);
end;
end;
return a;
end;
end);
reduceRight = c(function(i)
return function(f, s, k)
local a = s or NewType(typeof(i[#i]));
for p = #i, 1, -1 do
local v = i[p];
if (p <= (k or #i)) then
a = f(a, v);
end;
end;
return a;
end;
end);
concat = c(function(i)
return function(t)
local nt = {unpack(i)};
table.foreach(t, function(_, v)
table.insert(nt, v);
end);
return setmetatable(nt, getmeta(i));
end;
end);
reverse = c(function(i)
return function()
local nt = i.slice();
for p = 1, math.floor(#i/2) do
local k = #i - p + 1;
nt[p], nt[k] = i[k], i[p];
end;
return setmetatable(nt, getmeta(i));
end;
end);
some = c(function(i)
return function(f)
for _, v in next, i do
if (f(v)) then
return true;
end;
end;
return false;
end;
end);
toString = c(function(i)
return function()
return table.concat(i, ",");
end;
end);
};
function SetupJsLua()
local StringObjectTable = string;
local GameMetaTable = getmeta(game);
local StringMetaTable = getmeta("");
setreadonly(StringObjectTable, false);
setreadonly(GameMetaTable, false);
setreadonly(StringMetaTable, false);
getgenv().jslua = TableObjectTable;
local OldIndex = StringMetaTable.__index;
if (StringObjectTable) then
for FuncName, Function in next, JsLuaFunctions do
StringObjectTable[FuncName] = Function;
end;
end;
StringMetaTable.__index = function(...)
local Args = {...};
local StringToPass = Args[1];
local FunctionToPass = Args[2];
if (checkcaller()) then
if (typeof(FunctionToPass) == "number") then
return JsLuaFunctions.charAt(StringToPass)(FunctionToPass);
end;
if (FunctionToPass) then
local JsLuaFunction = JsLuaFunctions[FunctionToPass];
if (JsLuaFunction) then
return JsLuaFunction(StringToPass);
end;
end;
end;
return string[FunctionToPass];
end;
getgenv().Wrap = function(Array)
local Array = Array or {};
function WrapEntireTable(t)
Wrap(t);
for _, v in next, t do
if (typeof(v) == "table") then
WrapEntireTable(v);
end;
end;
end;
for _, v in next, Array do
if (typeof(v) == "table") then
WrapEntireTable(v);
end;
end;
setmetatable(Array, {
__index = function(t, k)
if (typeof(k) == "number") then
return rawget(t, k);
end;
local JsFunction = rawget(JsArrayFunctions, k);
if (JsFunction) then
return JsFunction(t);
else
local NormalFunction = rawget(table, k);
if (NormalFunction) then
return function(...)
return NormalFunction(t, ...);
end;
else
return nil;
end;
end;
end;
__tostring = function(t)
local BuildString = "\n{\n\t";
for k, v in next, t do
BuildString = BuildString..k..": ";
local IsString = (typeof(v) == "string");
local IsLastElement = (k == #t);
if (IsString) then
BuildString = BuildString..'"';
end;
BuildString = BuildString..tostring(v);
if (IsString) then
BuildString = BuildString..'"';
end;
if (not IsLastElement) then
BuildString = BuildString..",\n\t";
end;
end;
BuildString = BuildString.."\n}"
return BuildString;
end;
})
return Array;
end;
end;
if (getmeta) then
if (notif) then
SendNotification({
Title = "js.lua",
Text = "Loading libraries.",
Duration = 1
});
else
warn("[js.lua]: Loading libraries.");
end;
SetupJsLua();
warn("[js.lua]: Loaded libraries.");
else
if (notif) then
SendNotification({
Title = "js.lua",
Text = "Your exploit does not support metatables.",
Duration = 1
});
else
warn("[js.lua]: Your exploit does not support metatables.");
end;
end;
end;