Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local printtoconsole = printremotespy
- _G.enabled = {
- -- Set any of these objects to false to stop logging them
- BindableEvent = true;
- BindableFunction = true;
- RemoteEvent = true;
- RemoteFunction = true;
- }
- _G.ignore = {
- Event = true;
- }
- local enable_additional_hooking = false
- ----------------------------------------------------------------------------------------------------------------------------------------------
- if _G.RemoteSpyLock then printtoconsole("!!! RemoteSpy is already running!") error() end _G.RemoteSpyLock = true
- local meta = getrawmetatable(game)
- local oldmeta = {
- __index = meta.__index;
- __namecall = meta.__namecall;
- }
- local function formatargs(args,showkeys)
- if #args == 0 then return "N/A" end
- local strargs = {}
- for k,v in next,args do
- local argstr = ""
- if type(v) == "string" then
- argstr = "\"" .. v .. "\""
- elseif type(v) == "table" then
- argstr = "{" .. formatargs(v,true) .. "}"
- else
- argstr = tostring(v)
- end
- if showkeys and type(k) ~= "number" then
- table.insert(strargs,k.."="..argstr)
- else
- table.insert(strargs,argstr)
- end
- end
- return table.concat(strargs, ", ")
- end
- local realmethods = {
- Fire = Instance.new("BindableEvent").Fire;
- Invoke = Instance.new("BindableFunction").Invoke;
- FireServer = Instance.new("RemoteEvent").FireServer;
- InvokeServer = Instance.new("RemoteFunction").InvokeServer;
- }
- local hook = function(method)
- return function(...)
- local args = {...}
- local t,k = args[1],args[#args]
- if (k == "Fire" or k == "Invoke" or k == "FireServer" or k == "InvokeServer") and (_G.enabled[t.ClassName] and not _G.ignore[t.Name]) then
- local fake = function(self,...)
- local args = {...}
- local ret = {realmethods[k](self,...)}
- printtoconsole("RemoteSpy event:\n----------------------------------------\n[*] "..t.ClassName.." called!\n[*] Path: "..t:GetFullName().."\n[*] Args: "..formatargs(args).."\n[*] Return: "..formatargs(ret).."\n----------------------------------------")
- return unpack(ret)
- end
- table.remove(args,#args) -- the key is the only irrelevant argument for __namecall
- return method == "__namecall" and fake(unpack(args)) or fake
- else
- return oldmeta[method](...)
- end
- end
- end
- meta.__namecall = hook("__namecall")
- if enable_additional_hooking then
- meta.__index = hook("__index")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement