Advertisement
mwmatthew10

Script-Ware RemoteSpy

Dec 22nd, 2017
1,900
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.12 KB | None | 0 0
  1. local meta = getrawmetatable(game)
  2. local WriteFile = false --Doesnt work for now
  3. local Console = true -- Neither does this
  4. local old,LogOnlyDataModelDescendants = meta.__namecall, true
  5. if WriteFile == true then
  6.     writefile("Remote Spy.txt", "==Remote spy logs for: " .. game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId).Name .. "==")
  7.     x = readfile("Remote Spy.txt")
  8.     print(x)
  9. end
  10. local Methods,ClassNames,Ignore = {
  11.     ["Fire"] = true,
  12.     ["FireServer"] = true,
  13.     ["Invoke"] = true,
  14.     ["InvokeServer"] = true
  15. },{
  16.     ["BindableEvent"] = false,
  17.     ["RemoteEvent"] = true,
  18.     ["BindableFunction"] = true,
  19.     ["RemoteFunction"] = true,
  20.     ["Event"] = true,
  21. },{
  22.     ["turnevent"] = true,
  23.     ["TurnEvent"] = true,
  24. }
  25.  
  26. function UnpackArgs(args)
  27.     local s = ""
  28.     for i, v in pairs(args) do
  29.         local type = typeof(v)
  30.         if type == "string" then
  31.             s = s .. ", \"" .. v .. "\""
  32.         elseif type == "Instance" then
  33.             s = s .. ", " .. v:GetFullName()
  34.         elseif type == "table" then
  35.             s = s .. ", {" .. UnpackArgs(v) .. "}"
  36.         elseif type == "userdata" then
  37.             if not rawget(getrawmetatable(v), "__tostring") then
  38.                 s = s .. ", " .. tostring(v)
  39.             else
  40.                 s = s .. ", [userdata]"
  41.             end
  42.         else
  43.             s = s .. ", " .. tostring(v)
  44.         end
  45.     end
  46.     return s:sub(3)
  47. end
  48.  
  49. meta.__namecall = function(s, ...)
  50.     local args = {
  51.         ...
  52.     }
  53.     local methodname = args[#args]
  54.     if Methods[methodname] == nil or Ignore[s.Name] == true or ClassNames[s.ClassName] == nil or (LogOnlyDataModelDescendants == true and not game:IsAncestorOf(s)) then
  55.         return old(s, ...)
  56.     end
  57.     args[#args] = nil
  58.     local stringargs = UnpackArgs(args)
  59.     if console ~= true then
  60.         warn(s.ClassName .. " was called!\nPath: " .. s:GetFullName() .. "\nArgs: " .. stringargs .. "\nMethod: " .. methodname)
  61.     else
  62.         printconsole(s.ClassName .. " was called!\nPath: " .. s:GetFullName() .. "\nArgs: " .. stringargs .. "\nMethod: " .. methodname)
  63.     end
  64.     if WriteFile == true then
  65.         writefile("Remote Spy.txt", readfile("Remote Spy.txt") .. "\n" .. s.ClassName .. " was called!\nPath: " .. s:GetFullName() .. "\nArgs: " .. stringargs .. "\nMethod: " .. methodname)
  66.     end
  67.     return old(s, ...)
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement