Advertisement
Sombody101

RemoteSpy

Apr 7th, 2022 (edited)
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 34.46 KB | None | 0 0
  1. -- [RemoteSpy]: Version 0.8
  2. -- I (u/Sombody101) did not make this: exxtremewa#9394 did
  3. local Players = game:GetService("Players")
  4. local CoreGui = game:GetService("CoreGui")
  5.  
  6. local ScreenGui = Instance.new("ScreenGui")
  7. local main = Instance.new("Frame")
  8. local topbar = Instance.new("Frame")
  9. local minimize = Instance.new("TextButton")
  10. local titleLabel = Instance.new("TextLabel")
  11. local remotes = Instance.new("ScrollingFrame")
  12. local UIListLayout = Instance.new("UIListLayout")
  13. local eTemplate = Instance.new("TextButton")
  14. local icon = Instance.new("ImageLabel")
  15. local name = Instance.new("TextLabel")
  16. local fTemplate = Instance.new("TextButton")
  17. local icon_2 = Instance.new("ImageLabel")
  18. local name_2 = Instance.new("TextLabel")
  19. local properties = Instance.new("Frame")
  20. local codeframe = Instance.new("ScrollingFrame")
  21. codebox = Instance.new("TextBox")
  22. local propertyframe = Instance.new("ScrollingFrame")
  23. local UIListLayout_2 = Instance.new("UIListLayout")
  24. local property = Instance.new("Frame")
  25. local name_3 = Instance.new("TextLabel")
  26. local property_2 = Instance.new("TextButton")
  27. local methodToggle = Instance.new("TextButton")
  28.  
  29. --Properties:
  30.  
  31. ScreenGui.ResetOnSpawn = false
  32. ScreenGui.DisplayOrder = 999999999
  33. ScreenGui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui")
  34. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  35.  
  36. main.Name = "main"
  37. main.Parent = ScreenGui
  38. main.BackgroundColor3 = Color3.new(0.219608, 0.219608, 0.219608)
  39. main.BorderSizePixel = 0
  40. main.Position = UDim2.new(0, 100, 0, 100)
  41. main.Size = UDim2.new(0.5, 0, 0.5, 0)
  42.  
  43. topbar.Name = "topbar"
  44. topbar.Parent = main
  45. topbar.BorderSizePixel = 0
  46. topbar.BackgroundColor3 = Color3.new(0.121569, 0.121569, 0.121569)
  47. topbar.Size = UDim2.new(1, 0, 0, 18)
  48.  
  49. minimize.Name = "minimize"
  50. minimize.Parent = topbar
  51. minimize.BackgroundColor3 = Color3.new(0, 0.105882, 0.792157)
  52. minimize.BorderSizePixel = 0
  53. minimize.Position = UDim2.new(0, 0, 0, 0)
  54. minimize.Size = UDim2.new(0, 18, 0, 18)
  55. minimize.Font = Enum.Font.SourceSans
  56. minimize.Text = ""
  57. minimize.TextColor3 = Color3.new(0, 0, 0)
  58. minimize.TextSize = 14
  59.  
  60. titleLabel.Parent = topbar
  61. titleLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  62. titleLabel.BackgroundTransparency = 1
  63. titleLabel.BorderSizePixel = 0
  64. titleLabel.Position = UDim2.new(0.25, 0, 0, 0)
  65. titleLabel.Size = UDim2.new(0.5, 0, 1, 0)
  66. titleLabel.Font = Enum.Font.SourceSansBold
  67. titleLabel.Text = "By exxtremewa#9394 | Added by u/Sombody101"
  68. titleLabel.TextColor3 = Color3.new(0.905882, 0.905882, 0.905882)
  69. titleLabel.TextSize = 14
  70.  
  71. remotes.Name = "remotes"
  72. remotes.Parent = main
  73. remotes.BackgroundColor3 = Color3.new(1, 1, 1)
  74. remotes.BackgroundTransparency = 1
  75. remotes.BorderSizePixel = 0
  76. remotes.Position = UDim2.new(0, 0, 0, 18)
  77. remotes.Size = UDim2.new(0.5, 0, 1, -18)
  78. remotes.BottomImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  79. remotes.ScrollBarThickness = 10
  80. remotes.TopImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  81.  
  82. UIListLayout.Parent = remotes
  83. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  84.  
  85. eTemplate.Name = "eTemplate"
  86. eTemplate.Text = ""
  87. eTemplate.Parent = remotes
  88. eTemplate.BackgroundColor3 = Color3.new(0.219608, 0.219608, 0.219608)
  89. eTemplate.BorderColor3 = Color3.new(0.8, 0.8, 0.8)
  90. eTemplate.BorderSizePixel = 1
  91. eTemplate.Size = UDim2.new(1, -10, 0, 20)
  92. eTemplate.BorderMode = Enum.BorderMode.Inset
  93.  
  94. icon.Name = "icon"
  95. icon.Parent = eTemplate
  96. icon.BackgroundColor3 = Color3.new(1, 1, 1)
  97. icon.BackgroundTransparency = 1
  98. icon.BorderSizePixel = 0
  99. icon.Size = UDim2.new(0, 18, 0, 18)
  100. icon.Position = UDim2.new(0, 2, 0, 2)
  101. icon.Image = "http://www.roblox.com/asset/?id=4640035463"
  102. icon.ScaleType = Enum.ScaleType.Fit
  103.  
  104. name.Name = "name"
  105. name.Parent = eTemplate
  106. name.BackgroundColor3 = Color3.new(1, 1, 1)
  107. name.BackgroundTransparency = 1
  108. name.Position = UDim2.new(0, 25, 0, 0)
  109. name.Size = UDim2.new(1, -25, 1, 0)
  110. name.Font = Enum.Font.SourceSansBold
  111. name.Text = "RemoteEventName"
  112. name.TextColor3 = Color3.new(0.976471, 0.921569, 0.121569)
  113. name.TextSize = 14
  114. name.TextXAlignment = Enum.TextXAlignment.Left
  115.  
  116. fTemplate.Name = "fTemplate"
  117. fTemplate.Text = ""
  118. fTemplate.Parent = remotes
  119. fTemplate.BackgroundColor3 = Color3.new(0.219608, 0.219608, 0.219608)
  120. fTemplate.BorderColor3 = Color3.new(0.8, 0.8, 0.8)
  121. fTemplate.BorderSizePixel = 1
  122. fTemplate.Size = UDim2.new(1, -10, 0, 20)
  123. fTemplate.BorderMode = Enum.BorderMode.Inset
  124.  
  125. icon_2.Name = "icon"
  126. icon_2.Parent = fTemplate
  127. icon_2.BackgroundColor3 = Color3.new(1, 1, 1)
  128. icon_2.BackgroundTransparency = 1
  129. icon_2.BorderSizePixel = 0
  130. icon_2.Size = UDim2.new(0, 18, 0, 18)
  131. icon_2.Position = UDim2.new(0, 2, 0, 2)
  132. icon_2.Image = "http://www.roblox.com/asset/?id=4640035282"
  133. icon_2.ScaleType = Enum.ScaleType.Fit
  134.  
  135. name_2.Name = "name"
  136. name_2.Parent = fTemplate
  137. name_2.BackgroundColor3 = Color3.new(1, 1, 1)
  138. name_2.BackgroundTransparency = 1
  139. name_2.Position = UDim2.new(0, 25, 0, 0)
  140. name_2.Size = UDim2.new(1, -25, 1, 0)
  141. name_2.Font = Enum.Font.SourceSansBold
  142. name_2.Text = "RemoteFunctionName"
  143. name_2.TextColor3 = Color3.new(0.666667, 0.12549, 1)
  144. name_2.TextSize = 14
  145. name_2.TextXAlignment = Enum.TextXAlignment.Left
  146.  
  147. properties.Name = "properties"
  148. properties.Parent = main
  149. properties.BackgroundColor3 = Color3.new(1, 1, 1)
  150. properties.BackgroundTransparency = 1
  151. properties.Position = UDim2.new(0.5, 0, 0, 18)
  152. properties.Size = UDim2.new(0.5, 0, 1, -18)
  153.  
  154. codeframe.Name = "codeframe"
  155. codeframe.Parent = properties
  156. codeframe.BackgroundColor3 = Color3.new(1, 1, 1)
  157. codeframe.BackgroundTransparency = 1
  158. codeframe.Size = UDim2.new(1, 0, 0.5, 0)
  159. codeframe.BottomImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  160. codeframe.ScrollBarThickness = 10
  161. codeframe.TopImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  162.  
  163. codebox.Name = "codebox"
  164. codebox.Parent = codeframe
  165. codebox.BackgroundColor3 = Color3.new(0.0784314, 0.0784314, 0.0784314)
  166. codebox.BorderSizePixel = 0
  167. codebox.Selectable = true
  168. codebox.Size = UDim2.new(1, -10, 1, 0)
  169. codebox.Font = Enum.Font.SourceSansSemibold
  170. codebox.Text = "{\\n    [1] = true\\n}"
  171. codebox.TextColor3 = Color3.new(0.827451, 0.827451, 0.827451)
  172. codebox.TextSize = 14
  173. codebox.TextXAlignment = Enum.TextXAlignment.Left
  174. codebox.TextYAlignment = Enum.TextYAlignment.Top
  175. codebox.ClearTextOnFocus = false
  176.  
  177. propertyframe.Name = "propertyframe"
  178. propertyframe.Parent = properties
  179. propertyframe.BackgroundColor3 = Color3.new(0.141176, 0.141176, 0.141176)
  180. propertyframe.BorderSizePixel = 0
  181. propertyframe.Position = UDim2.new(0, 0, 0.5, 0)
  182. propertyframe.Size = UDim2.new(1, 0, 0.5, 0)
  183. propertyframe.BottomImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  184. propertyframe.ScrollBarThickness = 10
  185. propertyframe.TopImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  186.  
  187. UIListLayout_2.Parent = propertyframe
  188. UIListLayout_2.SortOrder = Enum.SortOrder.LayoutOrder
  189.  
  190. property.Name = "property"
  191. property.Parent = propertyframe
  192. property.BackgroundColor3 = Color3.new(0.164706, 0.164706, 0.164706)
  193. property.BorderColor3 = Color3.new(0.415686, 0.415686, 0.415686)
  194. property.BorderSizePixel = 0
  195. property.Size = UDim2.new(1, -10, 0, 15)
  196.  
  197. name_3.Name = "name"
  198. name_3.Parent = property
  199. name_3.BackgroundColor3 = Color3.new(0.164706, 0.164706, 0.164706)
  200. name_3.BorderColor3 = Color3.new(0.478431, 0.478431, 0.478431)
  201. name_3.Size = UDim2.new(0.400000006, 0, 1, 0)
  202. name_3.Font = Enum.Font.SourceSans
  203. name_3.Text = "Name"
  204. name_3.TextColor3 = Color3.new(0.909804, 0.909804, 0.909804)
  205. name_3.TextSize = 14
  206. name_3.TextXAlignment = Enum.TextXAlignment.Left
  207.  
  208. property_2.Name = "property"
  209. property_2.Parent = property
  210. property_2.BackgroundColor3 = Color3.new(0.0941177, 0.0941177, 0.0941177)
  211. property_2.BorderColor3 = Color3.new(0.478431, 0.478431, 0.478431)
  212. property_2.Position = UDim2.new(0.300000012, 0, 0, 0)
  213. property_2.Size = UDim2.new(0.699999988, 0, 1, 0)
  214. property_2.Font = Enum.Font.SourceSans
  215. property_2.Text = "Function"
  216. property_2.TextColor3 = Color3.new(0.909804, 0.909804, 0.909804)
  217. property_2.TextSize = 14
  218. property_2.TextXAlignment = Enum.TextXAlignment.Left
  219.  
  220. methodToggle.Name = "MethodToggle"
  221. methodToggle.Parent = topbar
  222. methodToggle.BackgroundColor3 = Color3.new(0.7450980392156863, 0.7450980392156863, 0.7450980392156863)
  223. methodToggle.BorderSizePixel = 0
  224. methodToggle.Position = UDim2.new(1, -80, 0, 0)
  225. methodToggle.Size = UDim2.new(0, 80, 1, 0)
  226. methodToggle.TextScaled = true
  227. methodToggle.Font = Enum.Font.SourceSans
  228.  
  229. -------------------------------------------------------------------------------
  230. -- init
  231. local RunService = game:GetService("RunService")
  232. local UserInputService = game:GetService("UserInputService")
  233. local TweenService = game:GetService("TweenService")
  234. local ContentProvider = game:GetService("ContentProvider")
  235.  
  236. --- UDim2 size of `main` while minimized
  237. local minSize = UDim2.new(0, 100, 0, 15)
  238. --- UDim2 size of `main` while expanded
  239. local mainSize = main.Size
  240. local selectedColor = Color3.new(0.321569, 0.333333, 1)
  241. local deselectedColor = Color3.new(0.8, 0.8, 0.8)
  242. --- So things are descending
  243. local layoutOrderNum = 999999999
  244. --- Whether or not the gui is closed (defaults to false)
  245. closed = false
  246. --- The event logs to be read from
  247. logs = {}
  248. --- The event currently selected.Log (defaults to nil)
  249. selected = nil
  250. --- The blacklist (can be a string name or the Remote Instance)
  251. blacklist = {}
  252. --- The block list (can be a string name or the Remote Instance)
  253. blocklist = {}
  254. --- Whether or not to add getNil function
  255. local getNil = false
  256. --- Array of remotes (and original functions) connected to
  257. local connectedRemotes = {}
  258. --- True = hookfunction, false = namecall
  259. local toggle = false
  260. local gm = getrawmetatable(game)
  261. local original = gm.__namecall
  262. setreadonly(gm, false)
  263. --- This event is the main handler for remotes
  264. local remoteHandlerEvent = Instance.new("BindableEvent")
  265.  
  266. -- functions
  267.  
  268. --- Toggles the remote spy method (when button clicked)
  269. function onToggleButtonClick()
  270.     if toggle then
  271.         methodToggle.Text = "Disabled"
  272.     else
  273.         methodToggle.Text = "Enabled"
  274.     end
  275.     toggleSpyMethod()
  276. end
  277.  
  278. --- Drags gui (so long as mouse is held down)
  279. function onBarInput(input)
  280.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  281.         local lastPos = UserInputService:GetMouseLocation()
  282.         RunService:BindToRenderStep(
  283.             "drag",
  284.             1,
  285.             function()
  286.                 local newPos = UserInputService:GetMouseLocation()
  287.                 if newPos ~= lastPos then
  288.                     main.Position =
  289.                         UDim2.new(
  290.                             0,
  291.                             main.Position.X.Offset + (newPos - lastPos).X,
  292.                             0,
  293.                             main.Position.Y.Offset + (newPos - lastPos).Y
  294.                         )
  295.                     lastPos = newPos
  296.                 end
  297.             end
  298.         )
  299.         topbar.InputEnded:Connect(
  300.             function(input)
  301.                 if input.UserInputType == Enum.UserInputType.MouseButton1 then
  302.                     RunService:UnbindFromRenderStep("drag")
  303.                 end
  304.             end
  305.         )
  306.     end
  307. end
  308.  
  309. --- Expands and minimizes the gui (closed is the toggle boolean)
  310. function toggleMinimize()
  311.     if not closed then
  312.         closed = not closed
  313.         remotes.Visible = false
  314.         properties.Visible = false
  315.         titleLabel.Visible = false
  316.         methodToggle.Visible = false
  317.         TweenService:Create(main, TweenInfo.new(0.5), {Size = minSize}):Play()
  318.     else
  319.         closed = not closed
  320.         TweenService:Create(main, TweenInfo.new(0.5), {Size = mainSize}):Play()
  321.         wait(0.5)
  322.         methodToggle.Visible = true
  323.         remotes.Visible = true
  324.         properties.Visible = true
  325.         titleLabel.Visible = true
  326.     end
  327. end
  328.  
  329. --- Checks if the given Remote is blacklisted; returns true if blacklisted, false if not
  330. function blacklisted(remote)
  331.     if #blacklist > 0 then
  332.         for _, v in pairs(blacklist) do
  333.             if type(v) == "string" and v == remote.Name then
  334.                 return true
  335.             elseif typeof(v) == "Instance" and v == remote then
  336.                 return true
  337.             end
  338.         end
  339.     end
  340.     return false
  341. end
  342.  
  343. --- Checks if the given Remote is blocked; returns true if blacklisted, false if not
  344. function blocked(remote)
  345.     if #blocklist > 0 then
  346.         for _, v in pairs(blocklist) do
  347.             if type(v) == "string" and v == remote.Name then
  348.                 return true
  349.             elseif typeof(v) == "Instance" and v == remote then
  350.                 return true
  351.             end
  352.         end
  353.     end
  354.     return false
  355. end
  356.  
  357. --- Runs on MouseButton1Click of an event frame
  358. function eventSelect(frame)
  359.     if --[[input.UserInputType == Enum.UserInputType.MouseButton1 and]] (not selected or selected.Log ~= frame) then
  360.         if selected then
  361.             TweenService:Create(selected.Log, TweenInfo.new(0.5), {BorderColor3 = deselectedColor, BorderSizePixel = 1}):Play(
  362.  
  363.             )
  364.             selected = nil
  365.         end
  366.         for _, v in pairs(logs) do
  367.             if frame == v.Log then
  368.                 selected = v
  369.             end
  370.         end
  371.         if selected then
  372.             TweenService:Create(selected.Log, TweenInfo.new(0.5), {BorderColor3 = selectedColor, BorderSizePixel = 2}):Play(
  373.  
  374.             )
  375.             codebox.Text = selected.GenScript
  376.         end
  377.     end
  378. end
  379.  
  380. --- Creates new function button (below codebox)
  381. function newButton(name, defaultName, onClick)
  382.     local button = property:Clone()
  383.     button.name.Text = name
  384.     button.property.Text = defaultName
  385.     button.property.MouseButton1Click:Connect(
  386.         function(...)
  387.             if selected then
  388.                 onClick(button.property, ...)
  389.             end
  390.         end
  391.     )
  392.     button.Parent = propertyframe
  393. end
  394.  
  395. --- Adds new RemoteEvent to logs
  396. function newEvent(name, gen_script, remote, source_script, blocked, upvalues, constants, num)
  397.     local remoteFrame = eTemplate:Clone()
  398.     remoteFrame.name.Text = name
  399.     local id = Instance.new("IntValue")
  400.     id.Name = "ID"
  401.     id.Value = #logs + 1
  402.     id.Parent = remoteFrame
  403.     logs[#logs + 1] = {
  404.         Name = name,
  405.         GenScript = gen_script,
  406.         Source = source_script,
  407.         Remote = remote,
  408.         Log = remoteFrame,
  409.         Upvalues = upvalues,
  410.         Constants = constants,
  411.         Blocked = blocked,
  412.         FunNum = num
  413.     }
  414.     if blocked then
  415.         logs[#logs].GenScript = "-- THIS REMOTE WAS PREVENTED FROM FIRING THE SERVER BY SIMPLESPY\n\n" .. logs[#logs].GenScript
  416.     end
  417.     remoteFrame.MouseButton1Click:Connect(
  418.         function(...)
  419.             eventSelect(remoteFrame, ...)
  420.         end
  421.     )
  422.     if layoutOrderNum < 1 then
  423.         layoutOrderNum = 999999999
  424.     end
  425.     remoteFrame.LayoutOrder = layoutOrderNum
  426.     layoutOrderNum = layoutOrderNum - 1
  427.     remoteFrame.Parent = remotes
  428. end
  429.  
  430. --- Adds new RemoteFunction to logs
  431. function newFunction(name, gen_script, remote, source_script, blocked, upvalues, constants, num)
  432.     local remoteFrame = fTemplate:Clone()
  433.     remoteFrame.name.Text = name
  434.     local id = Instance.new("IntValue")
  435.     id.Name = "ID"
  436.     id.Value = #logs + 1
  437.     id.Parent = remoteFrame
  438.     logs[#logs + 1] = {
  439.         Name = name,
  440.         GenScript = gen_script,
  441.         Source = source_script,
  442.         Remote = remote,
  443.         Log = remoteFrame,
  444.         Upvalues = upvalues,
  445.         Constants = constants,
  446.         Blocked = blocked,
  447.         FunNum = num
  448.     }
  449.     if blocked then
  450.         logs[#logs].GenScript = "-- THIS REMOTE WAS PREVENTED FROM FIRING THE SERVER BY SIMPLESPY\n\n" .. logs[#logs].GenScript
  451.     end
  452.     remoteFrame.MouseButton1Click:Connect(
  453.         function(...)
  454.             eventSelect(remoteFrame, ...)
  455.         end
  456.     )
  457.     if layoutOrderNum < 1 then
  458.         layoutOrderNum = 999999999
  459.     end
  460.     remoteFrame.LayoutOrder = layoutOrderNum
  461.     layoutOrderNum = layoutOrderNum - 1
  462.     remoteFrame.Parent = remotes
  463. end
  464.  
  465. --- Generates a script from the provided arguments (first has to be remote path)
  466. function genScript(remote, ...)
  467.     local gen = ""
  468.     local args = {...}
  469.     if #args > 0 then
  470.         if
  471.             not pcall(
  472.                 function()
  473.                     gen = gen .. "local args = " .. tableToString(args) .. "\n\n"
  474.                 end
  475.             )
  476.         then
  477.             gen =
  478.                 gen .. "-- TableToString failure! Reverting to legacy functionality (results may vary)\nlocal args = {"
  479.             if
  480.                 not pcall(
  481.                     function()
  482.                         for i, v in pairs(args) do
  483.                             if type(i) ~= "Instance" and type(i) ~= "userdata" then
  484.                                 gen = gen .. "\n    [" .. tostring(i) .. "] = "
  485.                             elseif type(i) == "string" then
  486.                                 gen = gen .. '\n    ["' .. tostring(i) .. '"] = '
  487.                             elseif type(i) == "userdata" and typeof(i) ~= "Instance" then
  488.                                 gen = gen .. "\n    [" .. typeof(i) .. ".new(" .. tostring(i) .. ")] = "
  489.                             elseif type(i) == "userdata" then
  490.                                 gen = gen .. "\n    [game." .. i:GetFullName() .. ")] = "
  491.                             end
  492.                             if type(v) ~= "Instance" and type(v) ~= "userdata" then
  493.                                 gen = gen .. tostring(v)
  494.                             elseif type(v) == "string" then
  495.                                 gen = gen .. '"' .. tostring(v) .. '"'
  496.                             elseif type(v) == "userdata" and typeof(v) ~= "Instance" then
  497.                                 gen = gen .. typeof(v) .. ".new(" .. tostring(v) .. ")"
  498.                             elseif type(v) == "userdata" then
  499.                                 gen = gen .. "game." .. v:GetFullName()
  500.                             end
  501.                         end
  502.                         gen = gen .. "\n}\n\n"
  503.                     end
  504.                 )
  505.             then
  506.                 gen = gen .. "}\n-- Legacy tableToString failure! Unable to decompile."
  507.             end
  508.         end
  509.         if remote:IsA("RemoteEvent") then
  510.             gen = gen .. typeToString(remote) .. ":FireServer(unpack(args))"
  511.         elseif remote:IsA("RemoteFunction") then
  512.             gen = gen .. typeToString(remote) .. ":InvokeServer(unpack(args))"
  513.         end
  514.     else
  515.         if remote:IsA("RemoteEvent") then
  516.             gen = gen .. typeToString(remote) .. ":FireServer()"
  517.         elseif remote:IsA("RemoteFunction") then
  518.             gen = gen .. typeToString(remote) .. ":InvokeServer()"
  519.         end
  520.     end
  521.     if getNil then
  522.         gen =
  523.             "function getNil(name,class) for _,v in pairs(getnilinstances())do if v.ClassName==class and v.Name==name then return v;end end end\n\n" ..
  524.             gen
  525.         getNil = false
  526.     end
  527.     gen =
  528.         "credits to exxtremewa#9394 Added by u/Sombody101\n" ..
  529.         gen
  530.     return gen
  531. end
  532.  
  533. --- Generates spaces based on the provided level
  534. function space(level)
  535.     local out = ""
  536.     for i = 1, level do
  537.         out = out .. " "
  538.     end
  539.     return out
  540. end
  541.  
  542. --- Adds \'s to the text as a replacement to whitespace chars and other things
  543. function getSpecials(s, nested)
  544.     if not nested then
  545.         s = s:gsub("\\", "\\\\")
  546.     end
  547.     if s:match("\n") then
  548.         local pos, pos2 = s:find("\n")
  549.         s = s:sub(0, pos - 1) .. "\\n" .. s:sub(pos2 + 1, s:len())
  550.         return getSpecials(s, true)
  551.     elseif s:match("\t") then
  552.         local pos, pos2 = s:find("\t")
  553.         s = s:sub(0, pos - 1) .. "\\t" .. s:sub(pos2 + 1, s:len())
  554.         return getSpecials(s, true)
  555.     elseif s:match("\t") then
  556.         local pos, pos2 = s:find("\t")
  557.         s = s:sub(0, pos - 1) .. "\\t" .. s:sub(pos2 + 1, s:len())
  558.         return getSpecials(s, true)
  559.     elseif s:match("\"") and (s:sub(s:find("\"") - 1, s:find("\"") - 1) ~= "\\") then
  560.         local pos, pos2 = s:find("\"")
  561.         s = s:sub(0, pos - 1) .. "\\\"" .. s:sub(pos2 + 1, s:len())
  562.         return getSpecials(s, true)
  563.     elseif s:match("'") and (s:sub(s:find("'") - 1, s:find("'") - 1) ~= "\\") then
  564.         local pos, pos2 = s:find("'")
  565.         s = s:sub(0, pos - 1) .. "\\'" .. s:sub(pos2 + 1, s:len())
  566.         return getSpecials(s, true)
  567.     else
  568.         return s
  569.     end
  570. end
  571.  
  572. --- Converts a var to a string (including userdata)
  573. function typeToString(var, level)
  574.     if not level then
  575.         level = 4
  576.     end
  577.     local out = ""
  578.     if type(var) ~= "userdata" and type(var) ~= "table" and type(var) ~= "string" then
  579.         -- Number, booleans
  580.         out = out .. tostring(var)
  581.     elseif type(var) == "string" then
  582.         -- Strings
  583.         out = out .. '"' .. getSpecials(var) .. '"'
  584.     elseif type(var) == "table" then
  585.         -- Tables
  586.         out = out .. tableToString(var, level)
  587.     elseif typeof(var) == "TweenInfo" then
  588.         -- TweenInfo
  589.         out =
  590.             out ..
  591.             "TweenInfo.new(" ..
  592.             tostring(var.Time) ..
  593.             ", Enum.EasingStyle." ..
  594.             tostring(var.EasingStyle) ..
  595.             ", Enum.EasingDirection." ..
  596.             tostring(var.EasingDirection) ..
  597.             ", " ..
  598.             tostring(var.RepeatCount) ..
  599.             ", " .. tostring(var.Reverses) .. ", " .. tostring(var.DelayTime) .. ")"
  600.     elseif typeof(var) == "Ray" then
  601.         -- Ray
  602.         out =
  603.             out ..
  604.             "Ray.new(Vector3.new(" .. tostring(var.Origin) .. "), Vector3.new(" .. tostring(var.Direction) .. "))"
  605.     elseif typeof(var) == "NumberSequence" then
  606.         -- NumberSequence
  607.         out = out .. "NumberSequence.new("
  608.         for i, v in pairs(var.KeyPoints) do
  609.             out = out .. tostring(v)
  610.             if i < #var.Keypoints then
  611.                 out = out .. ", "
  612.             end
  613.         end
  614.         out = out .. ")"
  615.     elseif typeof(var) == "DockWidgetPluginGuiInfo" then
  616.         -- DockWidgetPluginGuiInfo
  617.         out = out .. "DockWidgetPluginGuiInfo.new(Enum.InitialDockState" .. tostring(var) .. ")"
  618.     elseif typeof(var) == "ColorSequence" then
  619.         -- ColorSequence
  620.         out = out .. "ColorSequence.new("
  621.         for i, v in pairs(var.KeyPoints) do
  622.             out = out .. "Color3.new(" .. tostring(v) .. ")"
  623.             if i < #var.Keypoints then
  624.                 out = out .. ", "
  625.             end
  626.         end
  627.         out = out .. ")"
  628.     elseif typeof(var) == "BrickColor" then
  629.         -- BrickColor
  630.         out = out .. "BrickColor.new(" .. tostring(var.Number) .. ")"
  631.     elseif typeof(var) == "NumberRange" then
  632.         -- NumberRange
  633.         out = out .. "NumberRange.new(" .. tostring(var.Min) .. ", " .. tostring(var.Max) .. ")"
  634.     elseif typeof(var) == "Region3" then
  635.         -- Region3
  636.         local center = var.CFrame.Position
  637.         local size = var.CFrame.Size
  638.         local vector1 = center - size / 2
  639.         local vector2 = center + size / 2
  640.         out = out .. "Region3.new(Vector3.new(" .. tostring(vector1) .. "), Vector3.new(" .. tostring(vector2) .. ")"
  641.     elseif type(var) == "userdata" and typeof(var) ~= "Instance" then
  642.         -- Default userdata (no instances)
  643.         local dataName = typeof(var)
  644.         local args = tostring(var)
  645.         for i = 1, args:len() do
  646.             if args:sub(i, i) == "}" or args:sub(i, i) == "{" then
  647.                 if i > 1 and i < args:len() then
  648.                     args = args:sub(1, i - 1) .. " " .. args:sub(i + 1, args:len())
  649.                 elseif i == 1 then
  650.                     args = " " .. args:sub(i + 1, args:len())
  651.                 elseif i == args:len() then
  652.                     args = args:sub(1, i - 1) .. " "
  653.                 end
  654.             end
  655.         end
  656.         out = out .. dataName .. ".new(" .. args .. ")"
  657.     elseif type(var) == "userdata" and typeof(var) == "Instance" then
  658.         -- Instances
  659.         local parent = var
  660.         if parent == nil then
  661.             out = "nil"
  662.         elseif parent ~= game then
  663.             while true do
  664.                 if parent and parent.Parent == game then
  665.                     if game:GetService(parent.ClassName) then
  666.                         if parent.ClassName == "Workspace" then
  667.                             out = "workspace" .. out
  668.                         else
  669.                             out = 'game:GetService("' .. parent.ClassName .. '")' .. out
  670.                         end
  671.                         break
  672.                     else
  673.                         out = 'game["' .. getSpecials(parent.Name) .. '"]'
  674.                         break
  675.                     end
  676.                 elseif parent.Parent == nil then
  677.                     getNil = true
  678.                     out = 'getNil("' .. getSpecials(parent.Name) .. '", "' .. parent.ClassName .. '")'
  679.                     break
  680.                 else
  681.                     if parent.Name:match("%a+") ~= parent.Name then
  682.                         out = '["' .. getSpecials(parent.Name) .. '"]' .. out
  683.                     else
  684.                         out = "." .. parent.Name .. out
  685.                     end
  686.                 end
  687.                 parent = parent.Parent
  688.             end
  689.         else
  690.             out = "game"
  691.         end
  692.         -- legacy method
  693.         -- out = out .. "game." .. var:GetFullName() .. ","
  694.     end
  695.     return out
  696. end
  697.  
  698. --- Converts a table to a string (includes nested tables)
  699. function tableToString(t, level)
  700.     if type(level) ~= "number" then
  701.         level = 4
  702.     else
  703.         level = level + 4
  704.     end
  705.     local out = ""
  706.     for i, v in pairs(t) do
  707.         out = out .. "\n" .. space(level) .. "[" .. typeToString(i, level) .. "] = " .. typeToString(v, level) .. ","
  708.     end
  709.     out = "{" .. out .. "\n" .. space(level - 4) .. "}"
  710.     return out
  711. end
  712.  
  713. --- Toggles on and off the Hookfunction remote spy method (DISABLED- will not run)
  714. function toggleHook()
  715.     if toggle then
  716.         -- local function connect(remote)
  717.         --     spawn(
  718.         --         function()
  719.         --             if remote:IsA("RemoteEvent") then
  720.         --                 local old
  721.         --                 old =
  722.         --                     hookfunction(
  723.         --                     remote.FireServer,
  724.         --                     function(...)
  725.         --                         newEvent(remote.Name, genScript(remote, ...), remote, rawget(getfenv(2), "script"))
  726.         --                         return old(...)
  727.         --                     end
  728.         --                 )
  729.         --                 table.insert(connectedRemotes, {remote, old})
  730.         --             elseif remote:IsA("RemoteFunction") then
  731.         --                 local old
  732.         --                 old =
  733.         --                     hookfunction(
  734.         --                     remote.InvokeServer,
  735.         --                     function(...)
  736.         --                         newEvent(remote.Name, genScript(remote, ...), remote, rawget(getfenv(2), "script"))
  737.         --                         return old(...)
  738.         --                     end
  739.         --                 )
  740.         --                 table.insert(connectedRemotes, {remote, old})
  741.         --             end
  742.         --         end
  743.         --     )
  744.         -- end
  745.         -- game.ChildAdded:Connect(
  746.         --     function(c)
  747.         --         pcall(
  748.         --             function()
  749.         --                 if c:IsA("RemoteEvent") and c:IsA("RemoteFunction") then
  750.         --                     connect(c)
  751.         --                 end
  752.         --             end
  753.         --         )
  754.         --     end
  755.         -- )
  756.         -- spawn(
  757.         --     function()
  758.         --         for _, v in pairs(game:GetDescendants()) do
  759.         --             if toggle then
  760.         --                 pcall(
  761.         --                     function()
  762.         --                         if v:IsA("RemoteEvent") or v:IsA("RemoteFunction") then
  763.         --                             connect(v)
  764.         --                         end
  765.         --                     end
  766.         --                 )
  767.         --                 wait()
  768.         --             end
  769.         --         end
  770.         --     end
  771.         -- )
  772.     else
  773.         -- for _, v in pairs(connectedRemotes) do
  774.         --     if v[1] and v[2] then
  775.         --         if v[1]:IsA("RemoteEvent") then
  776.         --             hookfunction(v[1].FireServer, v[2])
  777.         --         elseif v[1]:IsA("RemoteFunction") then
  778.         --             hookfunction(v[1].InvokeServer, v[2])
  779.         --         end
  780.         --     end
  781.         -- end
  782.         -- connectedRemotes = {}
  783.     end
  784. end
  785.  
  786. --- Toggles on and off the namecall remote spy method
  787. function toggleNamecall()
  788.     if not toggle then
  789.         gm.__namecall = function(...)
  790.             local args = {...}
  791.             local remote = args[1]
  792.             local methodName = getnamecallmethod()
  793.             if methodName == "FireServer" and not blacklisted(remote) then
  794.                 table.remove(args, 1)
  795.                 local script = rawget(getfenv(2), "script")
  796.                 local func = debug.getinfo(2).func
  797.                 spawn(
  798.                     function()
  799.                         local funNum
  800.                         for i, v in pairs(getgc()) do
  801.                             if v == func then
  802.                                 funNum = i
  803.                                 break
  804.                             end
  805.                         end
  806.                         remoteHandlerEvent:Fire("RemoteEvent", remote.Name, genScript(remote, unpack(args)), remote, script, blocked(remote), tableToString(debug.getupvalues(func)), tableToString(debug.getconstants(func)), funNum)
  807.                     end
  808.                 )
  809.             elseif methodName == "InvokeServer" and not blacklisted(remote) then
  810.                 table.remove(args, 1)
  811.                 local script = rawget(getfenv(2), "script")
  812.                 local func = debug.getinfo(2).func
  813.                 spawn(
  814.                     function()
  815.                         local funNum
  816.                         for i, v in pairs(getgc()) do
  817.                             if v == func then
  818.                                 funNum = i
  819.                                 break
  820.                             end
  821.                         end
  822.                         remoteHandlerEvent:Fire("RemoteFunction", remote.Name, genScript(remote, unpack(args)), remote, script, blocked(remote), tableToString(debug.getupvalues(func)), tableToString(debug.getconstants(func)), funNum)
  823.                     end
  824.                 )
  825.             end
  826.             if (methodName == "InvokeServer" or methodName == "FireServer") and blocked(remote) then
  827.                 return nil
  828.             else
  829.                 return original(...)
  830.             end
  831.         end
  832.     else
  833.         gm.__namecall = original
  834.     end
  835. end
  836.  
  837. --- Toggles between the two remotespy methods (hookfunction currently = disabled)
  838. function toggleSpyMethod()
  839.     toggleHook()
  840.     toggleNamecall()
  841.     toggle = not toggle
  842. end
  843.  
  844. --- Handles the button creation things... Connected to `remoteHandlerEvent`
  845. function bindableHandler(type, ...)
  846.     if type == "RemoteEvent" then
  847.         newEvent(...)
  848.     elseif type == "RemoteFunction" then
  849.         newFunction(...)
  850.     end
  851. end
  852.  
  853. -- main
  854. if not _G.SimpleSpyExecuted then
  855.     ContentProvider:PreloadAsync({icon, icon_2})
  856.     property.Parent = nil
  857.     fTemplate.Parent = nil
  858.     eTemplate.Parent = nil
  859.     codebox.Text = ""
  860.     topbar.InputBegan:Connect(onBarInput)
  861.     minimize.MouseButton1Click:Connect(toggleMinimize)
  862.     methodToggle.MouseButton1Click:Connect(onToggleButtonClick)
  863.     remoteHandlerEvent.Event:Connect(bindableHandler)
  864.     onToggleButtonClick()
  865.     _G.SimpleSpyExecuted = true
  866. else
  867.     ScreenGui:Destroy()
  868.     collectgarbage()
  869. end
  870.  
  871. ----- ADD ONS ----- (easily add or remove additonal functionality to the RemoteSpy!)
  872. --[[
  873.     Some helpful things:
  874.         - add your function in here, and create buttons for them through the 'newButton' function
  875.         - the first argument provided is the TextButton the player clicks to run the function
  876.         - generated scripts are generated when the namecall is initially fired and saved in remoteFrame objects
  877.         - blacklisted remotes will be ignored directly in namecall (less lag)
  878.         - the properties of a 'remoteFrame' object:
  879.             {
  880.                 Name: (string) The name of the Remote
  881.                 GenScript: (string) The generated script that appears in the codebox (generated when namecall fired)
  882.                 Source: (Instance (LocalScript)) The script that fired/invoked the remote
  883.                 Remote: (Instance (RemoteEvent) | Instance (RemoteFunction)) The remote that was fired/invoked
  884.                 Log: (Instance (TextButton)) The button being used for the remote (same as 'selected.Log')
  885.             }
  886.         - globals list: (contact @exxtremewa#9394 for more information or if you have suggestions for more to be added)
  887.             - closed: (boolean) whether or not the GUI is currently minimized
  888.             - logs: (table[remoteFrame]) full of remoteFrame objects (properties listed above)
  889.             - selected: (remoteFrame) the currently selected remoteFrame (properties listed above)
  890.             - blacklist: (string[] | Instance[] (RemoteEvent) | Instance[] (RemoteFunction)) an array of blacklisted names and remotes
  891.             - codebox: (Instance (TextBox)) the textbox that holds all the code- cleared often
  892. ]]
  893. -- Copies the contents of the codebox
  894. newButton(
  895.     "Copy Code",
  896.     "Click to copy code",
  897.     function(button)
  898.         local orText = "Click to copy code"
  899.         syn.write_clipboard(codebox.Text)
  900.         button.Text = "Copied successfully!"
  901.         wait(2)
  902.         button.Text = orText
  903.     end
  904. )
  905.  
  906. --- Copies the source script (that fired the remote)
  907. newButton(
  908.     "Copy Remote",
  909.     "Click to copy the path of the remote",
  910.     function(button)
  911.         local orText = "Click to copy the path of the remote"
  912.         syn.write_clipboard(typeToString(selected.Remote))
  913.         button.Text = "Copied!"
  914.         wait(3)
  915.         button.Text = orText
  916.     end
  917. )
  918.  
  919. --- Copies the source script (that fired the remote)
  920. newButton(
  921.     "Copy Source",
  922.     "Click to copy the path of the source script",
  923.     function(button)
  924.         local orText = "Click to copy the path of the source script"
  925.         syn.write_clipboard(typeToString(selected.Source))
  926.         button.Text = "Copied!"
  927.         wait(3)
  928.         button.Text = orText
  929.     end
  930. )
  931.  
  932. --- Puts the upvalues from the remote into the console for your viewing pleasure... (also puts function #)
  933. newButton(
  934.     "Get Upvalues",
  935.     "Click to get the upvalues from the source",
  936.     function(button)
  937.         local orText = "Click to get upvalues from the source script"
  938.         codebox.Text = "-- Serialized with SimpleSpy's TableToString! (credits to @exxtremewa#9394)\n-- (getgc) Function #" .. tostring(selected.FunNum) .. "\n\n" .. selected.Upvalues
  939.         button.Text = "Put in Code Box!"
  940.         wait(3)
  941.         button.Text = orText
  942.     end
  943. )
  944.  
  945. --- Puts the constants from the remote into the console for your viewing pleasure... (also puts function #)
  946. newButton(
  947.     "Get Constants",
  948.     "Click to get the constants from the source",
  949.     function(button)
  950.         local orText = "Click to get constants from the source script"
  951.         codebox.Text = "-- Serialized with SimpleSpy's TableToString! (credits to @exxtremewa#9394)\n-- (getgc) Function #" .. tostring(selected.FunNum) .. "\n\n" .. selected.Constants
  952.         button.Text = "Put in Code Box!"
  953.         wait(3)
  954.         button.Text = orText
  955.     end
  956. )
  957.  
  958. --- Decompiles the script that fired the remote and puts it in the code box
  959. newButton(
  960.     "Decompile Source",
  961.     "Click to decompile the source script",
  962.     function(button)
  963.         local orText = "Click to decompile the source script"
  964.         codebox.Text = "-- Decompiled code from:\n-- " .. typeToString(selected.Source) .. "\n\n" .. decompile(selected.Source)
  965.         button.Text = "Decompiled!"
  966.         wait(3)
  967.         button.Text = orText
  968.     end
  969. )
  970.  
  971. -- Executes the contents of the codebox through loadstring
  972. newButton(
  973.     "Run Code",
  974.     "Click to execute code",
  975.     function(button)
  976.         local orText = "Click to execute code"
  977.         button.Text = "Executing..."
  978.         local execute = {
  979.             pcall(
  980.                 function()
  981.                     return loadstring(codebox.Text)()
  982.                 end
  983.             )
  984.         }
  985.         if execute[1] then
  986.             button.Text = "Executed successfully!"
  987.         else
  988.             warn(execute[2], execute[3])
  989.             button.Text = "Execution error!"
  990.         end
  991.         wait(3)
  992.         button.Text = orText
  993.     end
  994. )
  995.  
  996. --- Clears the Remote logs
  997. newButton(
  998.     "Clear Logs",
  999.     "Click to clear logs",
  1000.     function(button)
  1001.         local orText = "Click to clear logs"
  1002.         button.Text = "Clearing..."
  1003.         logs = {}
  1004.         for _, v in pairs(remotes:GetChildren()) do
  1005.             if not v:IsA("UIListLayout") then
  1006.                 v:Destroy()
  1007.             end
  1008.         end
  1009.         codebox.Text = ""
  1010.         selected = nil
  1011.         button.Text = "Logs cleared!"
  1012.         wait(3)
  1013.         button.Text = orText
  1014.     end
  1015. )
  1016.  
  1017. --- Excludes the selected.Log Remote from the RemoteSpy
  1018. newButton(
  1019.     "Exclude (single)",
  1020.     "Click to exclude this Remote",
  1021.     function(button)
  1022.         local orText = "Click to exclude this Remote"
  1023.         table.insert(blacklist, #blacklist + 1, selected.Remote)
  1024.         button.Text = "Excluded!"
  1025.         wait(3)
  1026.         button.Text = orText
  1027.     end
  1028. )
  1029.  
  1030. --- Excludes all Remotes that share the same name as the selected.Log remote from the RemoteSpy
  1031. newButton(
  1032.     "Exclude (by name)",
  1033.     "Click to exclude all remotes with this name",
  1034.     function(button)
  1035.         local orText = "Click to exclude all remotes with this name"
  1036.         table.insert(blacklist, #blacklist + 1, selected.Name)
  1037.         button.Text = "Excluded!"
  1038.         wait(3)
  1039.         button.Text = orText
  1040.     end
  1041. )
  1042.  
  1043. --- clears blacklist
  1044. newButton(
  1045.     "Clear Blacklist",
  1046.     "Click to clear the blacklist",
  1047.     function(button)
  1048.         local orText = "Click to clear the blacklist"
  1049.         blacklist = {}
  1050.         button.Text = "Blacklist cleared!"
  1051.         wait(3)
  1052.         button.Text = orText
  1053.     end
  1054. )
  1055.  
  1056. --- Prevents the selected.Log Remote from firing the server (still logged)
  1057. newButton(
  1058.     "Block (single)",
  1059.     "Click to stop this remote from firing",
  1060.     function(button)
  1061.         local orText = "Click to stop this remote from firing"
  1062.         table.insert(blocklist, #blocklist + 1, selected.Remote)
  1063.         button.Text = "Excluded!"
  1064.         wait(3)
  1065.         button.Text = orText
  1066.     end
  1067. )
  1068.  
  1069. --- Prevents all remotes from firing that share the same name as the selected.Log remote from the RemoteSpy (still logged)
  1070. newButton(
  1071.     "Block (by name)",
  1072.     "Click to stop remotes with this name from firing",
  1073.     function(button)
  1074.         local orText = "Click to stop remotes with this name from firing"
  1075.         table.insert(blocklist, #blocklist + 1, selected.Name)
  1076.         button.Text = "Excluded!"
  1077.         wait(3)
  1078.         button.Text = orText
  1079.     end
  1080. )
  1081.  
  1082. --- clears blacklist
  1083. newButton(
  1084.     "Clear Blocklist",
  1085.     "Click to stop blocking remotes",
  1086.     function(button)
  1087.         local orText = "Click to stop blocking remotes"
  1088.         blocklist = {}
  1089.         button.Text = "Blocklist cleared!"
  1090.         wait(3)
  1091.         button.Text = orText
  1092.     end
  1093. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement