Advertisement
A_GUES

Remote Spy old

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