Advertisement
Guest User

Remote Spy [Anti-Detect]

a guest
Aug 1st, 2019
4,701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.76 KB | None | 0 0
  1. --// Written by chaserks (chaserks @ v3rmillion.net, chaserks#3441 @ Discord)
  2. --// Lua U compatible Remote Spy (Also works on non-Lua U games)
  3. --// Requires getnamecallmethod (When used on a Lua U game), hookfunction / detour_function, getrawmetatable, setclipboard (When used with the SetToClipboard setting enabled)
  4. --// LATEST UPDATE: Offers detection protection against tostring and rawequal (You will not be able to detect FireServer & InvokeServer spoofs with these functions anymore)
  5.  
  6. --// This script has a high chance of not functioning on the ProtoSmasher exploit software
  7. --// If you need assistance with anything related to this script then go ahead and message me on Discord, I'll be glad to help if you're a willing learner
  8.  
  9. _G.Settings = {
  10. SetToClipboard = false, --// Set remote calls to clipboard as code
  11. RemoteBlacklist = { --// Ignore remote calls made with these remotes
  12. CharacterSoundEvent = true,
  13. }
  14. }
  15.  
  16. local metatable = getrawmetatable(game)
  17. local LuaU = select(2, pcall(game)) == "attempt to call a userdata value"
  18. print("Lua U Enabled:", LuaU)
  19. local getnamecallmethod = getnamecallmethod or function()
  20. return "FireServer"
  21. end
  22. local hookfunction = hookfunction or detour_function
  23. local newcclosure = newcclosure or protect_function or function(...)
  24. return ...
  25. end
  26. local game, typeof, setreadonly, getmetatable, setmetatable, pcall, tostring, remove, next, setclipboard, warn = game, typeof, setreadonly or set_readonly, debug.getmetatable or getrawmetatable, debug.setmetatable or setrawmetatable, pcall, tostring, table.remove, next, setclipboard, warn
  27. local Methods = {
  28. RemoteEvent = "FireServer",
  29. RemoteFunction = "InvokeServer"
  30. }
  31. local Original = {}
  32. local Settings = _G.Settings
  33. local GetInstanceName = function(Object)
  34. local Name = metatable.__index(Object, "Name")
  35. return ((#Name == 0 or Name:match("[^%w]+") or Name:sub(1, 1):match("[^%a]")) and "[\"%s\"]" or ".%s"):format(Name)
  36. end
  37. local function Parse(Object)
  38. local Type = (typeof or type)(Object);
  39. if Type == "string" then
  40. return ("\"%s\""):format(Object)
  41. elseif Type == "Instance" then
  42. local Path = GetInstanceName(Object)
  43. local Parent = metatable.__index(Object, "Parent")
  44. while Parent and Parent ~= game do
  45. Path = GetInstanceName(Parent) .. Path
  46. Parent = metatable.__index(Parent, "Parent")
  47. end
  48. return (Object:IsDescendantOf(game) and "game" or "NIL") .. Path
  49. elseif Type == "table" then
  50. local Str = ""
  51. local Counter = 0
  52. for Idx, Obj in next, Object do
  53. Counter = Counter + 1
  54. local Obj = Obj ~= Object and Parse(Obj) or "THIS_TABLE"
  55. if Counter ~= Idx then
  56. Str = Str .. ("[%s] = %s, "):format(Idx ~= Object and Parse(Idx) or "THIS_TABLE", Obj) --maybe
  57. else
  58. Str = Str .. ("%s, "):format(Obj)
  59. end
  60. end
  61. return ("{%s}"):format(Str:sub(1, -3))
  62. else
  63. return tostring(Object)
  64. end
  65. end
  66. local Write = function(Remote, Arguments)
  67. local Stuff = ("%s:%s(unpack%s)"):format(Parse(Remote), Methods[metatable.__index(Remote, "ClassName")], Parse(Arguments))
  68. warn(Stuff)
  69. local _ = Settings.SetToClipboard and setclipboard(Stuff)
  70. end
  71. do
  72. local original_function = tostring
  73. local new_function = newcclosure(function(...)
  74. local Metatable, __tostring = (...) and getmetatable(...)
  75. if Metatable and Metatable.__tostring then
  76. __tostring = Metatable.__tostring
  77. setreadonly(Metatable, false)
  78. Metatable.__tostring = nil
  79. end
  80. local Success, Result = pcall(original_function, Original[...] or ...)
  81. if Success then
  82. if __tostring then
  83. Metatable.__tostring = __tostring
  84. setreadonly(Metatable, Metatable.__metatable ~= nil)
  85. end
  86. return Result
  87. else
  88. error(Result:gsub(script.Name .. ":%d+: ", ""))
  89. end
  90. end)
  91. Original[new_function] = original_function
  92. original_function = hookfunction(original_function, new_function, true)
  93. end
  94. do
  95. local original_function = rawequal
  96. local new_function = newcclosure(function(...)
  97. local obj1, obj2 = ...
  98. local Success, Result = pcall(original_function, ...)
  99. if Success then
  100. return Result or (original_function(obj1, Original[obj2]) or original_function(obj2, Original[obj1]))
  101. else
  102. error(Result:gsub(script.Name .. ":%d+: ", ""))
  103. end
  104. end)
  105. Original[new_function] = original_function
  106. original_function = hookfunction(original_function, new_function, true)
  107. end
  108. do
  109. local original_function = metatable.__namecall
  110. local new_function = newcclosure(function(self, ...)
  111. local Arguments = {...}
  112. local Method = (LuaU and getnamecallmethod() or remove(Arguments))
  113. if typeof(Method == "string") and Methods[metatable.__index(self, "ClassName")] == Method and not Settings.RemoteBlacklist[metatable.__index(self, "Name")] then
  114. Write(self, Arguments)
  115. end
  116. return original_function(self, ...);
  117. end)
  118. Original[new_function] = original_function
  119. original_function = hookfunction(original_function, new_function, true)
  120. end
  121. for Class, Method in next, Methods do
  122. local original_function = Instance.new(Class)[Method]
  123. local new_function = newcclosure(function(self, ...)
  124. if typeof(self) == "Instance" and Methods[metatable.__index(self, "ClassName")] == Method and not Settings.RemoteBlacklist[metatable.__index(self, "Name")] then
  125. Write(self, {...})
  126. end
  127. return original_function(self, ...)
  128. end)
  129. Original[new_function] = original_function
  130. original_function = hookfunction(original_function, new_function, true)
  131. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement