forked from NoTwistedHere/Roblox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRemoteSpy.lua
805 lines (617 loc) · 25.8 KB
/
RemoteSpy.lua
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
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
--[[
Report any bugs, issues and detections to me if you don't mind (NoTwistedHere#6703)
]]
if Branch or not FormatTable then
loadstring(game:HttpGet("https://raw.githubusercontent.com/NoTwistedHere/Roblox/" .. (Branch or "main") .. "/FormatTable.lua"))()
end
local NUB = loadstring(game:HttpGet("https://raw.githubusercontent.com/NoTwistedHere/Roblox/" .. (Branch or "main") .. "/NoUpvalueHook.lua"))()
getgenv().WriteToFile = WriteToFile or true
getgenv().RobloxConsole = RobloxConsole or false
getgenv().GetCallerV2 = GetCallerV2 or false --// BETA - You are more vulnerable to detections!
getgenv().RemoteSpyEnabled = RemoteSpyEnabled or true
getgenv().GenerateCode = GenerateCode or true
getgenv().Enabled = Enabled or {
BindableEvent = false;
BindableFunction = false;
RemoteEvent = true;
RemoteFunction = true;
OnClientInvoke = true;
OnClientEvent = true;
OnInvoke = false;
Event = false;
}
local Events = {
BindableEvent = "Event";
BindableFunction = "OnInvoke";
RemoteEvent = "OnClientEvent";
}
local Methods = {
BindableEvent = "Fire";
BindableFunction = "Invoke";
RemoteEvent = "FireServer";
RemoteFunction = "InvokeServer";
}
local Hooks = {}
local Stacks, Source = {}, getinfo(1).source
local Directory, FileName, FileType = "RemoteSpyLogs/", ("RemoteSpy Logs [%s_%s]"):format(game.PlaceId, game.PlaceVersion), ".lua"
local HttpService = game:GetService("HttpService")
local isexecutorfunction = isexecutorfunction or is_synapse_function or isexecutorclosure or isourclosure or function(f) return getinfo(f, "s").source:find("@") and true or false end
local getthreadidentity = getthreadidentity or syn.get_thread_identity
local setthreadidentity = setthreadidentity or syn.set_thread_identity
local isvalidlevel = debug.isvalidlevel or debug.validlevel or function(s) local k = pcall(function() return getinfo(s + 3) end) return k end
local hookmetamethod = hookmetamethod or newcclosure(function(Object, Metamethod, Function)
local Metatable = assert(getrawmetatable(Object), ("bad argument #1 (%s does not have a metatable)"):format(tostring(typeof(Object))))
local Original = assert(rawget(Metatable, Metamethod), "bad argument #2 (metamethod doesn't exist)")
assert(type(Function) == "function", "bad argument #3 (function expected)")
return hookfunction(Original, Function)
end)
if not isexecutorfunction or not getinfo or not hookmetamethod or not setthreadidentity then
game:GetService("Players").LocalPlayer:Kick("Unsupported exploit")
return;
end
if not isfolder(Directory) then
makefolder(Directory)
end
if isfile(Directory..FileName..FileType) then
local Name, Count = "", 0
repeat
Count += 1
Name = FileName..(" (%d)"):format(Count)
until not isfile(Directory..Name..FileType)
FileName = Name
end
if WriteToFile then
writefile(Directory..FileName..FileType, "")
end
local function ConvertCodepoints(OriginalString) --// cba to rename it
if OriginalString:match("[^%a%c%d%l%p%s%u%x]") then
local Utf8String = "utf8.char("
if not pcall(function() for i, v in utf8.codes(OriginalString) do Utf8String ..= ("%s%s"):format(i > 1 and ", " or "", v) end end) then
local String = ""
for i = 1, #OriginalString do
String ..= "\\" .. string.byte(OriginalString, i, i)
end
return "\""..String.."\""
end
return Utf8String ..")"
end
return "\""..OriginalString.."\""
end
local function Stringify(String)
if type(String) ~= "string" then
return;
end
return ConvertCodepoints(String:gsub("\\", "\\\\"):gsub("\"", "\\\""):gsub("\\(d+)", function(Char) return "\\"..Char end):gsub("[%c%s]", function(Char) if Char ~= " " then return "\\"..(utf8.codepoint(Char) or 0) end end))
end
local function TrueString(String)
if type(String) ~= "string" then
return false
end
return (string.split(String, "\0"))[1]
end
local function Ignore(self, ...)
if getgenv().Ignore then
return getgenv().Ignore(self, ...)
end
return false
end
local function Timestamp()
local Time = DateTime.now()
return ("%s/%s/%s %s:%s:%s:%s"):format(Time:FormatUniversalTime("D", "en-us"), Time:FormatUniversalTime("M", "en-us"), Time:FormatUniversalTime("YYYY", "en-us"), Time:FormatUniversalTime("H", "en-us"), Time:FormatUniversalTime("m", "en-us"), Time:FormatUniversalTime("s", "en-us"), Time:FormatUniversalTime("SSS", "en-us"))--// broken?
end
local function Save(Content)
if WriteToFile then
if not isfile(Directory..FileName..FileType) then
writefile(Directory..FileName..FileType, Content)
end
return appendfile(Directory..FileName..FileType, Content)
end
(RobloxConsole and print or rconsoleprint)(Content)
end
local function IsService(Object)
local Success, Response = pcall(function()
return game:GetService(Object.ClassName)
end)
return Success and Response
end
local function Convert(OriginalString)
local String = ""
local OriginalString = OriginalString:gsub("\\", "\\\\"):gsub("\"", "\\\""):gsub("%c", function(Char) return "\\"..string.byte(Char) end)
for i = 1, #OriginalString do
local Byte = string.byte(OriginalString, i, i)
if Byte <= 126 and Byte >= 33 then
String ..= string.char(Byte)
continue;
end
String ..= "\\" .. Byte
end
return String
end
local function GetName(Name)
if tonumber(Name:sub(1, 1)) or Name:match("([0-9a-zA-Z]*)") ~= Name then
if Name:match("\0") then
return (":FindFirstChild(\"%s\")"):format(Convert(Name))
end
return ("[\"%s\"]"):format(Convert(Name))
end
return (".%s"):format(Name)
end
local function GetPath(Object, Sub)
local Path = GetName(Object.Name):reverse()
local Parent = Object.Parent
if Object == game then
Path = ("game"):reverse()
elseif not Sub and IsService(Object) then
Path = (":GetService(\"%s\")"):format(Object.ClassName):reverse()
Path ..= GetPath(Parent, true)
elseif Parent == game then
Path = ("game"):reverse()
elseif Parent and IsService(Parent) then
Path ..= (":GetService(\"%s\")"):format(Parent.ClassName):reverse()
Path ..= GetPath(Parent, true)
elseif Parent then
Path ..= GetPath(Parent, true)
elseif Object ~= game then
Path ..= ("nil"):reverse()
end
if Sub then
return Path
end
return Path:reverse()
end
local function FixArgS(Arguments)
if type(Arguments["#"]) ~= "number" or #Arguments == Arguments["#"] then
return ""
end
local Extra = ", "
for i = #Arguments, Arguments["#"] do
Extra = "nil, "
end
return Extra:sub(0, -3)
end
local function GenerateC(self, Method, Arguments)
local R = FormatTable(Arguments or {}, {NoIndentation = true, OneLine = true, NoComments = true, IgnoreNumberIndex = true, GenerateScript = true})
if type(R) == "string" then
return R
end
local Result = tostring(R[1])
Result ..= tostring(self) .. ":" .. tostring(Method) .. "(" .. tostring(R[2]) .. FixArgS(Arguments) .. ")" --// I can't be bothered to fix shitty names and stuff
return Result
end
local function FixGenArgs(Args) --// Simple
Args["#"] = nil
return Args
end
local function Log(Arguments, NewThread)
local function Main()
xpcall(function()
local GeneratedCode = GenerateCode and Arguments.Info and GenerateC(Arguments.What, Arguments.RawMethod or Arguments.Method, FixGenArgs(Arguments.Arguments)) or "Disabled"
for i, v in next, Arguments do
if type(v) == "string" and i ~= "What" then
Arguments[i] = Stringify(v)
elseif type(v) == "table" then
if i == "Traceback" then
Arguments[i] = FormatTable(v, {NoComments = true, IgnoreNumberIndex = true, NumLength = true})
continue;
elseif i == "Arguments" then
Arguments[i] = FormatTable(v, {NumLength = true})
continue;
end
Arguments[i] = FormatTable(v)
end
end
if Arguments.FunctionInfo then
return Save(("What: %s\nMethod: %s\nTo Script: %s\nTimestamp: %s\nArguments: %s\nReturn: %s\nInfo: %s\nFunctionInfo: %s\nTraceback: %s\nGenerated Code:\n%s\n"):format(Arguments.What, Arguments.Method, Arguments.Script, Timestamp(), Arguments.Arguments, Arguments.Response, Arguments.Info, Arguments.FunctionInfo, Arguments.Traceback, GeneratedCode))
elseif Arguments.Response then
return Save(("What: %s\nMethod: %s\nFrom Script: %s\nTimestamp: %s\nArguments: %s\nReturn: %s\nInfo: %s\nTraceback: %s\nGenerated Code:\n%s\n"):format(Arguments.What, Arguments.Method, Arguments.Script, Timestamp(), Arguments.Arguments, Arguments.Response, Arguments.Info, Arguments.Traceback, GeneratedCode))
elseif not Arguments.Info then
return Save(("What: %s\nMethod: %s\nTimestamp: %s\nArguments: %s\n"):format(Arguments.What, Arguments.Method, Timestamp(), Arguments.Arguments))
end
Save(("What: %s\nMethod: %s\nFrom Script: %s\nTimestamp: %s\nArguments: %s\nInfo: %s\nTraceback: %s\nGenerated Code:\n%s\n"):format(Arguments.What, Arguments.Method, Arguments.Script, Timestamp(), Arguments.Arguments, Arguments.Info, Arguments.Traceback, GeneratedCode))
end, function(e)
Save(("ERROR: %s\nTraceback: %s"):format(e, debug.traceback()))
end)
end
if NewThread then --// There's a reason as to why I try and avoid task.spawn, but I'm not trying to release semi-bypasses
return task.spawn(Main)
end
return Main()
end
local function ArgGuard(self, ...)
if typeof(self) ~= "Instance" then
return false
end
local Arguments = {...}
--[[if self.ClassName:match("Function") and #Arguments > 7995 then
return false
end]]
local Checked = {}
local Check; Check = function(Arguments)
for i, v in next, Arguments do
if type(v) == "table" then
if table.find(v, v) or Checked[v] then
return false
end
Checked[v] = true
local R = Check(v)
if not R then
return R
end
end
end
return true
end
return Check(Arguments)
end
local function FixTable(Table)
local Yeah = {}
for i, v in next, Table do
table.insert(Yeah, v)
end
return Yeah
end
local function V2CheckArguments(Arguments)
--[[if type(Arguments) ~= "table" then
return false
elseif not GetCallerV2 then]]
return {false, {}, Arguments}
--[[end
local Traceback, Info = {};
for i, v in next, Arguments do
if type(v) == "string" and Stacks[v] then
local Stack = Stacks[v]
for _, v2 in next, Stack[2] do
table.insert(Traceback, v2)
end
Info = Stack[1]
Arguments[i] = nil
end
end
return {Info, Traceback, FixTable(Arguments)}]]
end
local function GetCaller(Arguments)
local Traceback, FirstInfo = {};
for i = 1, 16380 do
local Info = isvalidlevel(i) and getinfo(i)
if not Info then
local NewInfo = FirstInfo or getinfo(i - 1)
if syn and syn.oth then
table.remove(Traceback, 1)
end
--[[if GetCallerV2 then
local ValidArgs = V2CheckArguments(Arguments)
if ValidArgs then
for _i, v in next, ValidArgs[2] do
table.insert(Traceback, v)
end
NewInfo = ValidArgs[1] or NewInfo
return NewInfo, Traceback, ValidArgs[3]
end
end]]
return NewInfo, Traceback, Arguments
end
if Info.source ~= Source then
table.insert(Traceback, ("%s:%d%s"):format(Info.short_src, Info.currentline, Info.name and Info.name ~= "" and " function " .. Info.name or ""))
end
if Info.what ~= "C" and not isexecutorfunction(Info.func) and not FirstInfo then
FirstInfo = Info
end
end
end
local function SortArguments(self, ...)
local Args = {...}
if select("#", ...) ~= #Args then
Args["#"] = select("#", ...)
end
return self, Args
end
local function Unpack(Table, ...)
local Final = "";
if Table["#"] then
Final = "return " .. ("nil,"):rep(Table["#"] - #Table):sub(0, -2)
end
return unpack(Table), loadstring(Final)
end
local function IsValidMethod(ClassName, Method)
return Methods[ClassName] == Method:sub(1, 1):upper()..Method:sub(2, #Method)
end
--[[if GetCallerV2 then
local IsNotTraceable = {
getrenv().coroutine.create,
getrenv().coroutine.wrap,
getrenv().delay,
getrenv().task.spawn,
getrenv().task.defer,
getrenv().task.delay,
getrenv().spawn,
getrenv().pcall, --// is traceable
getrenv().xpcall --// is traceable
}
local function GenerateGUID(Info, Traceback)
local GUID = HttpService:GenerateGUID(false)
Stacks[GUID] = {Info, Traceback}
return GUID
end
local function HookFunc(Func)
local Old; Old = hookfunction(Func, function(...)
local _Args = {...}
if #_Args == 0 then
return Old(...)
end
local Arguments = GetCallerV2 and V2CheckArguments(_Args)[3] or _Args
local Call = table.remove(Arguments, 1)
if type(Call) ~= "function" then
return Old(...)
end
local Info, Traceback, Arguments = GetCaller({...})
local Edited = false
if Hooks[Call] then
Edited = true
table.insert(Arguments, 2, GenerateGUID(Info, Traceback))
end
for i, v in next, Arguments do
if not IsNotTraceable[v] and not Hooks[v] and not Stacks[v] then
break;
elseif Hooks[v] then
Edited = true
table.insert(Arguments, i + 1, GenerateGUID(Info, Traceback))
--Call = Arguments[i - 1] or Call
continue;
end
end
if Edited then
return Old(Call, unpack(Arguments))
end
return Old(Call, ...)
end)
end
local function HookFuncThread(Func)
local Old; Old = hookfunction(Func, function(...)
local _Args = {...}
if #_Args == 0 then
return Old(...)
end
local Arguments = GetCallerV2 and V2CheckArguments(_Args)[3] or _Args
local Call = table.remove(Arguments, 1)
if type(Call) ~= "function" and type(Call) ~= "thread" then
return Old(...)
end
local Info, Traceback, Arguments = GetCaller({...})
local Edited = false
if Hooks[Call] then
Edited = true
table.insert(Arguments, 2, GenerateGUID(Info, Traceback))
end
for i, v in next, Arguments do
if not IsNotTraceable[v] and not Hooks[v] and not Stacks[v] then
break;
elseif Hooks[v] then
Edited = true
table.insert(Arguments, i + 1, GenerateGUID(Info, Traceback))
--Call = Arguments[i - 1] or Call
continue;
end
end
if Edited then
return Old(Call, unpack(Arguments))
end
return Old(Call, ...)
end)
end
local OldS; OldS = hookfunction(spawn, function(...) --// I'm sorry Melancholy, this is a quick patch before I go to work
local _Args = {...}
if #_Args == 0 then
return OldS(...)
end
local Arguments = GetCallerV2 and V2CheckArguments(_Args)[3] or _Args
local Call = table.remove(Arguments, 1)
if type(Call) ~= "function" and type(Call) ~= "thread" and typeof(Call) ~= "userdata" and (not getrawmetatable(Call) or not getrawmetatable(Call).__call) then
return OldS(Call, unpack(Arguments))
end
local Info, Traceback, Arguments = GetCaller({...})
local Edited = false
if Hooks[Call] then
Edited = true
table.insert(Arguments, 2, GenerateGUID(Info, Traceback))
end
for i, v in next, Arguments do
if not IsNotTraceable[v] and not Hooks[v] and not Stacks[v] then
break;
elseif Hooks[v] then
Edited = true
table.insert(Arguments, i + 1, GenerateGUID(Info, Traceback))
--Call = Arguments[i - 1] or Call
continue;
end
end
if Edited then
return OldS(Call, unpack(Arguments))
end
return OldS(Call, ...)
end)
HookFunc(getrenv().coroutine.create)
HookFunc(getrenv().coroutine.wrap)
HookFunc(getrenv().delay)
HookFuncThread(getrenv().task.spawn)
HookFuncThread(getrenv().task.defer)
HookFuncThread(getrenv().task.delay)
end]]
local function ReturnArguments(Arguments, ...)
--[[if GetCallerV2 and #Arguments <= 7995 then
return unpack(Arguments)
end]]
return ...
end
local function GetSource()
if syn and syn.oth then
return getinfo(2).source
end
return getinfo(3).source
end
for Name, Method in next, Methods do
local Func = Instance.new(Name)[Method]
local Original; Original = hookfunction(Func, function(...)
local self, OArguments = SortArguments(...)
--OArguments = V2CheckArguments(OArguments)[3]
if GetSource() == Source then
return Original(...)
end
local MainRes;
local function FuckYou(...)
local Old = getthreadidentity()
setthreadidentity(7)
OArguments["#"] = select("#", ...) - 1
if RemoteSpyEnabled and #OArguments <= 7995 and ArgGuard(...) and Enabled[self.ClassName] and not Ignore(...) then
local Info, Traceback, Arguments = GetCaller({...}) --// Because the stack trace gets removed from _Args
local Thread = coroutine.running()
if self.ClassName:match("Function") then --// Events return nil so what's the point in yielding? just leads to retarded detections
local BindableEvent = Instance.new("BindableEvent")
local Response1 = {}
task.spawn(function(...)
local Success, Response = SortArguments(pcall(Original, ...))
MainRes = Response
--[[if not Success then
return coroutine.resume(Thread, unpack(Response))
end]]
Log({self = self, What = GetPath(self), RawMethod = Method, Method = Method .. " (Raw)", Script = Info.short_src, Arguments = OArguments, Info = Info, Response = Response, Traceback = Traceback})
task.spawn(function() --// seems pointless, ik
BindableEvent.Event:Wait()
BindableEvent:Destroy()
end)
Response1 = Response
BindableEvent:Fire(Unpack(Response))
end, Unpack(Arguments))
return true, Response1 and Unpack(Response1) or BindableEvent.Event:Wait()
end
Log({self = self, What = GetPath(self), RawMethod = Method, Method = Method .. " (Raw)", Script = Info.short_src, Arguments = OArguments, Info = Info, Traceback = Traceback}, true)
end
setthreadidentity(Old)
end
local Success, IsResponse, Response = xpcall(FuckYou, function(e)
return ("ERROR: %s\nTraceback: %s"):format(tostring(e), debug.traceback())
end, ...)
if Success and IsResponse then
return Response
elseif not Success then
coroutine.wrap(Save, IsResponse)
end
if MainRes then
return Unpack(MainRes)
end
return Original(...) --unpack(Response)
end)
Hooks[Func] = Original
end
local OldNamecall; OldNamecall = hookmetamethod(game, "__namecall", function(...)
local self, OArguments = SortArguments(...)
local Method = getnamecallmethod()
--OArguments = V2CheckArguments(OArguments)[3]
if GetSource().source == Source then
return OldNamecall(...)
end
local MainRes;
local function FuckYou(...)
local Old = getthreadidentity()
setthreadidentity(7)
OArguments["#"] = select("#", ...) - 1
if RemoteSpyEnabled and #OArguments <= 7995 and ArgGuard(...) and Enabled[self.ClassName] and IsValidMethod(self.ClassName, Method) and not Ignore(...) then
local Info, Traceback, Arguments = GetCaller({...})
local Thread = coroutine.running()
if self.ClassName:match("Function") then --// Events return nil so what's the point in yielding? just leads to retarded detections
local BindableEvent = Instance.new("BindableEvent")
local Response1 = {}
task.spawn(function(...)
setnamecallmethod(Method)
local Success, Response = SortArguments(pcall(OldNamecall, ...))
MainRes = Response
--[[if not Success then
return coroutine.resume(Thread, unpack(Response))
end]]
Log({self = self, What = GetPath(self), Method = Method, Script = Info.short_src, Arguments = OArguments, Info = Info, Response = Response, Traceback = Traceback})
task.spawn(function() --// seems pointless, ik
BindableEvent.Event:Wait()
BindableEvent:Destroy()
end)
Response1 = Response
BindableEvent:Fire(Unpack(Response))
end, ...)
return true, Response1 and Unpack(Response1) or BindableEvent.Event:Wait()
end
Log({self = self, What = GetPath(self), Method = Method, Script = Info.short_src, Arguments = OArguments, Info = Info, Traceback = Traceback}, true)
setnamecallmethod(Method)
end
setthreadidentity(Old)
end
local Success, IsResponse, Response = xpcall(FuckYou, function(e)
return ("ERROR: %s\nTraceback: %s"):format(tostring(e), debug.traceback())
end, ...)
if Success and IsResponse then
return Response
elseif not Success then
coroutine.wrap(Save, IsResponse)
end
if MainRes then
return Unpack(MainRes)
end
--[[if typeof(self) == "Instance" and IsValidMethod(self.ClassName, Method) then
return OldNamecall(ReturnArguments(Arguments, ...))
end]]
return OldNamecall(...) --unpack(Response)
end)
local function IsValid(Parsed, Checked)
local Checked = Checked or {}
table.insert(Checked, Parsed)
if type(Parsed) == "function" then
return true
elseif typeof(Parsed) == "userdata" and getrawmetatable(Parsed) then
return IsValid(rawget(getrawmetatable(Parsed), "__call"), Checked)
end
return false
end
local function IsValidIndex(Index)
return rawequal(Index, "OnClientInvoke") or rawequal(Index, "onClientInvoke")
end
local function Listen(Instance, Event)
if Instance:IsA("RemoteFunction") or Instance:IsA("BindableFunction") then
return;
end
Instance[Event]:Connect(function(...)
if Enabled[Event] then
Log({self = Instance, What = GetPath(Instance), Method = Event, Arguments = {...}})
end
end)
end
game.DescendantAdded:Connect(function(Obj)
if Methods[Obj.ClassName] and Events[Obj.ClassName] then
Listen(Obj, Events[Obj.ClassName])
end
end)
for i, v in next, game:GetDescendants() do
if Methods[v.ClassName] and Events[v.ClassName] then
Listen(v, Events[v.ClassName])
end
end
for i, v in next, getnilinstances() do
if Methods[v.ClassName] and Events[v.ClassName] then
Listen(v, Events[v.ClassName])
end
end
local OldNewIndex; OldNewIndex = hookmetamethod(game, "__newindex", function(...)
local self, Arguments = SortArguments(...)
if ArgGuard(...) and self:IsA("RemoteFunction") and IsValidIndex(TrueString(Arguments[1])) and pcall(IsValid, Arguments[2]) then
local Name, ClassName = GetPath(self), self.ClassName
local Function = Arguments[2]
local FunctionInfo = getinfo(Function)
local Info, Traceback = GetCaller(...)
local Old; Old = hookfunction(Function, NUB([=[local Success, Response = <<pcall>>(<<Old>>, ...)
if <<getgenv>>().RemoteSpyEnabled and <<getgenv>>().Enabled["OnClientInvoke"] then
Log({self = <<self>>, What = <<Name>>, Method = "InvokeClient", Script = <<Info>>.short_src, Arguments = {...}, FunctionInfo = <<FunctionInfo>>, Info = <<Info>>, Response = not Success and "Script Error: "..Response or Response, Traceback = <<Traceback>>})
end
if not Success then
error(Response, 2)
return;
end
return unpack(Response)]=], {Old = Old, pcall = pcall, getgenv = getgenv, Name = Name, self = self, Info = Info, FunctionInfo = FunctionInfo, Traceback = Traceback}))
end
return OldNewIndex(...)
end)