-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATGSpy.lua
More file actions
1300 lines (1228 loc) · 59.6 KB
/
ATGSpy.lua
File metadata and controls
1300 lines (1228 loc) · 59.6 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
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
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- SimpleSpy v2.2 (Refactored UI)
-- ปรับ UI ให้ดูดี ใช้งานง่ายกว่าเดิม เหมาะกับยุคใหม่มากขึ้น
-- คง logic ต่างๆ ไว้ครบถ้วน
-- ตรวจสอบและปิด instance เก่าของ SimpleSpy
if _G.SimpleSpyExecuted and type(_G.SimpleSpyShutdown) == "function" then
print(pcall(_G.SimpleSpyShutdown))
end
local Players = game:GetService("Players")
local CoreGui = game:GetService("CoreGui")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local ContentProvider = game:GetService("ContentProvider")
local TextService = game:GetService("TextService")
local Highlight = loadstring(game:HttpGet("https://raw.githubusercontent.com/ATGFAIL/ATGRemoteSpy/main/Highlight.lua"))()
-- สร้าง ScreenGui หลัก
local SimpleSpy2 = Instance.new("ScreenGui")
SimpleSpy2.Name = "SimpleSpy2"
SimpleSpy2.ResetOnSpawn = false
-- สร้าง UI ใหม่ด้วย Frame หลัก
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Parent = SimpleSpy2
MainFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40) -- สีพื้นหลังหลัก
MainFrame.BorderSizePixel = 0
MainFrame.Position = UDim2.new(0, 500, 0, 200)
MainFrame.Size = UDim2.new(0, 500, 0, 300)
MainFrame.Active = true
MainFrame.Draggable = true
MainFrame.Selectable = true
-- สร้าง Top Bar
local TopBar = Instance.new("Frame")
TopBar.Name = "TopBar"
TopBar.Parent = MainFrame
TopBar.BackgroundColor3 = Color3.fromRGB(30, 30, 30) -- สีเข้มขึ้นเล็กน้อย
TopBar.BorderSizePixel = 0
TopBar.Size = UDim2.new(1, 0, 0, 30)
-- ชื่อ SimpleSpy
local TitleLabel = Instance.new("TextLabel")
TitleLabel.Name = "TitleLabel"
TitleLabel.Parent = TopBar
TitleLabel.BackgroundTransparency = 1
TitleLabel.Size = UDim2.new(0, 100, 1, 0)
TitleLabel.Position = UDim2.new(0, 10, 0, 0)
TitleLabel.Font = Enum.Font.GothamBold
TitleLabel.Text = "SimpleSpy v2.2"
TitleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
TitleLabel.TextScaled = true
TitleLabel.TextSize = 14
TitleLabel.TextXAlignment = Enum.TextXAlignment.Left
-- ปุ่ม Toggle Method (ใช้ Icon ที่ดูทันสมัยกว่า)
local ToggleMethodButton = Instance.new("TextButton")
ToggleMethodButton.Name = "ToggleMethodButton"
ToggleMethodButton.Parent = TopBar
ToggleMethodButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
ToggleMethodButton.BorderSizePixel = 0
ToggleMethodButton.Size = UDim2.new(0, 25, 0, 25)
ToggleMethodButton.Position = UDim2.new(1, -80, 0, 2.5)
ToggleMethodButton.Font = Enum.Font.Gotham
ToggleMethodButton.Text = "M"
ToggleMethodButton.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleMethodButton.TextScaled = true
ToggleMethodButton.TextSize = 14
-- ปุ่ม Minimize
local MinimizeButton = Instance.new("TextButton")
MinimizeButton.Name = "MinimizeButton"
MinimizeButton.Parent = TopBar
MinimizeButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
MinimizeButton.BorderSizePixel = 0
MinimizeButton.Size = UDim2.new(0, 25, 0, 25)
MinimizeButton.Position = UDim2.new(1, -50, 0, 2.5)
MinimizeButton.Font = Enum.Font.Gotham
MinimizeButton.Text = "-"
MinimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
MinimizeButton.TextScaled = true
MinimizeButton.TextSize = 14
-- ปุ่ม Close
local CloseButton = Instance.new("TextButton")
CloseButton.Name = "CloseButton"
CloseButton.Parent = TopBar
CloseButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) -- สีแดงสำหรับปุ่มปิด
CloseButton.BorderSizePixel = 0
CloseButton.Size = UDim2.new(0, 25, 0, 25)
CloseButton.Position = UDim2.new(1, -20, 0, 2.5)
CloseButton.Font = Enum.Font.Gotham
CloseButton.Text = "X"
CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseButton.TextScaled = true
CloseButton.TextSize = 14
-- สร้าง Content Frame (สำหรับแยกส่วน Left และ Right)
local ContentFrame = Instance.new("Frame")
ContentFrame.Name = "ContentFrame"
ContentFrame.Parent = MainFrame
ContentFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 35) -- สีพื้นหลังด้านใน
ContentFrame.BorderSizePixel = 0
ContentFrame.Position = UDim2.new(0, 0, 0, 30)
ContentFrame.Size = UDim2.new(1, 0, 1, -30)
-- สร้าง Left Panel (Log List)
local LeftPanel = Instance.new("Frame")
LeftPanel.Name = "LeftPanel"
LeftPanel.Parent = ContentFrame
LeftPanel.BackgroundColor3 = Color3.fromRGB(30, 30, 30) -- สีพื้นหลังของบันทึก
LeftPanel.BorderSizePixel = 0
LeftPanel.Size = UDim2.new(0, 150, 1, 0)
-- ScrollingFrame สำหรับ Log List
local LogList = Instance.new("ScrollingFrame")
LogList.Name = "LogList"
LogList.Parent = LeftPanel
LogList.BackgroundColor3 = Color3.fromRGB(40, 40, 40) -- สีของแต่ละ log
LogList.BackgroundTransparency = 0
LogList.BorderSizePixel = 0
LogList.Position = UDim2.new(0, 5, 0, 5)
LogList.Size = UDim2.new(1, -10, 1, -10)
LogList.CanvasSize = UDim2.new(0, 0, 0, 0)
LogList.ScrollBarThickness = 4
LogList.ScrollBarImageColor3 = Color3.fromRGB(60, 60, 60)
-- UIListLayout สำหรับจัดเรียง Log
local UIListLayout = Instance.new("UIListLayout")
UIListLayout.Parent = LogList
UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
UIListLayout.Padding = UDim.new(0, 2)
-- สร้าง Right Panel (Code Box และ Function Buttons)
local RightPanel = Instance.new("Frame")
RightPanel.Name = "RightPanel"
RightPanel.Parent = ContentFrame
RightPanel.BackgroundColor3 = Color3.fromRGB(35, 35, 35) -- สีพื้นหลังด้านขวา
RightPanel.BorderSizePixel = 0
RightPanel.Position = UDim2.new(0, 150, 0, 0)
RightPanel.Size = UDim2.new(1, -150, 1, 0)
-- Code Box
local CodeBoxFrame = Instance.new("Frame")
CodeBoxFrame.Name = "CodeBoxFrame"
CodeBoxFrame.Parent = RightPanel
CodeBoxFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25) -- สีเข้มสำหรับ Code Box
CodeBoxFrame.BorderSizePixel = 0
CodeBoxFrame.Position = UDim2.new(0, 5, 0, 5)
CodeBoxFrame.Size = UDim2.new(1, -10, 0, 150) -- ความสูง 150
local CodeBox = Instance.new("TextBox")
CodeBox.Name = "CodeBox"
CodeBox.Parent = CodeBoxFrame
CodeBox.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
CodeBox.BorderSizePixel = 0
CodeBox.Size = UDim2.new(1, 0, 1, 0)
CodeBox.Font = Enum.Font.Code
CodeBox.Text = "-- Script will appear here --"
CodeBox.TextColor3 = Color3.fromRGB(220, 220, 220)
CodeBox.TextSize = 12
CodeBox.TextXAlignment = Enum.TextXAlignment.Left
CodeBox.TextYAlignment = Enum.TextYAlignment.Top
CodeBox.ClearTextOnFocus = false
CodeBox.MultiLine = true
CodeBox.Selectable = true
-- ScrollingFrame สำหรับ Function Buttons
local FunctionButtonFrame = Instance.new("Frame")
FunctionButtonFrame.Name = "FunctionButtonFrame"
FunctionButtonFrame.Parent = RightPanel
FunctionButtonFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) -- สีพื้นหลังของปุ่ม
FunctionButtonFrame.BorderSizePixel = 0
FunctionButtonFrame.Position = UDim2.new(0, 5, 0, 160)
FunctionButtonFrame.Size = UDim2.new(1, -10, 1, -165) -- ความสูงที่เหลือ
local ScrollingFrame = Instance.new("ScrollingFrame")
ScrollingFrame.Name = "ScrollingFrame"
ScrollingFrame.Parent = FunctionButtonFrame
ScrollingFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
ScrollingFrame.BackgroundTransparency = 1
ScrollingFrame.BorderSizePixel = 0
ScrollingFrame.Size = UDim2.new(1, 0, 1, 0)
ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
ScrollingFrame.ScrollBarThickness = 4
ScrollingFrame.ScrollBarImageColor3 = Color3.fromRGB(60, 60, 60)
-- UIGridLayout สำหรับจัดเรียง Function Buttons
local UIGridLayout = Instance.new("UIGridLayout")
UIGridLayout.Parent = ScrollingFrame
UIGridLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
UIGridLayout.CellPadding = UDim2.new(0, 2, 0, 2)
UIGridLayout.CellSize = UDim2.new(0, 70, 0, 30)
-- Template สำหรับ Function Button
local FunctionTemplate = Instance.new("TextButton")
FunctionTemplate.Name = "FunctionTemplate"
FunctionTemplate.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
FunctionTemplate.BorderSizePixel = 0
FunctionTemplate.Size = UDim2.new(0, 70, 0, 30)
FunctionTemplate.Font = Enum.Font.Gotham
FunctionTemplate.Text = "Button"
FunctionTemplate.TextColor3 = Color3.fromRGB(255, 255, 255)
FunctionTemplate.TextScaled = true
FunctionTemplate.TextSize = 14
FunctionTemplate.Visible = false
-- Template สำหรับ Remote Log Entry
local RemoteTemplate = Instance.new("TextButton")
RemoteTemplate.Name = "RemoteTemplate"
RemoteTemplate.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
RemoteTemplate.BorderSizePixel = 0
RemoteTemplate.Size = UDim2.new(1, -10, 0, 30)
RemoteTemplate.Position = UDim2.new(0, 5, 0, 5)
RemoteTemplate.Font = Enum.Font.Gotham
RemoteTemplate.Text = "Remote Name"
RemoteTemplate.TextColor3 = Color3.fromRGB(255, 255, 255)
RemoteTemplate.TextScaled = true
RemoteTemplate.TextSize = 14
RemoteTemplate.Visible = false
-- Tooltip Frame
local ToolTip = Instance.new("Frame")
ToolTip.Name = "ToolTip"
ToolTip.Parent = SimpleSpy2
ToolTip.BackgroundColor3 = Color3.fromRGB(26, 26, 26)
ToolTip.BackgroundTransparency = 0.1
ToolTip.BorderColor3 = Color3.new(1, 1, 1)
ToolTip.Size = UDim2.new(0, 200, 0, 50)
ToolTip.ZIndex = 3
ToolTip.Visible = false
local TextLabel = Instance.new("TextLabel")
TextLabel.Parent = ToolTip
TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
TextLabel.BackgroundTransparency = 1
TextLabel.Position = UDim2.new(0, 2, 0, 2)
TextLabel.Size = UDim2.new(0, 196, 0, 46)
TextLabel.ZIndex = 3
TextLabel.Font = Enum.Font.SourceSans
TextLabel.Text = "This is some slightly longer text."
TextLabel.TextColor3 = Color3.new(1, 1, 1)
TextLabel.TextSize = 14
TextLabel.TextWrapped = true
TextLabel.TextXAlignment = Enum.TextXAlignment.Left
TextLabel.TextYAlignment = Enum.TextYAlignment.Top
-- Logic และ Variable ต่างๆ ที่ต้องใช้
local selectedColor = Color3.new(0.321569, 0.333333, 1)
local deselectedColor = Color3.new(0.8, 0.8, 0.8)
local layoutOrderNum = 999999999
local mainClosing = false
local closed = false
local sideClosing = false
local sideClosed = false
local maximized = false
local logs = {}
local selected = nil
local blacklist = {}
local blocklist = {}
local getNil = false
local connectedRemotes = {}
local toggle = false
local gm
local original
local prevTables = {}
local remoteLogs = {}
local remoteEvent = Instance.new("RemoteEvent")
local remoteFunction = Instance.new("RemoteFunction")
local originalEvent = remoteEvent.FireServer
local originalFunction = remoteFunction.InvokeServer
_G.SIMPLESPYCONFIG_MaxRemotes = 500
local indent = 4
local scheduled = {}
local schedulerconnect
local SimpleSpy = {}
local topstr = ""
local bottomstr = ""
local remotesFadeIn
local rightFadeIn
local p
local getnilrequired = false
local autoblock = false
local history = {}
local excluding = {}
local funcEnabled = true
local remoteSignals = {}
local remoteHooks = {}
local oldIcon
local mouseInGui = false
local connections = {}
local useGetCallingScript = false
local keyToString = false
local recordReturnValues = false
-- ฟังก์ชัน Value/Argument to String (เหมือนเดิม)
function v2s(v, l, p, n, vtv, i, pt, path, tables, tI)
if not tI then tI = { 0 } else tI[1] += 1 end
if typeof(v) == "number" then
if v == math.huge then return "math.huge"
elseif tostring(v):match("nan") then return "0/0 --[[NaN]]" end
return tostring(v)
elseif typeof(v) == "boolean" then
return tostring(v)
elseif typeof(v) == "string" then
return formatstr(v, l)
elseif typeof(v) == "function" then
return f2s(v)
elseif typeof(v) == "table" then
return t2s(v, l, p, n, vtv, i, pt, path, tables, tI)
elseif typeof(v) == "Instance" then
return i2p(v)
elseif typeof(v) == "userdata" then
return "newproxy(true)"
elseif type(v) == "userdata" then
return u2s(v)
elseif type(v) == "vector" then
return string.format("Vector3.new(%s, %s, %s)", v2s(v.X), v2s(v.Y), v2s(v.Z))
else
return "nil --[[" .. typeof(v) .. "]]"
end
end
function v2v(t)
topstr = ""
bottomstr = ""
getnilrequired = false
local ret = ""
local count = 1
for i, v in pairs(t) do
if type(i) == "string" and i:match("^[%a_]+[%w_]*$") then
ret = ret .. "local " .. i .. " = " .. v2s(v, nil, nil, i, true) .. "\n"
elseif tostring(i):match("^[%a_]+[%w_]*$") then
ret = ret .. "local " .. tostring(i):lower() .. "_" .. tostring(count) .. " = " .. v2s(v, nil, nil, tostring(i):lower() .. "_" .. tostring(count), true) .. "\n"
else
ret = ret .. "local " .. type(v) .. "_" .. tostring(count) .. " = " .. v2s(v, nil, nil, type(v) .. "_" .. tostring(count), true) .. "\n"
end
count = count + 1
end
if getnilrequired then
topstr = "function getNil(name,class) for _,v in pairs(getnilinstances())do if v.ClassName==class and v.Name==name then return v;end end end\n" .. topstr
end
if #topstr > 0 then ret = topstr .. "\n" .. ret end
if #bottomstr > 0 then ret = ret .. bottomstr end
return ret
end
function t2s(t, l, p, n, vtv, i, pt, path, tables, tI)
local globalIndex = table.find(getgenv(), t)
if type(globalIndex) == "string" then return globalIndex end
if not tI then tI = { 0 } end
if not path then path = "" end
if not l then l = 0; tables = {} end
if not p then p = t end
for _, v in pairs(tables) do
if n and rawequal(v, t) then
bottomstr = bottomstr .. "\n" .. tostring(n) .. tostring(path) .. " = " .. tostring(n) .. tostring(({ v2p(v, p) })[2])
return "{} --[[DUPLICATE]]"
end
end
table.insert(tables, t)
local s = "{"
local size = 0
l = l + indent
for k, v in pairs(t) do
size = size + 1
if size > (_G.SimpleSpyMaxTableSize or 1000) then
s = s .. "\n" .. string.rep(" ", l) .. "-- MAXIMUM TABLE SIZE REACHED, CHANGE '_G.SimpleSpyMaxTableSize' TO ADJUST MAXIMUM SIZE "
break
end
if rawequal(k, t) then
bottomstr = bottomstr .. "\n" .. tostring(n) .. tostring(path) .. "[" .. tostring(n) .. tostring(path) .. "]" .. " = " .. (rawequal(v, k) and tostring(n) .. tostring(path) or v2s(v, l, p, n, vtv, k, t, path .. "[" .. tostring(n) .. tostring(path) .. "]", tables))
size -= 1
continue
end
local currentPath = ""
if type(k) == "string" and k:match("^[%a_]+[%w_]*$") then
currentPath = "." .. k
else
currentPath = "[" .. k2s(k, l, p, n, vtv, k, t, path .. currentPath, tables, tI) .. "]"
end
if size % 100 == 0 then scheduleWait() end
s = s .. "\n" .. string.rep(" ", l) .. "[" .. k2s(k, l, p, n, vtv, k, t, path .. currentPath, tables, tI) .. "] = " .. v2s(v, l, p, n, vtv, k, t, path .. currentPath, tables, tI) .. ","
end
if #s > 1 then s = s:sub(1, #s - 1) end
if size > 0 then s = s .. "\n" .. string.rep(" ", l - indent) end
return s .. "}"
end
function k2s(v, ...)
if keyToString then
if typeof(v) == "userdata" and getrawmetatable(v) then
return string.format('"<void> (%s)" --[[Potentially hidden data (tostring in SimpleSpy:HookRemote/GetRemoteFiredSignal at your own risk)]]', safetostring(v))
elseif typeof(v) == "userdata" then
return string.format('"<void> (%s)"', safetostring(v))
elseif type(v) == "userdata" and typeof(v) ~= "Instance" then
return string.format('"<%s> (%s)"', typeof(v), tostring(v))
elseif type(v) == "function" then
return string.format('"<Function> (%s)"', tostring(v))
end
end
return v2s(v, ...)
end
function f2s(f)
for k, x in pairs(getgenv()) do
local isgucci, gpath
if rawequal(x, f) then isgucci, gpath = true, ""
elseif type(x) == "table" then isgucci, gpath = v2p(f, x) end
if isgucci and type(k) ~= "function" then
if type(k) == "string" and k:match("^[%a_]+[%w_]*$") then
return k .. gpath
else
return "getgenv()[" .. v2s(k) .. "]" .. gpath
end
end
end
if funcEnabled and debug.getinfo(f).name:match("^[%a_]+[%w_]*$") then
return "function()end --[[" .. debug.getinfo(f).name .. "]]"
end
return "function()end --[[" .. tostring(f) .. "]]"
end
function i2p(i)
local player = getplayer(i)
local parent = i
local out = ""
if parent == nil then return "nil"
elseif player then
while true do
if parent and parent == player.Character then
if player == Players.LocalPlayer then
return 'game:GetService("Players").LocalPlayer.Character' .. out
else
return i2p(player) .. ".Character" .. out
end
else
if parent.Name:match("[%a_]+[%w+]*") ~= parent.Name then
out = ":FindFirstChild(" .. formatstr(parent.Name) .. ")" .. out
else
out = "." .. parent.Name .. out
end
end
parent = parent.Parent
end
elseif parent ~= game then
while true do
if parent and parent.Parent == game then
local service = game:FindService(parent.ClassName)
if service then
if parent.ClassName == "Workspace" then
return "workspace" .. out
else
return 'game:GetService("' .. service.ClassName .. '")' .. out
end
else
if parent.Name:match("[%a_]+[%w_]*") then
return "game." .. parent.Name .. out
else
return "game:FindFirstChild(" .. formatstr(parent.Name) .. ")" .. out
end
end
elseif parent.Parent == nil then
getnilrequired = true
return "getNil(" .. formatstr(parent.Name) .. ', "' .. parent.ClassName .. '")' .. out
elseif parent == Players.LocalPlayer then
out = ".LocalPlayer" .. out
else
if parent.Name:match("[%a_]+[%w_]*") ~= parent.Name then
out = ":FindFirstChild(" .. formatstr(parent.Name) .. ")" .. out
else
out = "." .. parent.Name .. out
end
end
parent = parent.Parent
end
else
return "game"
end
end
function u2s(u)
if typeof(u) == "TweenInfo" then
return "TweenInfo.new(" .. tostring(u.Time) .. ", Enum.EasingStyle." .. tostring(u.EasingStyle) .. ", Enum.EasingDirection." .. tostring(u.EasingDirection) .. ", " .. tostring(u.RepeatCount) .. ", " .. tostring(u.Reverses) .. ", " .. tostring(u.DelayTime) .. ")"
elseif typeof(u) == "Ray" then
return "Ray.new(" .. u2s(u.Origin) .. ", " .. u2s(u.Direction) .. ")"
elseif typeof(u) == "NumberSequence" then
local ret = "NumberSequence.new("
for i, v in pairs(u.KeyPoints) do
ret = ret .. tostring(v)
if i < #u.Keypoints then ret = ret .. ", " end
end
return ret .. ")"
elseif typeof(u) == "DockWidgetPluginGuiInfo" then
return "DockWidgetPluginGuiInfo.new(Enum.InitialDockState" .. tostring(u) .. ")"
elseif typeof(u) == "ColorSequence" then
local ret = "ColorSequence.new("
for i, v in pairs(u.KeyPoints) do
ret = ret .. "Color3.new(" .. tostring(v) .. ")"
if i < #u.Keypoints then ret = ret .. ", " end
end
return ret .. ")"
elseif typeof(u) == "BrickColor" then
return "BrickColor.new(" .. tostring(u.Number) .. ")"
elseif typeof(u) == "NumberRange" then
return "NumberRange.new(" .. tostring(u.Min) .. ", " .. tostring(u.Max) .. ")"
elseif typeof(u) == "Region3" then
local center = u.CFrame.Position
local size = u.CFrame.Size
local vector1 = center - size / 2
local vector2 = center + size / 2
return "Region3.new(" .. u2s(vector1) .. ", " .. u2s(vector2) .. ")"
elseif typeof(u) == "Faces" then
local faces = {}
if u.Top then table.insert(faces, "Enum.NormalId.Top") end
if u.Bottom then table.insert(faces, "Enum.NormalId.Bottom") end
if u.Left then table.insert(faces, "Enum.NormalId.Left") end
if u.Right then table.insert(faces, "Enum.NormalId.Right") end
if u.Back then table.insert(faces, "Enum.NormalId.Back") end
if u.Front then table.insert(faces, "Enum.NormalId.Front") end
return "Faces.new(" .. table.concat(faces, ", ") .. ")"
elseif typeof(u) == "EnumItem" then
return tostring(u)
elseif typeof(u) == "Enums" then
return "Enum"
elseif typeof(u) == "Enum" then
return "Enum." .. tostring(u)
elseif typeof(u) == "RBXScriptSignal" then
return "nil --[[RBXScriptSignal]]"
elseif typeof(u) == "Vector3" then
return string.format("Vector3.new(%s, %s, %s)", v2s(u.X), v2s(u.Y), v2s(u.Z))
elseif typeof(u) == "CFrame" then
local xAngle, yAngle, zAngle = u:ToEulerAnglesXYZ()
return string.format("CFrame.new(%s, %s, %s) * CFrame.Angles(%s, %s, %s)", v2s(u.X), v2s(u.Y), v2s(u.Z), v2s(xAngle), v2s(yAngle), v2s(zAngle))
elseif typeof(u) == "DockWidgetPluginGuiInfo" then
return string.format("DockWidgetPluginGuiInfo(%s, %s, %s, %s, %s, %s, %s)", "Enum.InitialDockState.Right", v2s(u.InitialEnabled), v2s(u.InitialEnabledShouldOverrideRestore), v2s(u.FloatingXSize), v2s(u.FloatingYSize), v2s(u.MinWidth), v2s(u.MinHeight))
elseif typeof(u) == "PathWaypoint" then
return string.format("PathWaypoint.new(%s, %s)", v2s(u.Position), v2s(u.Action))
elseif typeof(u) == "UDim" then
return string.format("UDim.new(%s, %s)", v2s(u.Scale), v2s(u.Offset))
elseif typeof(u) == "UDim2" then
return string.format("UDim2.new(%s, %s, %s, %s)", v2s(u.X.Scale), v2s(u.X.Offset), v2s(u.Y.Scale), v2s(u.Y.Offset))
elseif typeof(u) == "Rect" then
return string.format("Rect.new(%s, %s)", v2s(u.Min), v2s(u.Max))
else
return string.format("nil --[[%s]]", typeof(u))
end
end
function getplayer(instance)
for _, v in pairs(Players:GetPlayers()) do
if v.Character and (instance:IsDescendantOf(v.Character) or instance == v.Character) then
return v
end
end
end
function v2p(x, t, path, prev)
if not path then path = "" end
if not prev then prev = {} end
if rawequal(x, t) then return true, "" end
for i, v in pairs(t) do
if rawequal(v, x) then
if type(i) == "string" and i:match("^[%a_]+[%w_]*$") then
return true, (path .. "." .. i)
else
return true, (path .. "[" .. v2s(i) .. "]")
end
end
if type(v) == "table" then
local duplicate = false
for _, y in pairs(prev) do
if rawequal(y, v) then duplicate = true end
end
if not duplicate then
table.insert(prev, t)
local found
found, p = v2p(x, v, path, prev)
if found then
if type(i) == "string" and i:match("^[%a_]+[%w_]*$") then
return true, "." .. i .. p
else
return true, "[" .. v2s(i) .. "]" .. p
end
end
end
end
end
return false, ""
end
function formatstr(s, indentation)
if not indentation then indentation = 0 end
local handled, reachedMax = handlespecials(s, indentation)
return '"' .. handled .. '"' .. (reachedMax and " --[[ MAXIMUM STRING SIZE REACHED, CHANGE '_G.SimpleSpyMaxStringSize' TO ADJUST MAXIMUM SIZE ]]" or "")
end
function handlespecials(value, indentation)
local buildStr = {}
local i = 1
local char = string.sub(value, i, i)
local indentStr
while char ~= "" do
if char == '"' then buildStr[i] = '\\"'
elseif char == "\\" then buildStr[i] = "\\\\"
elseif char == "\n" then buildStr[i] = "\\n"
elseif char == "\t" then buildStr[i] = "\\t"
elseif string.byte(char) > 126 or string.byte(char) < 32 then
buildStr[i] = string.format("\\%d", string.byte(char))
else
buildStr[i] = char
end
i = i + 1
char = string.sub(value, i, i)
if i % 200 == 0 then
indentStr = indentStr or string.rep(" ", indentation + indent)
table.move({ '"\n', indentStr, '... "' }, 1, 3, i, buildStr)
i += 3
end
end
return table.concat(buildStr)
end
function safetostring(v: any)
if typeof(v) == "userdata" or type(v) == "table" then
local mt = getrawmetatable(v)
local badtostring = mt and rawget(mt, "__tostring")
if mt and badtostring then
rawset(mt, "__tostring", nil)
local out = tostring(v)
rawset(mt, "__tostring", badtostring)
return out
end
end
return tostring(v)
end
function getScriptFromSrc(src)
local realPath
local runningTest
local s, e
local match = false
if src:sub(1, 1) == "=" then
realPath = game
s = 2
else
runningTest = src:sub(2, e and e - 1 or -1)
for _, v in pairs(getnilinstances()) do
if v.Name == runningTest then
realPath = v
break
end
end
s = #runningTest + 1
end
if realPath then
e = src:sub(s, -1):find("%.")
local i = 0
repeat
i += 1
if not e then
runningTest = src:sub(s, -1)
local test = realPath.FindFirstChild(realPath, runningTest)
if test then realPath = test end
match = true
else
runningTest = src:sub(s, e)
local test = realPath.FindFirstChild(realPath, runningTest)
local yeOld = e
if test then
realPath = test
s = e + 2
e = src:sub(e + 2, -1):find("%.")
e = e and e + yeOld or e
else
e = src:sub(e + 2, -1):find("%.")
e = e and e + yeOld or e
end
end
until match or i >= 50
end
return realPath
end
function schedule(f, ...)
table.insert(scheduled, { f, ... })
end
function scheduleWait()
local thread = coroutine.running()
schedule(function() coroutine.resume(thread) end)
coroutine.yield()
end
function taskscheduler()
if not toggle then scheduled = {} return end
if #scheduled > 1000 then table.remove(scheduled, #scheduled) end
if #scheduled > 0 then
local currentf = scheduled[1]
table.remove(scheduled, 1)
if type(currentf) == "table" and type(currentf[1]) == "function" then
pcall(unpack(currentf))
end
end
end
function remoteHandler(hookfunction, methodName, remote, args, funcInfo, calling, returnValue)
local validInstance, validClass = pcall(function() return remote:IsA("RemoteEvent") or remote:IsA("RemoteFunction") end)
if validInstance and validClass then
local func = funcInfo.func
if not calling then _, calling = pcall(getScriptFromSrc, funcInfo.source) end
coroutine.wrap(function()
if remoteSignals[remote] then remoteSignals[remote]:Fire(args) end
end)()
if autoblock then
if excluding[remote] then return end
if not history[remote] then history[remote] = { badOccurances = 0, lastCall = tick() } end
if tick() - history[remote].lastCall < 1 then
history[remote].badOccurances += 1
return
else
history[remote].badOccurances = 0
end
if history[remote].badOccurances > 3 then
excluding[remote] = true
return
end
history[remote].lastCall = tick()
end
local functionInfoStr
local src
if func and islclosure(func) then
local functionInfo = {}
functionInfo.info = funcInfo
pcall(function() functionInfo.constants = debug.getconstants(func) end)
pcall(function() functionInfoStr = v2v({ functionInfo = functionInfo }) end)
pcall(function() if type(calling) == "userdata" then src = calling end end)
end
if methodName:lower() == "fireserver" then
newRemote("event", remote.Name, args, remote, functionInfoStr, (blocklist[remote] or blocklist[remote.Name]), src)
elseif methodName:lower() == "invokeserver" then
newRemote("function", remote.Name, args, remote, functionInfoStr, (blocklist[remote] or blocklist[remote.Name]), src, returnValue)
end
end
end
function hookRemote(remoteType, remote, ...)
if typeof(remote) == "Instance" then
local args = { ... }
local validInstance, remoteName = pcall(function() return remote.Name end)
if validInstance and not (blacklist[remote] or blacklist[remoteName]) then
local funcInfo = {}
local calling
if funcEnabled then
funcInfo = debug.getinfo(4) or funcInfo
calling = useGetCallingScript and getcallingscript() or nil
end
if recordReturnValues and remoteType == "RemoteFunction" then
local thread = coroutine.running()
local args = { ... }
task.defer(function()
local returnValue
if remoteHooks[remote] then args = { remoteHooks[remote](unpack(args)) }; returnValue = originalFunction(remote, unpack(args))
else returnValue = originalFunction(remote, unpack(args)) end
schedule(remoteHandler, true, remoteType == "RemoteEvent" and "fireserver" or "invokeserver", remote, args, funcInfo, calling, returnValue)
if blocklist[remote] or blocklist[remoteName] then coroutine.resume(thread)
else coroutine.resume(thread, unpack(returnValue)) end
end)
else
schedule(remoteHandler, true, remoteType == "RemoteEvent" and "fireserver" or "invokeserver", remote, args, funcInfo, calling)
if blocklist[remote] or blocklist[remoteName] then return end
end
end
end
if recordReturnValues and remoteType == "RemoteFunction" then
return coroutine.yield()
elseif remoteType == "RemoteEvent" then
if remoteHooks[remote] then return originalEvent(remote, remoteHooks[remote](...)) end
return originalEvent(remote, ...)
else
if remoteHooks[remote] then return originalFunction(remote, remoteHooks[remote](...)) end
return originalFunction(remote, ...)
end
end
local newnamecall = newcclosure(function(remote, ...)
if typeof(remote) == "Instance" then
local args = { ... }
local methodName = getnamecallmethod()
local validInstance, remoteName = pcall(function() return remote.Name end)
if validInstance and (methodName == "FireServer" or methodName == "fireServer" or methodName == "InvokeServer" or methodName == "invokeServer") and not (blacklist[remote] or blacklist[remoteName]) then
local funcInfo = {}
local calling
if funcEnabled then
funcInfo = debug.getinfo(3) or funcInfo
calling = useGetCallingScript and getcallingscript() or nil
end
if recordReturnValues and (methodName == "InvokeServer" or methodName == "invokeServer") then
local namecallThread = coroutine.running()
local args = { ... }
task.defer(function()
local returnValue
setnamecallmethod(methodName)
if remoteHooks[remote] then args = { remoteHooks[remote](unpack(args)) }; returnValue = { original(remote, unpack(args)) }
else returnValue = { original(remote, unpack(args)) } end
coroutine.resume(namecallThread, unpack(returnValue))
coroutine.wrap(function() schedule(remoteHandler, false, methodName, remote, args, funcInfo, calling, returnValue) end)()
end)
else
coroutine.wrap(function() schedule(remoteHandler, false, methodName, remote, args, funcInfo, calling) end)()
end
end
if recordReturnValues and (methodName == "InvokeServer" or methodName == "invokeServer") then
return coroutine.yield()
elseif validInstance and (methodName == "FireServer" or methodName == "fireServer" or methodName == "InvokeServer" or methodName == "invokeServer") and (blocklist[remote] or blocklist[remoteName]) then
return nil
elseif (not recordReturnValues or methodName ~= "InvokeServer" or methodName ~= "invokeServer") and validInstance and (methodName == "FireServer" or methodName == "fireServer" or methodName == "InvokeServer" or methodName == "invokeServer") and remoteHooks[remote] then
return original(remote, remoteHooks[remote](...))
else
return original(remote, ...)
end
end
return original(remote, ...)
end, original)
local newFireServer = newcclosure(function(...) return hookRemote("RemoteEvent", ...) end, originalEvent)
local newInvokeServer = newcclosure(function(...) return hookRemote("RemoteFunction", ...) end, originalFunction)
function toggleSpy()
if not toggle then
if hookmetamethod then
local oldNamecall = hookmetamethod(game, "__namecall", newnamecall)
original = original or function(...) return oldNamecall(...) end
_G.OriginalNamecall = original
else
gm = gm or getrawmetatable(game)
original = original or function(...) return gm.__namecall(...) end
setreadonly(gm, false)
if not original then warn("SimpleSpy: namecall method not found!"); onToggleButtonClick(); return end
gm.__namecall = newnamecall
setreadonly(gm, true)
end
originalEvent = hookfunction(remoteEvent.FireServer, newFireServer)
originalFunction = hookfunction(remoteFunction.InvokeServer, newInvokeServer)
else
if hookmetamethod then
if original then hookmetamethod(game, "__namecall", original) end
else
gm = gm or getrawmetatable(game)
setreadonly(gm, false)
gm.__namecall = original
setreadonly(gm, true)
end
hookfunction(remoteEvent.FireServer, originalEvent)
hookfunction(remoteFunction.InvokeServer, originalFunction)
end
end
function toggleSpyMethod()
toggleSpy()
toggle = not toggle
end
function shutdown()
if schedulerconnect then schedulerconnect:Disconnect() end
for _, connection in pairs(connections) do
coroutine.wrap(function() connection:Disconnect() end)()
end
SimpleSpy2:Destroy()
hookfunction(remoteEvent.FireServer, originalEvent)
hookfunction(remoteFunction.InvokeServer, originalFunction)
if hookmetamethod then
if original then hookmetamethod(game, "__namecall", original) end
else
gm = gm or getrawmetatable(game)
setreadonly(gm, false)
gm.__namecall = original
setreadonly(gm, true)
end
_G.SimpleSpyExecuted = false
end
function newRemote(type, name, args, remote, function_info, blocked, src, returnValue)
local remoteFrame = RemoteTemplate:Clone()
remoteFrame.Text = string.sub(name, 1, 50)
remoteFrame.BackgroundColor3 = type == "event" and Color3.fromRGB(255, 150, 0) or Color3.fromRGB(100, 100, 255) -- สีสันใหม่สำหรับ Event/Function
local id = Instance.new("IntValue")
id.Name = "ID"
id.Value = #logs + 1
id.Parent = remoteFrame
local weakRemoteTable = setmetatable({ remote = remote }, { __mode = "v" })
local log = {
Name = name,
Function = function_info,
Remote = weakRemoteTable,
Log = remoteFrame,
Blocked = blocked,
Source = src,
GenScript = "-- Generating, please wait... (click to reload)\n-- (If this message persists, the remote args are likely extremely long)",
ReturnValue = returnValue,
}
logs[#logs + 1] = log
schedule(function()
log.GenScript = genScript(remote, args)
if blocked then
logs[#logs].GenScript = "-- THIS REMOTE WAS PREVENTED FROM FIRING THE SERVER BY SIMPLESPY\n" .. logs[#logs].GenScript
end
end)
local connect = remoteFrame.MouseButton1Click:Connect(function()
if selected and selected.Log then
TweenService:Create(selected.Log, TweenInfo.new(0.2), { BackgroundColor3 = Color3.fromRGB(60, 60, 60) }):Play()
end
selected = log
TweenService:Create(remoteFrame, TweenInfo.new(0.2), { BackgroundColor3 = selectedColor }):Play()
codebox:setRaw(log.GenScript)
end)
if layoutOrderNum < 1 then layoutOrderNum = 999999999 end
remoteFrame.LayoutOrder = layoutOrderNum
layoutOrderNum = layoutOrderNum - 1
remoteFrame.Parent = LogList
table.insert(remoteLogs, 1, { connect, remoteFrame })
clean()
updateRemoteCanvas()
end
function genScript(remote, args)
prevTables = {}
local gen = ""
if #args > 0 then
if not pcall(function() gen = v2v({ args = args }) .. "\n" end) then
gen = gen .. "-- TableToString failure! Reverting to legacy functionality (results may vary)\nlocal args = {"
if not pcall(function()
for i, v in pairs(args) do
if type(i) ~= "Instance" and type(i) ~= "userdata" then
gen = gen .. "\n [object] = "
elseif type(i) == "string" then
gen = gen .. '\n ["' .. i .. '"] = '
elseif type(i) == "userdata" and typeof(i) ~= "Instance" then
gen = gen .. "\n [" .. string.format("nil --[[%s]]", typeof(v)) .. ")] = "
elseif type(i) == "userdata" then
gen = gen .. "\n [game." .. i:GetFullName() .. ")] = "
end
if type(v) ~= "Instance" and type(v) ~= "userdata" then
gen = gen .. "object"
elseif type(v) == "string" then
gen = gen .. '"' .. v .. '"'
elseif type(v) == "userdata" and typeof(v) ~= "Instance" then
gen = gen .. string.format("nil --[[%s]]", typeof(v))
elseif type(v) == "userdata" then
gen = gen .. "game." .. v:GetFullName()
end
end
gen = gen .. "\n}\n"
end) then
gen = gen .. "}\n-- Legacy tableToString failure! Unable to decompile."
end
end
if not remote:IsDescendantOf(game) and not getnilrequired then
gen = "function getNil(name,class) for _,v in pairs(getnilinstances())do if v.ClassName==class and v.Name==name then return v;end end end\n" .. gen
end
if remote:IsA("RemoteEvent") then
gen = gen .. v2s(remote) .. ":FireServer(unpack(args))"
elseif remote:IsA("RemoteFunction") then
gen = gen .. v2s(remote) .. ":InvokeServer(unpack(args))"
end
else
if remote:IsA("RemoteEvent") then
gen = gen .. v2s(remote) .. ":FireServer()"
elseif remote:IsA("RemoteFunction") then
gen = gen .. v2s(remote) .. ":InvokeServer()"
end
end
gen = "-- Script generated by SimpleSpy - credits to exx#9394\n" .. gen
prevTables = {}
return gen
end
function clean()
local max = _G.SIMPLESPYCONFIG_MaxRemotes
if not typeof(max) == "number" and math.floor(max) ~= max then max = 500 end
if #remoteLogs > max then
for i = 100, #remoteLogs do
local v = remoteLogs[i]
if typeof(v[1]) == "RBXScriptConnection" then v[1]:Disconnect() end
if typeof(v[2]) == "Instance" then v[2]:Destroy() end
end
local newLogs = {}
for i = 1, 100 do table.insert(newLogs, remoteLogs[i]) end
remoteLogs = newLogs
end
end
function scaleToolTip()
local size = TextService:GetTextSize(TextLabel.Text, TextLabel.TextSize, TextLabel.Font, Vector2.new(196, math.huge))
TextLabel.Size = UDim2.new(0, size.X, 0, size.Y)