|
| 1 | +Information: |
| 2 | + - This lets you spy on what the game does when you shoot (use this to reverse engineer and bypass AC) |
| 3 | + - GetFullName is somehow detected so act fast before u get kicked |
| 4 | +]] |
| 5 | + |
| 6 | +-- // Services |
| 7 | +local UserInputService = game:GetService("UserInputService") |
| 8 | +local Players = game:GetService("Players") |
| 9 | + |
| 10 | +-- // Vars |
| 11 | +local LocalPlayer = Players.LocalPlayer |
| 12 | + |
| 13 | +-- // Config |
| 14 | +local Output = "" |
| 15 | +local SaveOutput = Enum.KeyCode.Q |
| 16 | +local AutoSaveOutput = true |
| 17 | +local EnableSpy = false |
| 18 | +local TargetScript = nil--LocalPlayer.PlayerGui:WaitForChild("Main").MainScript |
| 19 | + |
| 20 | +-- // safe (ish) tostring (ty simplespy) |
| 21 | +local function safetostring(v: any) |
| 22 | + if typeof(v) == "userdata" or type(v) == "table" then |
| 23 | + local mt = getrawmetatable(v) |
| 24 | + local badtostring = mt and rawget(mt, "__tostring") |
| 25 | + if mt and badtostring then |
| 26 | + rawset(mt, "__tostring", nil) |
| 27 | + local out = tostring(v) |
| 28 | + rawset(mt, "__tostring", badtostring) |
| 29 | + return out |
| 30 | + end |
| 31 | + end |
| 32 | + return tostring(v) |
| 33 | +end |
| 34 | + |
| 35 | +-- // Convert table to string (table.concat doesn't play nice so I had to make this.) |
| 36 | +local function ArrayToString(t, sep) |
| 37 | + -- // Vars |
| 38 | + local String = "" |
| 39 | + local StringFormat = "%s%s%s" |
| 40 | + |
| 41 | + -- // |
| 42 | + for _, v in pairs(t) do |
| 43 | + String = string.format(StringFormat, String, safetostring(v), sep) |
| 44 | + end |
| 45 | + |
| 46 | + -- // |
| 47 | + return String |
| 48 | +end |
| 49 | + |
| 50 | +-- // __namecall hook |
| 51 | +local GetFullName = game.GetFullName |
| 52 | +local __namecallFormat = "__namecall -> self = %s\n method = %s\n args = %s\n" |
| 53 | +local __namecall |
| 54 | +__namecall = hookmetamethod(game, "__namecall", function(...) |
| 55 | + -- // Vars |
| 56 | + local args = {...} |
| 57 | + local self = args[1] |
| 58 | + local method = getnamecallmethod() |
| 59 | + local callingscript = getcallingscript() |
| 60 | + |
| 61 | + -- // Make sure the spy is enabled |
| 62 | + if (not EnableSpy and (callingscript == TargetScript or not TargetScript)) then |
| 63 | + -- // Remove self from args |
| 64 | + local args2 = {...} |
| 65 | + table.remove(args2, 1) |
| 66 | + |
| 67 | + -- // Add to output |
| 68 | + local selfName = GetFullName(self) |
| 69 | + local ParsedArgs = ArrayToString(args2, ", ") |
| 70 | + Output = Output .. __namecallFormat.format(__namecallFormat, selfName, method, ParsedArgs) |
| 71 | + end |
| 72 | + |
| 73 | + -- // |
| 74 | + return __namecall(...) |
| 75 | +end) |
| 76 | + |
| 77 | +-- // __index hook |
| 78 | +local __indexFormat = "__index -> self = %s\n k = %s\n" |
| 79 | +local __index |
| 80 | +__index = hookmetamethod(game, "__index", function(t, k) |
| 81 | + -- // Vars |
| 82 | + local callingscript = getcallingscript() |
| 83 | + |
| 84 | + -- // Make sure the spy is enabled |
| 85 | + if (EnableSpy and (callingscript == TargetScript or not TargetScript)) then |
| 86 | + -- // Add to output |
| 87 | + local tName = GetFullName(t) |
| 88 | + Output = Output .. __indexFormat:format(tName, k) |
| 89 | + end |
| 90 | + |
| 91 | + -- // |
| 92 | + return __index(t, k) |
| 93 | +end) |
| 94 | + |
| 95 | +-- // __newindex hook |
| 96 | +local __newindexFormat = "__newindex -> self = %s\n k = %s\n v = %s\n" |
| 97 | +local __newindex |
| 98 | +__newindex = hookmetamethod(game, "__index", function(t, k, v) |
| 99 | + -- // Vars |
| 100 | + local callingscript = getcallingscript() |
| 101 | + |
| 102 | + -- // Make sure the spy is enabled |
| 103 | + if (EnableSpy and (callingscript == TargetScript or not TargetScript)) then |
| 104 | + -- // Add to output |
| 105 | + local tName = GetFullName(t) |
| 106 | + local stringv = safetostring(v) |
| 107 | + Output = Output .. __newindexFormat:format(tName, k, stringv) |
| 108 | + end |
| 109 | + |
| 110 | + -- // |
| 111 | + return __newindex(t, k, v) |
| 112 | +end) |
| 113 | + |
| 114 | +-- // Toggles the spy (when we shoot) |
| 115 | +UserInputService.InputBegan:Connect(function(input, gameProcessedEvent) |
| 116 | + -- // |
| 117 | + if (gameProcessedEvent) then |
| 118 | + return |
| 119 | + end |
| 120 | + |
| 121 | + -- // Check if we shot |
| 122 | + if (input.UserInputType == Enum.UserInputType.MouseButton1) then |
| 123 | + EnableSpy = true |
| 124 | + return |
| 125 | + end |
| 126 | + |
| 127 | + -- // Check if we want to save the output |
| 128 | + if (input.KeyCode == SaveOutput) then |
| 129 | + writefile("Output.txt", Output) |
| 130 | + end |
| 131 | +end) |
| 132 | + |
| 133 | +UserInputService.InputEnded:Connect(function(input, gameProcessedEvent) |
| 134 | + -- // |
| 135 | + if (gameProcessedEvent) then |
| 136 | + return |
| 137 | + end |
| 138 | + |
| 139 | + -- // Check if we shot |
| 140 | + if (input.UserInputType == Enum.UserInputType.MouseButton1) then |
| 141 | + EnableSpy = false |
| 142 | + |
| 143 | + -- // Save output |
| 144 | + if (AutoSaveOutput) then |
| 145 | + writefile("Output.txt", Output) |
| 146 | + end |
| 147 | + end |
| 148 | +end) |
0 commit comments