x83

remote spy

x83
Dec 8th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. local getrawmetatable = assert(getrawmetatable, "Sorry, our script cannot run on this exploit due to its missing function `getrawmetatable`");
  2. local detectedProtection = newcclosure or protect_function or coroutine.wrap
  3.  
  4. local gamerawMeta = getrawmetatable(game);
  5. if (setreadonly) then setreadonly(gamerawMeta, false) end;
  6. if (make_writeable) then make_writeable(gamerawMeta) end;
  7.  
  8. local oldMeta = gamerawMeta.__namecall;
  9.  
  10. local methodOfUse = {
  11. ["Fire"] = true,
  12. ["FireServer"] = true,
  13. ["Invoke"] = true,
  14. ["InvokeServer"] = true
  15. };
  16.  
  17. local classNames = {
  18. ["BindableEvent"] = false,
  19. ["RemoteEvent"] = true,
  20. ["BindableFunction"] = true,
  21. ["RemoteFunction"] = true,
  22. ["Event"] = true,
  23. };
  24.  
  25. local ignoredRemoteNames = {};
  26.  
  27. local function GetPath(instanceObject)
  28. if (instanceObject == game) then return "game" end
  29. if (instanceObject.Parent == nil)then return instanceObject.Name end
  30. local returnString = "";
  31. while instanceObject.Parent ~= game do
  32. returnString = "["..instanceObject.Name.."]"..returnString
  33. instanceObject = instanceObject.Parent
  34. end
  35. if instanceObject == workspace then
  36. return "workspace"..returnString
  37. elseif pcall(game.GetService, game, instanceObject.ClassName) then
  38. return 'game:GetService("'.. instanceObject.ClassName ..'")'..returnString
  39. end
  40. return "game["..instanceObject.Name.."]"..returnString
  41. end
  42.  
  43. function argumentsUnpack(mustBeTable)
  44. if (type(mustBeTable) ~= "table") then return end;
  45. local returnString, arguments = "", (mustBeTable);
  46.  
  47. for index, value in pairs( arguments ) do
  48. local isType = typeof(value);
  49.  
  50. if ( isType == "string" ) then
  51. returnString = returnString .. ", \"".. value .."\"";
  52.  
  53.  
  54. elseif ( isType == "table" ) then
  55. returnString = returnString .. ", {".. argumentsUnpack(value) .."}";
  56.  
  57. elseif ( isType == "Vector2" ) then
  58. returnString = returnString .. ", [".. string.format("Vector2.new(%g, %g)",value.X,value.Y) .."]";
  59.  
  60. elseif ( isType == "Vector3" ) then
  61. returnString = returnString .. ", [".. string.format("Vector3.new(%g, %g, %g)",value.X,value.Y,value.Z) .."]";
  62.  
  63. elseif ( isType == "Color3" ) then
  64. returnString = returnString .. ", [".. string.format("Color3.new(%g, %g, %g)",value.r,value.g,value.b) .."]";
  65.  
  66. elseif ( isType == "CFrame" ) then
  67. returnString = returnString .. ", [".. string.format("CFrame.new(%g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g)",value:components()) .."]";
  68.  
  69. elseif ( isType == "UDim2" ) then
  70. returnString = returnString .. ", [".. string.format("UDim2.new(%g, %g, %g, %g)", value.X.Scale, value.X.Offset, value.Y.Scale, value.Y.Offset) .."]";
  71.  
  72. elseif ( isType == "Instance" ) then
  73. returnString = returnString .. ", " ..GetPath(value);
  74.  
  75. elseif ( isType == "userdata" ) then
  76. if not rawget(getrawmetatable(value), "__tostring") then
  77. returnString = returnString .. ", " .. tostring(value)
  78. else
  79. returnString = returnString .. ", [userdata]"
  80. end
  81.  
  82. else
  83. returnString = returnString .. ", " .. tostring(value)
  84. end
  85. end
  86. return returnString:sub(3);
  87. end;
  88.  
  89. gamerawMeta.__namecall = detectedProtection(function(self, ...)
  90. local argumentsCalled = {...};
  91. local methodName = argumentsCalled[#argumentsCalled]
  92. if methodOfUse[methodName] == nil or ignoredRemoteNames[self.Name] == true or classNames[self.ClassName] == nil or game:IsAncestorOf(self) then
  93. return oldMeta(self, ...)
  94. end
  95. argumentsCalled[#argumentsCalled] = nil
  96. local stringArgs = argumentsUnpack(argumentsCalled)
  97. warn(self.ClassName .. " was called!\nPath: " .. GetPath(self) .. "\nMethod: " .. methodName .. "\nArgs: " .. stringArgs);
  98. return oldMeta(self, ...)
  99. end)
Add Comment
Please, Sign In to add comment