NekoMitzi

Royale High 1

Feb 7th, 2020
158
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Lua U Remote Spy written by chaserks (chaserks @ v3rmillion.net, superdude914#3441 @ Discord)
  3. Exploits supported: Synapse X, ProtoSmasher (Sirhurt?, Elysian?)
  4. Remote calls are printed to the dev console by default (F9 window)
  5. To use Synapse's console, change Settings.Output to rconsoleprint
  6. ]]
  7.  
  8. _G.Settings = { --// You can change these settings
  9. Enabled = true, --// Remote spy is enabled
  10. Copy = false, --// Set remote calls to clipboard as code
  11. Blacklist = { --// Ignore remote calls made with these remotes
  12. CharacterSoundEvent = true,
  13. AffirmPos = true,
  14. UpdateHealth = true,
  15. AskCoin = true,
  16. sendjoints = true,
  17. Colinhatesjokuei = true,
  18. CheckDaily = true,
  19. },
  20. ShowScript = true, --// Print out the script that made the remote call (Unfunctional with ProtoSmasher)
  21. ShowReturns = true, --// Display what the remote calls return
  22. Output = warn --// Function used to output remote calls (Change to rconsoleprint to use Synapse's console)
  23. }
  24.  
  25. local metatable = getrawmetatable(game)
  26.  
  27. --// Custom functions aliases
  28. local make_writeable = make_writeable or setreadonly or set_readonly
  29. local detour_function = detour_function or replace_closure or hookfunction
  30. local setclipboard = setclipboard or set_clipboard or writeclipboard
  31. local get_namecall_method = get_namecall_method or getnamecallmethod or function(o)
  32. return typeof(o) == "Instance" and Methods[o.ClassName] or nil
  33. end
  34. local protect_function = protect_function or newcclosure or function(...)
  35. return ...
  36. end
  37.  
  38. --// \\--
  39.  
  40. local Original = {}
  41. local Settings = _G.Settings
  42. local Methods = {
  43. RemoteEvent = "FireServer",
  44. RemoteFunction = "InvokeServer"
  45. }
  46.  
  47. local GetInstanceName = function(Object) --// Returns proper string wrapping for instances
  48. local Name = Object.Name
  49. return ((#Name == 0 or Name:match("[^%w]+") or Name:sub(1, 1):match("[^%a]")) and "[\"%s\"]" or ".%s"):format(Name)
  50. end
  51.  
  52. local function Parse(Object) --// Convert the types into strings
  53. local Type = typeof(Object)
  54. if Type == "string" then
  55. return ("\"%s\""):format(Object)
  56. elseif Type == "Instance" then --// Instance:GetFullName() except it's not handicapped
  57. local Path = GetInstanceName(Object)
  58. local Parent = metatable.__index(Object, "Parent")
  59. while Parent and Parent ~= game do
  60. Path = GetInstanceName(Parent) .. Path
  61. Parent = metatable.__index(Parent, "Parent")
  62. end
  63. return (Object:IsDescendantOf(game) and "game" or "NIL") .. Path
  64. elseif Type == "table" then
  65. local Str = ""
  66. local Counter = 0
  67. for Idx, Obj in next, Object do
  68. Counter = Counter + 1
  69. local Obj = Obj ~= Object and Parse(Obj) or "THIS_TABLE"
  70. if Counter ~= Idx then
  71. Str = Str .. ("[%s] = %s, "):format(Idx ~= Object and Parse(Idx) or "THIS_TABLE", Obj) --maybe
  72. else
  73. Str = Str .. ("%s, "):format(Obj)
  74. end
  75. end
  76. return ("{%s}"):format(Str:sub(1, -3))
  77. elseif Type == "CFrame" or Type == "Vector3" or Type == "Vector2" or Type == "UDim2" or Type == "Color3" or Type == "Vector3int16" then
  78. return ("%s.%s(%s)"):format(Type, Type == "Color3" and "fromRGB" or "new", tostring(Object))
  79. elseif Type == "userdata" then --// Remove __tostring fields to counter traps
  80. local Result
  81. local Metatable = getrawmetatable(Object)
  82. local __tostring = Metatable and Metatable.__tostring
  83. if __tostring then
  84. make_writeable(Metatable, false)
  85. Metatable.__tostring = nil
  86. Result = tostring(Object)
  87. rawset(Metatable, "__tostring", __tostring)
  88. make_writeable(Metatable, rawget(Metatable, "__metatable") ~= nil)
  89. else
  90. Result = tostring(Object)
  91. end
  92. return Result
  93. else
  94. return tostring(Object)
  95. end
  96. end
  97.  
  98. local Write = function(Remote, Arguments, Returns) --// Remote (Instance), Arguments (Table), Returns (Table)
  99. local Stuff = ("%s:%s(%s)\r\n"):format(Parse(Remote), Methods[metatable.__index(Remote, "ClassName")], Parse(Arguments):sub(2, -2))
  100. Settings.Output(Stuff) --// Output the remote call
  101. local _ = Settings.Copy and pcall(setclipboard, Stuff)
  102. if Settings.ShowScript and not PROTOSMASHER_LOADED then
  103. local Env = getfenv(3) --// ProtoSmasher HATES this line (detour_function breaks)
  104. local Script = rawget(Env, "script")
  105. if typeof(Script) == "Instance" then
  106. Settings.Output(("Script: %s"):format(Parse(Script)))
  107. end
  108. end
  109. if Returns and #Returns > 0 then
  110. Settings.Output(("Returned: %s"):format(Parse(Returns):sub(2, -2)))
  111. end
  112. end
  113.  
  114. do --// Anti detection for tostring ( tostring(FireServer, InvokeServer) )
  115. local ORIG = tostring
  116. local new_function = protect_function(function(obj)
  117. local Success, Result = pcall(ORIG or original_function, Original[obj] or obj)
  118. if Success then
  119. return Result
  120. else
  121. error(Result:gsub(script.Name .. ":%d+: ", ""))
  122. end
  123. end)
  124. Original[new_function] = ORIG
  125. ORIG = detour_function(ORIG, new_function, true)
  126. end
  127.  
  128. for Class, Method in next, Methods do --// FireServer and InvokeServer hooking ( FireServer(Remote, ...) )
  129. local ORIG = Instance.new(Class)[Method]
  130. local new_function = protect_function(function(self, ...)
  131. local Returns = {(ORIG or original_function)(self, ...)}
  132. if typeof(self) == "Instance" and Methods[self.ClassName] == Method and not Settings.Blacklist[self.Name] and Settings.Enabled then
  133. Write(self, {...}, Settings.ShowReturns and Returns)
  134. end
  135. return unpack(Returns)
  136. end)
  137. Original[new_function] = ORIG
  138. ORIG = detour_function(ORIG, new_function)
  139. end
  140.  
  141. do --// Namecall hooking ( Remote:FireServer(...) )
  142. local ORIG = metatable.__namecall
  143. local new_function = protect_function(function(self, ...)
  144. local Returns = {(ORIG or original_function)(self, ...)}
  145. local Arguments = {...}
  146. local Method = get_namecall_method(self)
  147. if typeof(Method) == "string" and Methods[self.ClassName] == Method and not Settings.Blacklist[self.Name] and Settings.Enabled then
  148. Write(self, Arguments, Settings.ShowReturns and Returns)
  149. end
  150. return unpack(Returns)
  151. end)
  152. Original[new_function] = ORIG
  153. make_writeable(metatable, false)
  154. metatable.__namecall = new_function
  155. make_writeable(metatable, true)
  156. end
  157.  
  158. warn("Settings:")
  159. table.foreach(Settings, print)
  160. warn("----------------")
RAW Paste Data