Advertisement
NoTextForSpeech

asdsa

Jan 11th, 2025 (edited)
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 82.07 KB | None | 0 0
  1. --[[
  2. SimpleSpy v2.2 SOURCE
  3.  
  4. SimpleSpy is a lightweight penetration testing tool that logs remote calls.
  5.  
  6. Credits:
  7. exx - basically everything
  8. Frosty - GUI to Lua
  9. ]]
  10.  
  11. -- shuts down the previous instance of SimpleSpy
  12. if _G.SimpleSpyExecuted and type(_G.SimpleSpyShutdown) == "function" then
  13. print(pcall(_G.SimpleSpyShutdown))
  14. end
  15.  
  16. local Players = game:GetService("Players")
  17. local CoreGui = game:GetService("CoreGui")
  18. local Highlight =
  19. loadstring(
  20. game:HttpGet("https://github.com/exxtremestuffs/SimpleSpySource/raw/master/highlight.lua")
  21. )()
  22.  
  23. ---- GENERATED (kinda sorta mostly) BY GUI to LUA ----
  24.  
  25. -- Instances:
  26.  
  27. local SimpleSpy2 = Instance.new("ScreenGui")
  28. local Background = Instance.new("Frame")
  29. local LeftPanel = Instance.new("Frame")
  30. local LogList = Instance.new("ScrollingFrame")
  31. local UIListLayout = Instance.new("UIListLayout")
  32. local RemoteTemplate = Instance.new("Frame")
  33. local ColorBar = Instance.new("Frame")
  34. local Text = Instance.new("TextLabel")
  35. local Button = Instance.new("TextButton")
  36. local RightPanel = Instance.new("Frame")
  37. local CodeBox = Instance.new("Frame")
  38. local ScrollingFrame = Instance.new("ScrollingFrame")
  39. local UIGridLayout = Instance.new("UIGridLayout")
  40. local FunctionTemplate = Instance.new("Frame")
  41. local ColorBar_2 = Instance.new("Frame")
  42. local Text_2 = Instance.new("TextLabel")
  43. local Button_2 = Instance.new("TextButton")
  44. local TopBar = Instance.new("Frame")
  45. local Simple = Instance.new("TextButton")
  46. local CloseButton = Instance.new("TextButton")
  47. local ImageLabel = Instance.new("ImageLabel")
  48. local MaximizeButton = Instance.new("TextButton")
  49. local ImageLabel_2 = Instance.new("ImageLabel")
  50. local MinimizeButton = Instance.new("TextButton")
  51. local ImageLabel_3 = Instance.new("ImageLabel")
  52. local ToolTip = Instance.new("Frame")
  53. local TextLabel = Instance.new("TextLabel")
  54.  
  55. --Properties:
  56.  
  57. SimpleSpy2.Name = "SimpleSpy2"
  58. SimpleSpy2.ResetOnSpawn = false
  59.  
  60. Background.Name = "Background"
  61. Background.Parent = SimpleSpy2
  62. Background.BackgroundColor3 = Color3.new(1, 1, 1)
  63. Background.BackgroundTransparency = 1
  64. Background.Position = UDim2.new(0, 500, 0, 200)
  65. Background.Size = UDim2.new(0, 450, 0, 268)
  66.  
  67. LeftPanel.Name = "LeftPanel"
  68. LeftPanel.Parent = Background
  69. LeftPanel.BackgroundColor3 = Color3.fromRGB(53, 52, 55)
  70. LeftPanel.BorderSizePixel = 0
  71. LeftPanel.Position = UDim2.new(0, 0, 0, 19)
  72. LeftPanel.Size = UDim2.new(0, 131, 0, 249)
  73.  
  74. LogList.Name = "LogList"
  75. LogList.Parent = LeftPanel
  76. LogList.Active = true
  77. LogList.BackgroundColor3 = Color3.new(1, 1, 1)
  78. LogList.BackgroundTransparency = 1
  79. LogList.BorderSizePixel = 0
  80. LogList.Position = UDim2.new(0, 0, 0, 9)
  81. LogList.Size = UDim2.new(0, 131, 0, 232)
  82. LogList.CanvasSize = UDim2.new(0, 0, 0, 0)
  83. LogList.ScrollBarThickness = 4
  84.  
  85. UIListLayout.Parent = LogList
  86. UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  87. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  88.  
  89. RemoteTemplate.Name = "RemoteTemplate"
  90. RemoteTemplate.Parent = LogList
  91. RemoteTemplate.BackgroundColor3 = Color3.new(1, 1, 1)
  92. RemoteTemplate.BackgroundTransparency = 1
  93. RemoteTemplate.Size = UDim2.new(0, 117, 0, 27)
  94.  
  95. ColorBar.Name = "ColorBar"
  96. ColorBar.Parent = RemoteTemplate
  97. ColorBar.BackgroundColor3 = Color3.fromRGB(255, 242, 0)
  98. ColorBar.BorderSizePixel = 0
  99. ColorBar.Position = UDim2.new(0, 0, 0, 1)
  100. ColorBar.Size = UDim2.new(0, 7, 0, 18)
  101. ColorBar.ZIndex = 2
  102.  
  103. Text.Name = "Text"
  104. Text.Parent = RemoteTemplate
  105. Text.BackgroundColor3 = Color3.new(1, 1, 1)
  106. Text.BackgroundTransparency = 1
  107. Text.Position = UDim2.new(0, 12, 0, 1)
  108. Text.Size = UDim2.new(0, 105, 0, 18)
  109. Text.ZIndex = 2
  110. Text.Font = Enum.Font.SourceSans
  111. Text.Text = "TEXT"
  112. Text.TextColor3 = Color3.new(1, 1, 1)
  113. Text.TextSize = 14
  114. Text.TextXAlignment = Enum.TextXAlignment.Left
  115. Text.TextWrapped = true
  116.  
  117. Button.Name = "Button"
  118. Button.Parent = RemoteTemplate
  119. Button.BackgroundColor3 = Color3.new(0, 0, 0)
  120. Button.BackgroundTransparency = 0.75
  121. Button.BorderColor3 = Color3.new(1, 1, 1)
  122. Button.Position = UDim2.new(0, 0, 0, 1)
  123. Button.Size = UDim2.new(0, 117, 0, 18)
  124. Button.AutoButtonColor = false
  125. Button.Font = Enum.Font.SourceSans
  126. Button.Text = ""
  127. Button.TextColor3 = Color3.new(0, 0, 0)
  128. Button.TextSize = 14
  129.  
  130. RightPanel.Name = "RightPanel"
  131. RightPanel.Parent = Background
  132. RightPanel.BackgroundColor3 = Color3.fromRGB(37, 36, 38)
  133. RightPanel.BorderSizePixel = 0
  134. RightPanel.Position = UDim2.new(0, 131, 0, 19)
  135. RightPanel.Size = UDim2.new(0, 319, 0, 249)
  136.  
  137. CodeBox.Name = "CodeBox"
  138. CodeBox.Parent = RightPanel
  139. CodeBox.BackgroundColor3 = Color3.new(0.0823529, 0.0745098, 0.0784314)
  140. CodeBox.BorderSizePixel = 0
  141. CodeBox.Size = UDim2.new(0, 319, 0, 119)
  142.  
  143. ScrollingFrame.Parent = RightPanel
  144. ScrollingFrame.Active = true
  145. ScrollingFrame.BackgroundColor3 = Color3.new(1, 1, 1)
  146. ScrollingFrame.BackgroundTransparency = 1
  147. ScrollingFrame.Position = UDim2.new(0, 0, 0.5, 0)
  148. ScrollingFrame.Size = UDim2.new(1, 0, 0.5, -9)
  149. ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
  150. ScrollingFrame.ScrollBarThickness = 4
  151.  
  152. UIGridLayout.Parent = ScrollingFrame
  153. UIGridLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  154. UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
  155. UIGridLayout.CellPadding = UDim2.new(0, 0, 0, 0)
  156. UIGridLayout.CellSize = UDim2.new(0, 94, 0, 27)
  157.  
  158. FunctionTemplate.Name = "FunctionTemplate"
  159. FunctionTemplate.Parent = ScrollingFrame
  160. FunctionTemplate.BackgroundColor3 = Color3.new(1, 1, 1)
  161. FunctionTemplate.BackgroundTransparency = 1
  162. FunctionTemplate.Size = UDim2.new(0, 117, 0, 23)
  163.  
  164. ColorBar_2.Name = "ColorBar"
  165. ColorBar_2.Parent = FunctionTemplate
  166. ColorBar_2.BackgroundColor3 = Color3.new(1, 1, 1)
  167. ColorBar_2.BorderSizePixel = 0
  168. ColorBar_2.Position = UDim2.new(0, 7, 0, 10)
  169. ColorBar_2.Size = UDim2.new(0, 7, 0, 18)
  170. ColorBar_2.ZIndex = 3
  171.  
  172. Text_2.Name = "Text"
  173. Text_2.Parent = FunctionTemplate
  174. Text_2.BackgroundColor3 = Color3.new(1, 1, 1)
  175. Text_2.BackgroundTransparency = 1
  176. Text_2.Position = UDim2.new(0, 19, 0, 10)
  177. Text_2.Size = UDim2.new(0, 69, 0, 18)
  178. Text_2.ZIndex = 2
  179. Text_2.Font = Enum.Font.SourceSans
  180. Text_2.Text = "TEXT"
  181. Text_2.TextColor3 = Color3.new(1, 1, 1)
  182. Text_2.TextSize = 14
  183. Text_2.TextStrokeColor3 = Color3.new(0.145098, 0.141176, 0.14902)
  184. Text_2.TextXAlignment = Enum.TextXAlignment.Left
  185. Text_2.TextWrapped = true
  186.  
  187. Button_2.Name = "Button"
  188. Button_2.Parent = FunctionTemplate
  189. Button_2.BackgroundColor3 = Color3.new(0, 0, 0)
  190. Button_2.BackgroundTransparency = 0.69999998807907
  191. Button_2.BorderColor3 = Color3.new(1, 1, 1)
  192. Button_2.Position = UDim2.new(0, 7, 0, 10)
  193. Button_2.Size = UDim2.new(0, 80, 0, 18)
  194. Button_2.AutoButtonColor = false
  195. Button_2.Font = Enum.Font.SourceSans
  196. Button_2.Text = ""
  197. Button_2.TextColor3 = Color3.new(0, 0, 0)
  198. Button_2.TextSize = 14
  199.  
  200. TopBar.Name = "TopBar"
  201. TopBar.Parent = Background
  202. TopBar.BackgroundColor3 = Color3.fromRGB(37, 35, 38)
  203. TopBar.BorderSizePixel = 0
  204. TopBar.Size = UDim2.new(0, 450, 0, 19)
  205.  
  206. Simple.Name = "Simple"
  207. Simple.Parent = TopBar
  208. Simple.BackgroundColor3 = Color3.new(1, 1, 1)
  209. Simple.AutoButtonColor = false
  210. Simple.BackgroundTransparency = 1
  211. Simple.Position = UDim2.new(0, 5, 0, 0)
  212. Simple.Size = UDim2.new(0, 57, 0, 18)
  213. Simple.Font = Enum.Font.SourceSansBold
  214. Simple.Text = "SimpleSpy Modified by playvora"
  215. Simple.TextColor3 = Color3.new(1, 1, 1)
  216. Simple.TextSize = 14
  217. Simple.TextXAlignment = Enum.TextXAlignment.Left
  218.  
  219. CloseButton.Name = "CloseButton"
  220. CloseButton.Parent = TopBar
  221. CloseButton.BackgroundColor3 = Color3.new(0.145098, 0.141176, 0.14902)
  222. CloseButton.BorderSizePixel = 0
  223. CloseButton.Position = UDim2.new(1, -19, 0, 0)
  224. CloseButton.Size = UDim2.new(0, 19, 0, 19)
  225. CloseButton.Font = Enum.Font.SourceSans
  226. CloseButton.Text = ""
  227. CloseButton.TextColor3 = Color3.new(0, 0, 0)
  228. CloseButton.TextSize = 14
  229.  
  230. ImageLabel.Parent = CloseButton
  231. ImageLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  232. ImageLabel.BackgroundTransparency = 1
  233. ImageLabel.Position = UDim2.new(0, 5, 0, 5)
  234. ImageLabel.Size = UDim2.new(0, 9, 0, 9)
  235. ImageLabel.Image = "http://www.roblox.com/asset/?id=5597086202"
  236.  
  237. MaximizeButton.Name = "MaximizeButton"
  238. MaximizeButton.Parent = TopBar
  239. MaximizeButton.BackgroundColor3 = Color3.new(0.145098, 0.141176, 0.14902)
  240. MaximizeButton.BorderSizePixel = 0
  241. MaximizeButton.Position = UDim2.new(1, -38, 0, 0)
  242. MaximizeButton.Size = UDim2.new(0, 19, 0, 19)
  243. MaximizeButton.Font = Enum.Font.SourceSans
  244. MaximizeButton.Text = ""
  245. MaximizeButton.TextColor3 = Color3.new(0, 0, 0)
  246. MaximizeButton.TextSize = 14
  247.  
  248. ImageLabel_2.Parent = MaximizeButton
  249. ImageLabel_2.BackgroundColor3 = Color3.new(1, 1, 1)
  250. ImageLabel_2.BackgroundTransparency = 1
  251. ImageLabel_2.Position = UDim2.new(0, 5, 0, 5)
  252. ImageLabel_2.Size = UDim2.new(0, 9, 0, 9)
  253. ImageLabel_2.Image = "http://www.roblox.com/asset/?id=5597108117"
  254.  
  255. MinimizeButton.Name = "MinimizeButton"
  256. MinimizeButton.Parent = TopBar
  257. MinimizeButton.BackgroundColor3 = Color3.new(0.145098, 0.141176, 0.14902)
  258. MinimizeButton.BorderSizePixel = 0
  259. MinimizeButton.Position = UDim2.new(1, -57, 0, 0)
  260. MinimizeButton.Size = UDim2.new(0, 19, 0, 19)
  261. MinimizeButton.Font = Enum.Font.SourceSans
  262. MinimizeButton.Text = ""
  263. MinimizeButton.TextColor3 = Color3.new(0, 0, 0)
  264. MinimizeButton.TextSize = 14
  265.  
  266. ImageLabel_3.Parent = MinimizeButton
  267. ImageLabel_3.BackgroundColor3 = Color3.new(1, 1, 1)
  268. ImageLabel_3.BackgroundTransparency = 1
  269. ImageLabel_3.Position = UDim2.new(0, 5, 0, 5)
  270. ImageLabel_3.Size = UDim2.new(0, 9, 0, 9)
  271. ImageLabel_3.Image = "http://www.roblox.com/asset/?id=5597105827"
  272.  
  273. ToolTip.Name = "ToolTip"
  274. ToolTip.Parent = SimpleSpy2
  275. ToolTip.BackgroundColor3 = Color3.fromRGB(26, 26, 26)
  276. ToolTip.BackgroundTransparency = 0.1
  277. ToolTip.BorderColor3 = Color3.new(1, 1, 1)
  278. ToolTip.Size = UDim2.new(0, 200, 0, 50)
  279. ToolTip.ZIndex = 3
  280. ToolTip.Visible = false
  281.  
  282. TextLabel.Parent = ToolTip
  283. TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  284. TextLabel.BackgroundTransparency = 1
  285. TextLabel.Position = UDim2.new(0, 2, 0, 2)
  286. TextLabel.Size = UDim2.new(0, 196, 0, 46)
  287. TextLabel.ZIndex = 3
  288. TextLabel.Font = Enum.Font.SourceSans
  289. TextLabel.Text = "This is some slightly longer text."
  290. TextLabel.TextColor3 = Color3.new(1, 1, 1)
  291. TextLabel.TextSize = 14
  292. TextLabel.TextWrapped = true
  293. TextLabel.TextXAlignment = Enum.TextXAlignment.Left
  294. TextLabel.TextYAlignment = Enum.TextYAlignment.Top
  295.  
  296. -------------------------------------------------------------------------------
  297. -- init
  298. local RunService = game:GetService("RunService")
  299. local UserInputService = game:GetService("UserInputService")
  300. local TweenService = game:GetService("TweenService")
  301. local ContentProvider = game:GetService("ContentProvider")
  302. local TextService = game:GetService("TextService")
  303. local Mouse
  304.  
  305. local selectedColor = Color3.new(0.321569, 0.333333, 1)
  306. local deselectedColor = Color3.new(0.8, 0.8, 0.8)
  307. --- So things are descending
  308. local layoutOrderNum = 999999999
  309. --- Whether or not the gui is closing
  310. local mainClosing = false
  311. --- Whether or not the gui is closed (defaults to false)
  312. local closed = false
  313. --- Whether or not the sidebar is closing
  314. local sideClosing = false
  315. --- Whether or not the sidebar is closed (defaults to true but opens automatically on remote selection)
  316. local sideClosed = false
  317. --- Whether or not the code box is maximized (defaults to false)
  318. local maximized = false
  319. --- The event logs to be read from
  320. local logs = {}
  321. --- The event currently selected.Log (defaults to nil)
  322. local selected = nil
  323. --- The blacklist (can be a string name or the Remote Instance)
  324. local blacklist = {}
  325. --- The block list (can be a string name or the Remote Instance)
  326. local blocklist = {}
  327. --- Whether or not to add getNil function
  328. local getNil = false
  329. --- Array of remotes (and original functions) connected to
  330. local connectedRemotes = {}
  331. --- True = hookfunction, false = namecall
  332. local toggle = false
  333. local gm
  334. local original
  335. --- used to prevent recursives
  336. local prevTables = {}
  337. --- holds logs (for deletion)
  338. local remoteLogs = {}
  339. --- used for hookfunction
  340. local remoteEvent = Instance.new("RemoteEvent")
  341. --- used for hookfunction
  342. local remoteFunction = Instance.new("RemoteFunction")
  343. local originalEvent = remoteEvent.FireServer
  344. local originalFunction = remoteFunction.InvokeServer
  345. --- the maximum amount of remotes allowed in logs
  346. _G.SIMPLESPYCONFIG_MaxRemotes = 500
  347. --- how many spaces to indent
  348. local indent = 4
  349. --- used for task scheduler
  350. local scheduled = {}
  351. --- RBXScriptConnect of the task scheduler
  352. local schedulerconnect
  353. local SimpleSpy = {}
  354. local topstr = ""
  355. local bottomstr = ""
  356. local remotesFadeIn
  357. local rightFadeIn
  358. local codebox
  359. local p
  360. local getnilrequired = false
  361.  
  362. -- autoblock variables
  363. local autoblock = false
  364. local history = {}
  365. local excluding = {}
  366.  
  367. -- function info variables
  368. local funcEnabled = true
  369.  
  370. -- remote hooking/connecting api variables
  371. local remoteSignals = {}
  372. local remoteHooks = {}
  373.  
  374. -- original mouse icon
  375. local oldIcon
  376.  
  377. -- if mouse inside gui
  378. local mouseInGui = false
  379.  
  380. -- handy array of RBXScriptConnections to disconnect on shutdown
  381. local connections = {}
  382.  
  383. -- whether or not SimpleSpy uses 'getcallingscript()' to get the script (default is false because detection)
  384. local useGetCallingScript = false
  385.  
  386. --- used to enable/disable SimpleSpy's keyToString for remotes
  387. local keyToString = false
  388.  
  389. -- determines whether return values are recorded
  390. local recordReturnValues = false
  391.  
  392. -- functions
  393.  
  394. --- Converts arguments to a string and generates code that calls the specified method with them, recommended to be used in conjunction with ValueToString (method must be a string, e.g. `game:GetService("ReplicatedStorage").Remote.remote:FireServer`)
  395. --- @param method string
  396. --- @param args any[]
  397. --- @return string
  398. function SimpleSpy:ArgsToString(method, args)
  399. assert(typeof(method) == "string", "string expected, got " .. typeof(method))
  400. assert(typeof(args) == "table", "table expected, got " .. typeof(args))
  401. return v2v({ args = args }) .. "\n\n" .. method .. "(unpack(args))"
  402. end
  403.  
  404. --- Converts a value to variables with the specified index as the variable name (if nil/invalid then the name will be assigned automatically)
  405. --- @param t any[]
  406. --- @return string
  407. function SimpleSpy:TableToVars(t)
  408. assert(typeof(t) == "table", "table expected, got " .. typeof(t))
  409. return v2v(t)
  410. end
  411.  
  412. --- Converts a value to a variable with the specified `variablename` (if nil/invalid then the name will be assigned automatically)
  413. --- @param value any
  414. --- @return string
  415. function SimpleSpy:ValueToVar(value, variablename)
  416. assert(variablename == nil or typeof(variablename) == "string", "string expected, got " .. typeof(variablename))
  417. if not variablename then
  418. variablename = 1
  419. end
  420. return v2v({ [variablename] = value })
  421. end
  422.  
  423. --- Converts any value to a string, cannot preserve function contents
  424. --- @param value any
  425. --- @return string
  426. function SimpleSpy:ValueToString(value)
  427. return v2s(value)
  428. end
  429.  
  430. --- Generates the simplespy function info
  431. --- @param func function
  432. --- @return string
  433. function SimpleSpy:GetFunctionInfo(func)
  434. assert(typeof(func) == "function", "Instance expected, got " .. typeof(func))
  435. warn("Function info currently unavailable due to crashing in Synapse X")
  436. return v2v({ functionInfo = {
  437. info = debug.getinfo(func),
  438. constants = debug.getconstants(func),
  439. } })
  440. end
  441.  
  442. --- Gets the ScriptSignal for a specified remote being fired
  443. --- @param remote Instance
  444. function SimpleSpy:GetRemoteFiredSignal(remote)
  445. assert(typeof(remote) == "Instance", "Instance expected, got " .. typeof(remote))
  446. if not remoteSignals[remote] then
  447. remoteSignals[remote] = newSignal()
  448. end
  449. return remoteSignals[remote]
  450. end
  451.  
  452. --- Allows for direct hooking of remotes **THIS CAN BE VERY DANGEROUS**
  453. --- @param remote Instance
  454. --- @param f function
  455. function SimpleSpy:HookRemote(remote, f)
  456. assert(typeof(remote) == "Instance", "Instance expected, got " .. typeof(remote))
  457. assert(typeof(f) == "function", "function expected, got " .. typeof(f))
  458. remoteHooks[remote] = f
  459. end
  460.  
  461. --- Blocks the specified remote instance/string
  462. --- @param remote any
  463. function SimpleSpy:BlockRemote(remote)
  464. assert(
  465. typeof(remote) == "Instance" or typeof(remote) == "string",
  466. "Instance | string expected, got " .. typeof(remote)
  467. )
  468. blocklist[remote] = true
  469. end
  470.  
  471. --- Excludes the specified remote from logs (instance/string)
  472. --- @param remote any
  473. function SimpleSpy:ExcludeRemote(remote)
  474. assert(
  475. typeof(remote) == "Instance" or typeof(remote) == "string",
  476. "Instance | string expected, got " .. typeof(remote)
  477. )
  478. blacklist[remote] = true
  479. end
  480.  
  481. --- Creates a new ScriptSignal that can be connected to and fired
  482. --- @return table
  483. function newSignal()
  484. local connected = {}
  485. return {
  486. Connect = function(self, f)
  487. assert(connected, "Signal is closed")
  488. connected[tostring(f)] = f
  489. return {
  490. Connected = true,
  491. Disconnect = function(self)
  492. if not connected then
  493. warn("Signal is already closed")
  494. end
  495. self.Connected = false
  496. connected[tostring(f)] = nil
  497. end,
  498. }
  499. end,
  500. Wait = function(self)
  501. local thread = coroutine.running()
  502. local connection
  503. connection = self:Connect(function()
  504. connection:Disconnect()
  505. if coroutine.status(thread) == "suspended" then
  506. coroutine.resume(thread)
  507. end
  508. end)
  509. coroutine.yield()
  510. end,
  511. Fire = function(self, ...)
  512. for _, f in pairs(connected) do
  513. coroutine.wrap(f)(...)
  514. end
  515. end,
  516. }
  517. end
  518.  
  519. --- Prevents remote spam from causing lag (clears logs after `_G.SIMPLESPYCONFIG_MaxRemotes` or 500 remotes)
  520. function clean()
  521. local max = _G.SIMPLESPYCONFIG_MaxRemotes
  522. if not typeof(max) == "number" and math.floor(max) ~= max then
  523. max = 500
  524. end
  525. if #remoteLogs > max then
  526. for i = 100, #remoteLogs do
  527. local v = remoteLogs[i]
  528. if typeof(v[1]) == "RBXScriptConnection" then
  529. v[1]:Disconnect()
  530. end
  531. if typeof(v[2]) == "Instance" then
  532. v[2]:Destroy()
  533. end
  534. end
  535. local newLogs = {}
  536. for i = 1, 100 do
  537. table.insert(newLogs, remoteLogs[i])
  538. end
  539. remoteLogs = newLogs
  540. end
  541. end
  542.  
  543. --- Scales the ToolTip to fit containing text
  544. function scaleToolTip()
  545. local size = TextService:GetTextSize(
  546. TextLabel.Text,
  547. TextLabel.TextSize,
  548. TextLabel.Font,
  549. Vector2.new(196, math.huge)
  550. )
  551. TextLabel.Size = UDim2.new(0, size.X, 0, size.Y)
  552. ToolTip.Size = UDim2.new(0, size.X + 4, 0, size.Y + 4)
  553. end
  554.  
  555. --- Executed when the toggle button (the SimpleSpy logo) is hovered over
  556. function onToggleButtonHover()
  557. if not toggle then
  558. TweenService:Create(Simple, TweenInfo.new(0.5), { TextColor3 = Color3.fromRGB(252, 51, 51) }):Play()
  559. else
  560. TweenService:Create(Simple, TweenInfo.new(0.5), { TextColor3 = Color3.fromRGB(68, 206, 91) }):Play()
  561. end
  562. end
  563.  
  564. --- Executed when the toggle button is unhovered over
  565. function onToggleButtonUnhover()
  566. TweenService:Create(Simple, TweenInfo.new(0.5), { TextColor3 = Color3.fromRGB(255, 255, 255) }):Play()
  567. end
  568.  
  569. --- Executed when the X button is hovered over
  570. function onXButtonHover()
  571. TweenService:Create(CloseButton, TweenInfo.new(0.2), { BackgroundColor3 = Color3.fromRGB(255, 60, 60) }):Play()
  572. end
  573.  
  574. --- Executed when the X button is unhovered over
  575. function onXButtonUnhover()
  576. TweenService:Create(CloseButton, TweenInfo.new(0.2), { BackgroundColor3 = Color3.fromRGB(37, 36, 38) }):Play()
  577. end
  578.  
  579. --- Toggles the remote spy method (when button clicked)
  580. function onToggleButtonClick()
  581. if toggle then
  582. TweenService:Create(Simple, TweenInfo.new(0.5), { TextColor3 = Color3.fromRGB(252, 51, 51) }):Play()
  583. else
  584. TweenService:Create(Simple, TweenInfo.new(0.5), { TextColor3 = Color3.fromRGB(68, 206, 91) }):Play()
  585. end
  586. toggleSpyMethod()
  587. end
  588.  
  589. --- Reconnects bringBackOnResize if the current viewport changes and also connects it initially
  590. function connectResize()
  591. local lastCam = workspace.CurrentCamera:GetPropertyChangedSignal("ViewportSize"):Connect(bringBackOnResize)
  592. workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
  593. lastCam:Disconnect()
  594. if workspace.CurrentCamera then
  595. lastCam = workspace.CurrentCamera:GetPropertyChangedSignal("ViewportSize"):Connect(bringBackOnResize)
  596. end
  597. end)
  598. end
  599.  
  600. --- Brings gui back if it gets lost offscreen (connected to the camera viewport changing)
  601. function bringBackOnResize()
  602. validateSize()
  603. if sideClosed then
  604. minimizeSize()
  605. else
  606. maximizeSize()
  607. end
  608. local currentX = Background.AbsolutePosition.X
  609. local currentY = Background.AbsolutePosition.Y
  610. local viewportSize = workspace.CurrentCamera.ViewportSize
  611. if (currentX < 0) or (currentX > (viewportSize.X - (sideClosed and 131 or Background.AbsoluteSize.X))) then
  612. if currentX < 0 then
  613. currentX = 0
  614. else
  615. currentX = viewportSize.X - (sideClosed and 131 or Background.AbsoluteSize.X)
  616. end
  617. end
  618. if (currentY < 0) or (currentY > (viewportSize.Y - (closed and 19 or Background.AbsoluteSize.Y) - 36)) then
  619. if currentY < 0 then
  620. currentY = 0
  621. else
  622. currentY = viewportSize.Y - (closed and 19 or Background.AbsoluteSize.Y) - 36
  623. end
  624. end
  625. TweenService.Create(
  626. TweenService,
  627. Background,
  628. TweenInfo.new(0.1),
  629. { Position = UDim2.new(0, currentX, 0, currentY) }
  630. ):Play()
  631. end
  632.  
  633. --- Drags gui (so long as mouse is held down)
  634. --- @param input InputObject
  635. function onBarInput(input)
  636. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  637. local lastPos = UserInputService.GetMouseLocation(UserInputService)
  638. local mainPos = Background.AbsolutePosition
  639. local offset = mainPos - lastPos
  640. local currentPos = offset + lastPos
  641. RunService.BindToRenderStep(RunService, "drag", 1, function()
  642. local newPos = UserInputService.GetMouseLocation(UserInputService)
  643. if newPos ~= lastPos then
  644. local currentX = (offset + newPos).X
  645. local currentY = (offset + newPos).Y
  646. local viewportSize = workspace.CurrentCamera.ViewportSize
  647. if
  648. (currentX < 0 and currentX < currentPos.X)
  649. or (
  650. currentX > (viewportSize.X - (sideClosed and 131 or TopBar.AbsoluteSize.X))
  651. and currentX > currentPos.X
  652. )
  653. then
  654. if currentX < 0 then
  655. currentX = 0
  656. else
  657. currentX = viewportSize.X - (sideClosed and 131 or TopBar.AbsoluteSize.X)
  658. end
  659. end
  660. if
  661. (currentY < 0 and currentY < currentPos.Y)
  662. or (
  663. currentY > (viewportSize.Y - (closed and 19 or Background.AbsoluteSize.Y) - 36)
  664. and currentY > currentPos.Y
  665. )
  666. then
  667. if currentY < 0 then
  668. currentY = 0
  669. else
  670. currentY = viewportSize.Y - (closed and 19 or Background.AbsoluteSize.Y) - 36
  671. end
  672. end
  673. currentPos = Vector2.new(currentX, currentY)
  674. lastPos = newPos
  675. TweenService.Create(
  676. TweenService,
  677. Background,
  678. TweenInfo.new(0.1),
  679. { Position = UDim2.new(0, currentPos.X, 0, currentPos.Y) }
  680. ):Play()
  681. end
  682. -- if input.UserInputState ~= Enum.UserInputState.Begin then
  683. -- RunService.UnbindFromRenderStep(RunService, "drag")
  684. -- end
  685. end)
  686. table.insert(
  687. connections,
  688. UserInputService.InputEnded:Connect(function(inputE)
  689. if input == inputE then
  690. RunService:UnbindFromRenderStep("drag")
  691. end
  692. end)
  693. )
  694. end
  695. end
  696.  
  697. --- Fades out the table of elements (and makes them invisible), returns a function to make them visible again
  698. function fadeOut(elements)
  699. local data = {}
  700. for _, v in pairs(elements) do
  701. if typeof(v) == "Instance" and v:IsA("GuiObject") and v.Visible then
  702. coroutine.wrap(function()
  703. data[v] = {
  704. BackgroundTransparency = v.BackgroundTransparency,
  705. }
  706. TweenService:Create(v, TweenInfo.new(0.5), { BackgroundTransparency = 1 }):Play()
  707. if v:IsA("TextBox") or v:IsA("TextButton") or v:IsA("TextLabel") then
  708. data[v].TextTransparency = v.TextTransparency
  709. TweenService:Create(v, TweenInfo.new(0.5), { TextTransparency = 1 }):Play()
  710. elseif v:IsA("ImageButton") or v:IsA("ImageLabel") then
  711. data[v].ImageTransparency = v.ImageTransparency
  712. TweenService:Create(v, TweenInfo.new(0.5), { ImageTransparency = 1 }):Play()
  713. end
  714. wait(0.5)
  715. v.Visible = false
  716. for i, x in pairs(data[v]) do
  717. v[i] = x
  718. end
  719. data[v] = true
  720. end)()
  721. end
  722. end
  723. return function()
  724. for i, _ in pairs(data) do
  725. coroutine.wrap(function()
  726. local properties = {
  727. BackgroundTransparency = i.BackgroundTransparency,
  728. }
  729. i.BackgroundTransparency = 1
  730. TweenService
  731. :Create(i, TweenInfo.new(0.5), { BackgroundTransparency = properties.BackgroundTransparency })
  732. :Play()
  733. if i:IsA("TextBox") or i:IsA("TextButton") or i:IsA("TextLabel") then
  734. properties.TextTransparency = i.TextTransparency
  735. i.TextTransparency = 1
  736. TweenService
  737. :Create(i, TweenInfo.new(0.5), { TextTransparency = properties.TextTransparency })
  738. :Play()
  739. elseif i:IsA("ImageButton") or i:IsA("ImageLabel") then
  740. properties.ImageTransparency = i.ImageTransparency
  741. i.ImageTransparency = 1
  742. TweenService
  743. :Create(i, TweenInfo.new(0.5), { ImageTransparency = properties.ImageTransparency })
  744. :Play()
  745. end
  746. i.Visible = true
  747. end)()
  748. end
  749. end
  750. end
  751.  
  752. --- Expands and minimizes the gui (closed is the toggle boolean)
  753. function toggleMinimize(override)
  754. if mainClosing and not override or maximized then
  755. return
  756. end
  757. mainClosing = true
  758. closed = not closed
  759. if closed then
  760. if not sideClosed then
  761. toggleSideTray(true)
  762. end
  763. LeftPanel.Visible = true
  764. TweenService:Create(LeftPanel, TweenInfo.new(0.5), { Size = UDim2.new(0, 131, 0, 0) }):Play()
  765. wait(0.5)
  766. remotesFadeIn = fadeOut(LeftPanel:GetDescendants())
  767. wait(0.5)
  768. else
  769. TweenService:Create(LeftPanel, TweenInfo.new(0.5), { Size = UDim2.new(0, 131, 0, 249) }):Play()
  770. wait(0.5)
  771. if remotesFadeIn then
  772. remotesFadeIn()
  773. remotesFadeIn = nil
  774. end
  775. bringBackOnResize()
  776. end
  777. mainClosing = false
  778. end
  779.  
  780. --- Expands and minimizes the sidebar (sideClosed is the toggle boolean)
  781. function toggleSideTray(override)
  782. if sideClosing and not override or maximized then
  783. return
  784. end
  785. sideClosing = true
  786. sideClosed = not sideClosed
  787. if sideClosed then
  788. rightFadeIn = fadeOut(RightPanel:GetDescendants())
  789. wait(0.5)
  790. minimizeSize(0.5)
  791. wait(0.5)
  792. RightPanel.Visible = false
  793. else
  794. if closed then
  795. toggleMinimize(true)
  796. end
  797. RightPanel.Visible = true
  798. maximizeSize(0.5)
  799. wait(0.5)
  800. if rightFadeIn then
  801. rightFadeIn()
  802. end
  803. bringBackOnResize()
  804. end
  805. sideClosing = false
  806. end
  807.  
  808. --- Expands code box to fit screen for more convenient viewing
  809. function toggleMaximize()
  810. if not sideClosed and not maximized then
  811. maximized = true
  812. local disable = Instance.new("TextButton")
  813. local prevSize = UDim2.new(0, CodeBox.AbsoluteSize.X, 0, CodeBox.AbsoluteSize.Y)
  814. local prevPos = UDim2.new(0, CodeBox.AbsolutePosition.X, 0, CodeBox.AbsolutePosition.Y)
  815. disable.Size = UDim2.new(1, 0, 1, 0)
  816. disable.BackgroundColor3 = Color3.new()
  817. disable.BorderSizePixel = 0
  818. disable.Text = 0
  819. disable.ZIndex = 3
  820. disable.BackgroundTransparency = 1
  821. disable.AutoButtonColor = false
  822. CodeBox.ZIndex = 4
  823. CodeBox.Position = prevPos
  824. CodeBox.Size = prevSize
  825. TweenService
  826. :Create(
  827. CodeBox,
  828. TweenInfo.new(0.5),
  829. { Size = UDim2.new(0.5, 0, 0.5, 0), Position = UDim2.new(0.25, 0, 0.25, 0) }
  830. )
  831. :Play()
  832. TweenService:Create(disable, TweenInfo.new(0.5), { BackgroundTransparency = 0.5 }):Play()
  833. disable.MouseButton1Click:Connect(function()
  834. if
  835. UserInputService:GetMouseLocation().Y + 36 >= CodeBox.AbsolutePosition.Y
  836. and UserInputService:GetMouseLocation().Y + 36 <= CodeBox.AbsolutePosition.Y + CodeBox.AbsoluteSize.Y
  837. and UserInputService:GetMouseLocation().X >= CodeBox.AbsolutePosition.X
  838. and UserInputService:GetMouseLocation().X <= CodeBox.AbsolutePosition.X + CodeBox.AbsoluteSize.X
  839. then
  840. return
  841. end
  842. TweenService:Create(CodeBox, TweenInfo.new(0.5), { Size = prevSize, Position = prevPos }):Play()
  843. TweenService:Create(disable, TweenInfo.new(0.5), { BackgroundTransparency = 1 }):Play()
  844. maximized = false
  845. wait(0.5)
  846. disable:Destroy()
  847. CodeBox.Size = UDim2.new(1, 0, 0.5, 0)
  848. CodeBox.Position = UDim2.new(0, 0, 0, 0)
  849. CodeBox.ZIndex = 0
  850. end)
  851. end
  852. end
  853.  
  854. --- Checks if cursor is within resize range
  855. --- @param p Vector2
  856. function isInResizeRange(p)
  857. local relativeP = p - Background.AbsolutePosition
  858. local range = 5
  859. if
  860. relativeP.X >= TopBar.AbsoluteSize.X - range
  861. and relativeP.Y >= Background.AbsoluteSize.Y - range
  862. and relativeP.X <= TopBar.AbsoluteSize.X
  863. and relativeP.Y <= Background.AbsoluteSize.Y
  864. then
  865. return true, "B"
  866. elseif relativeP.X >= TopBar.AbsoluteSize.X - range and relativeP.X <= Background.AbsoluteSize.X then
  867. return true, "X"
  868. elseif relativeP.Y >= Background.AbsoluteSize.Y - range and relativeP.Y <= Background.AbsoluteSize.Y then
  869. return true, "Y"
  870. end
  871. return false
  872. end
  873.  
  874. --- Checks if cursor is within dragging range
  875. --- @param p Vector2
  876. function isInDragRange(p)
  877. local relativeP = p - Background.AbsolutePosition
  878. if
  879. relativeP.X <= TopBar.AbsoluteSize.X - CloseButton.AbsoluteSize.X * 3
  880. and relativeP.X >= 0
  881. and relativeP.Y <= TopBar.AbsoluteSize.Y
  882. and relativeP.Y >= 0
  883. then
  884. return true
  885. end
  886. return false
  887. end
  888.  
  889. --- Called when mouse enters SimpleSpy
  890. function mouseEntered()
  891. local existingCursor = SimpleSpy2:FindFirstChild("Cursor")
  892. while existingCursor do
  893. existingCursor:Destroy()
  894. existingCursor = SimpleSpy2:FindFirstChild("Cursor")
  895. end
  896. local customCursor = Instance.new("ImageLabel")
  897. customCursor.Name = "Cursor"
  898. customCursor.Size = UDim2.fromOffset(200, 200)
  899. customCursor.ZIndex = 1e5
  900. customCursor.BackgroundTransparency = 1
  901. customCursor.Image = ""
  902. customCursor.Parent = SimpleSpy2
  903. UserInputService.OverrideMouseIconBehavior = Enum.OverrideMouseIconBehavior.ForceHide
  904. RunService:BindToRenderStep("SIMPLESPY_CURSOR", 1, function()
  905. if mouseInGui and _G.SimpleSpyExecuted then
  906. local mouseLocation = UserInputService:GetMouseLocation() - Vector2.new(0, 36)
  907. customCursor.Position = UDim2.fromOffset(
  908. mouseLocation.X - customCursor.AbsoluteSize.X / 2,
  909. mouseLocation.Y - customCursor.AbsoluteSize.Y / 2
  910. )
  911. local inRange, type = isInResizeRange(mouseLocation)
  912. if inRange and not sideClosed and not closed then
  913. customCursor.Image = type == "B" and "rbxassetid://6065821980"
  914. or type == "X" and "rbxassetid://6065821086"
  915. or type == "Y" and "rbxassetid://6065821596"
  916. elseif inRange and not closed and type == "Y" or type == "B" then
  917. customCursor.Image = "rbxassetid://6065821596"
  918. elseif customCursor.Image ~= "rbxassetid://6065775281" then
  919. customCursor.Image = "rbxassetid://6065775281"
  920. end
  921. else
  922. UserInputService.OverrideMouseIconBehavior = Enum.OverrideMouseIconBehavior.None
  923. customCursor:Destroy()
  924. RunService:UnbindFromRenderStep("SIMPLESPY_CURSOR")
  925. end
  926. end)
  927. end
  928.  
  929. --- Called when mouse moves
  930. function mouseMoved()
  931. local mousePos = UserInputService:GetMouseLocation() - Vector2.new(0, 36)
  932.  
  933. local topBarPos = TopBar.AbsolutePosition
  934. local topBarSize = TopBar.AbsoluteSize
  935. local backgroundPos = Background.AbsolutePosition
  936. local backgroundSize = Background.AbsoluteSize
  937.  
  938. if not closed and
  939. mousePos.X >= topBarPos.X and mousePos.X <= topBarPos.X + topBarSize.X and
  940. mousePos.Y >= backgroundPos.Y and mousePos.Y <= backgroundPos.Y + backgroundSize.Y
  941. then
  942. if not mouseInGui then
  943. mouseInGui = true
  944. mouseEntered()
  945. end
  946. else
  947. mouseInGui = false
  948. end
  949. end
  950.  
  951. --- Adjusts the ui elements to the 'Maximized' size
  952. function maximizeSize(speed)
  953. if not speed then
  954. speed = 0.05
  955. end
  956. TweenService
  957. :Create(
  958. LeftPanel,
  959. TweenInfo.new(speed),
  960. { Size = UDim2.fromOffset(LeftPanel.AbsoluteSize.X, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y) }
  961. )
  962. :Play()
  963. TweenService
  964. :Create(RightPanel, TweenInfo.new(speed), {
  965. Size = UDim2.fromOffset(
  966. Background.AbsoluteSize.X - LeftPanel.AbsoluteSize.X,
  967. Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y
  968. ),
  969. })
  970. :Play()
  971. TweenService
  972. :Create(
  973. TopBar,
  974. TweenInfo.new(speed),
  975. { Size = UDim2.fromOffset(Background.AbsoluteSize.X, TopBar.AbsoluteSize.Y) }
  976. )
  977. :Play()
  978. TweenService
  979. :Create(ScrollingFrame, TweenInfo.new(speed), {
  980. Size = UDim2.fromOffset(Background.AbsoluteSize.X - LeftPanel.AbsoluteSize.X, 110),
  981. Position = UDim2.fromOffset(0, Background.AbsoluteSize.Y - 119 - TopBar.AbsoluteSize.Y),
  982. })
  983. :Play()
  984. TweenService
  985. :Create(CodeBox, TweenInfo.new(speed), {
  986. Size = UDim2.fromOffset(
  987. Background.AbsoluteSize.X - LeftPanel.AbsoluteSize.X,
  988. Background.AbsoluteSize.Y - 119 - TopBar.AbsoluteSize.Y
  989. ),
  990. })
  991. :Play()
  992. TweenService
  993. :Create(
  994. LogList,
  995. TweenInfo.new(speed),
  996. { Size = UDim2.fromOffset(LogList.AbsoluteSize.X, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y - 18) }
  997. )
  998. :Play()
  999. end
  1000.  
  1001. --- Adjusts the ui elements to close the side
  1002. function minimizeSize(speed)
  1003. if not speed then
  1004. speed = 0.05
  1005. end
  1006. TweenService
  1007. :Create(
  1008. LeftPanel,
  1009. TweenInfo.new(speed),
  1010. { Size = UDim2.fromOffset(LeftPanel.AbsoluteSize.X, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y) }
  1011. )
  1012. :Play()
  1013. TweenService
  1014. :Create(
  1015. RightPanel,
  1016. TweenInfo.new(speed),
  1017. { Size = UDim2.fromOffset(0, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y) }
  1018. )
  1019. :Play()
  1020. TweenService
  1021. :Create(
  1022. TopBar,
  1023. TweenInfo.new(speed),
  1024. { Size = UDim2.fromOffset(LeftPanel.AbsoluteSize.X, TopBar.AbsoluteSize.Y) }
  1025. )
  1026. :Play()
  1027. TweenService
  1028. :Create(ScrollingFrame, TweenInfo.new(speed), {
  1029. Size = UDim2.fromOffset(0, 119),
  1030. Position = UDim2.fromOffset(0, Background.AbsoluteSize.Y - 119 - TopBar.AbsoluteSize.Y),
  1031. })
  1032. :Play()
  1033. TweenService
  1034. :Create(
  1035. CodeBox,
  1036. TweenInfo.new(speed),
  1037. { Size = UDim2.fromOffset(0, Background.AbsoluteSize.Y - 119 - TopBar.AbsoluteSize.Y) }
  1038. )
  1039. :Play()
  1040. TweenService
  1041. :Create(
  1042. LogList,
  1043. TweenInfo.new(speed),
  1044. { Size = UDim2.fromOffset(LogList.AbsoluteSize.X, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y - 18) }
  1045. )
  1046. :Play()
  1047. end
  1048.  
  1049. --- Ensures size is within screensize limitations
  1050. function validateSize()
  1051. local x, y = Background.AbsoluteSize.X, Background.AbsoluteSize.Y
  1052. local screenSize = workspace.CurrentCamera.ViewportSize
  1053. if x + Background.AbsolutePosition.X > screenSize.X then
  1054. if screenSize.X - Background.AbsolutePosition.X >= 450 then
  1055. x = screenSize.X - Background.AbsolutePosition.X
  1056. else
  1057. x = 450
  1058. end
  1059. elseif y + Background.AbsolutePosition.Y > screenSize.Y then
  1060. if screenSize.X - Background.AbsolutePosition.Y >= 268 then
  1061. y = screenSize.Y - Background.AbsolutePosition.Y
  1062. else
  1063. y = 268
  1064. end
  1065. end
  1066. Background.Size = UDim2.fromOffset(x, y)
  1067. end
  1068.  
  1069. --- Called on user input while mouse in 'Background' frame
  1070. --- @param input InputObject
  1071. function backgroundUserInput(input)
  1072. local mousePos = UserInputService:GetMouseLocation() - Vector2.new(0, 36)
  1073. local inResizeRange, type = isInResizeRange(mousePos)
  1074. if input.UserInputType == Enum.UserInputType.MouseButton1 and inResizeRange then
  1075. local lastPos = UserInputService:GetMouseLocation()
  1076. local offset = Background.AbsoluteSize - (lastPos - Background.AbsolutePosition)
  1077. local currentPos = lastPos + offset
  1078. RunService:BindToRenderStep("SIMPLESPY_RESIZE", 1, function()
  1079. local newPos = UserInputService:GetMouseLocation()
  1080. if newPos ~= lastPos then
  1081. local currentX = (newPos + offset).X
  1082. local currentY = (newPos + offset).Y
  1083. if currentX < 450 then
  1084. currentX = 450
  1085. end
  1086. if currentY < 268 then
  1087. currentY = 268
  1088. end
  1089. currentPos = Vector2.new(currentX, currentY)
  1090. Background.Size = UDim2.fromOffset(
  1091. (not sideClosed and not closed and (type == "X" or type == "B")) and currentPos.X
  1092. or Background.AbsoluteSize.X,
  1093. (not closed and (type == "Y" or type == "B")) and currentPos.Y
  1094. or Background.AbsoluteSize.Y
  1095. )
  1096. validateSize()
  1097. if sideClosed then
  1098. minimizeSize()
  1099. else
  1100. maximizeSize()
  1101. end
  1102. lastPos = newPos
  1103. end
  1104. end)
  1105. table.insert(
  1106. connections,
  1107. UserInputService.InputEnded:Connect(function(inputE)
  1108. if input == inputE then
  1109. RunService:UnbindFromRenderStep("SIMPLESPY_RESIZE")
  1110. end
  1111. end)
  1112. )
  1113. elseif isInDragRange(mousePos) then
  1114. onBarInput(input)
  1115. end
  1116. end
  1117.  
  1118. --- Gets the player an instance is descended from
  1119. function getPlayerFromInstance(instance)
  1120. for _, v in pairs(Players:GetPlayers()) do
  1121. if v.Character and (instance:IsDescendantOf(v.Character) or instance == v.Character) then
  1122. return v
  1123. end
  1124. end
  1125. end
  1126.  
  1127. --- Runs on MouseButton1Click of an event frame
  1128. function eventSelect(frame)
  1129. if selected and selected.Log and selected.Log.Button then
  1130. TweenService
  1131. :Create(selected.Log.Button, TweenInfo.new(0.5), { BackgroundColor3 = Color3.fromRGB(0, 0, 0) })
  1132. :Play()
  1133. selected = nil
  1134. end
  1135. for _, v in pairs(logs) do
  1136. if frame == v.Log then
  1137. selected = v
  1138. end
  1139. end
  1140. if selected and selected.Log then
  1141. TweenService
  1142. :Create(frame.Button, TweenInfo.new(0.5), { BackgroundColor3 = Color3.fromRGB(92, 126, 229) })
  1143. :Play()
  1144. codebox:setRaw(selected.GenScript)
  1145. end
  1146. if sideClosed then
  1147. toggleSideTray()
  1148. end
  1149. end
  1150.  
  1151. --- Updates the canvas size to fit the current amount of function buttons
  1152. function updateFunctionCanvas()
  1153. ScrollingFrame.CanvasSize = UDim2.fromOffset(UIGridLayout.AbsoluteContentSize.X, UIGridLayout.AbsoluteContentSize.Y)
  1154. end
  1155.  
  1156. --- Updates the canvas size to fit the amount of current remotes
  1157. function updateRemoteCanvas()
  1158. LogList.CanvasSize = UDim2.fromOffset(UIListLayout.AbsoluteContentSize.X, UIListLayout.AbsoluteContentSize.Y)
  1159. end
  1160.  
  1161. --- Allows for toggling of the tooltip and easy setting of le description
  1162. --- @param enable boolean
  1163. --- @param text string
  1164. function makeToolTip(enable, text)
  1165. if enable then
  1166. if ToolTip.Visible then
  1167. ToolTip.Visible = false
  1168. RunService:UnbindFromRenderStep("ToolTip")
  1169. end
  1170. local first = true
  1171. RunService:BindToRenderStep("ToolTip", 1, function()
  1172. local topLeft = Vector2.new(Mouse.X + 20, Mouse.Y + 20)
  1173. local bottomRight = topLeft + ToolTip.AbsoluteSize
  1174. if topLeft.X < 0 then
  1175. topLeft = Vector2.new(0, topLeft.Y)
  1176. elseif bottomRight.X > workspace.CurrentCamera.ViewportSize.X then
  1177. topLeft = Vector2.new(workspace.CurrentCamera.ViewportSize.X - ToolTip.AbsoluteSize.X, topLeft.Y)
  1178. end
  1179. if topLeft.Y < 0 then
  1180. topLeft = Vector2.new(topLeft.X, 0)
  1181. elseif bottomRight.Y > workspace.CurrentCamera.ViewportSize.Y - 35 then
  1182. topLeft = Vector2.new(topLeft.X, workspace.CurrentCamera.ViewportSize.Y - ToolTip.AbsoluteSize.Y - 35)
  1183. end
  1184. if topLeft.X <= Mouse.X and topLeft.Y <= Mouse.Y then
  1185. topLeft = Vector2.new(Mouse.X - ToolTip.AbsoluteSize.X - 2, Mouse.Y - ToolTip.AbsoluteSize.Y - 2)
  1186. end
  1187. if first then
  1188. ToolTip.Position = UDim2.fromOffset(topLeft.X, topLeft.Y)
  1189. first = false
  1190. else
  1191. ToolTip:TweenPosition(UDim2.fromOffset(topLeft.X, topLeft.Y), "Out", "Linear", 0.1)
  1192. end
  1193. end)
  1194. TextLabel.Text = text
  1195. ToolTip.Visible = true
  1196. else
  1197. if ToolTip.Visible then
  1198. ToolTip.Visible = false
  1199. RunService:UnbindFromRenderStep("ToolTip")
  1200. end
  1201. end
  1202. end
  1203.  
  1204. --- Creates new function button (below codebox)
  1205. --- @param name string
  1206. ---@param description function
  1207. ---@param onClick function
  1208. function newButton(name, description, onClick)
  1209. local button = FunctionTemplate:Clone()
  1210. button.Text.Text = name
  1211. button.Button.MouseEnter:Connect(function()
  1212. makeToolTip(true, description())
  1213. end)
  1214. button.Button.MouseLeave:Connect(function()
  1215. makeToolTip(false)
  1216. end)
  1217. button.AncestryChanged:Connect(function()
  1218. makeToolTip(false)
  1219. end)
  1220. button.Button.MouseButton1Click:Connect(function(...)
  1221. onClick(button, ...)
  1222. end)
  1223. button.Parent = ScrollingFrame
  1224. updateFunctionCanvas()
  1225. end
  1226.  
  1227. --- Adds new Remote to logs
  1228. --- @param name string The name of the remote being logged
  1229. --- @param type string The type of the remote being logged (either 'function' or 'event')
  1230. --- @param args any
  1231. --- @param remote any
  1232. --- @param function_info string
  1233. --- @param blocked any
  1234. function newRemote(type, name, args, remote, function_info, blocked, src, returnValue)
  1235. local remoteFrame = RemoteTemplate:Clone()
  1236. remoteFrame.Text.Text = string.sub(name .. "(" .. remote.ClassName .. ")", 1, 50)
  1237. remoteFrame.ColorBar.BackgroundColor3 = type == "event" and Color3.new(255, 242, 0) or Color3.fromRGB(99, 86, 245)
  1238. local id = Instance.new("IntValue")
  1239. id.Name = "ID"
  1240. id.Value = #logs + 1
  1241. id.Parent = remoteFrame
  1242. local weakRemoteTable = setmetatable({ remote = remote }, { __mode = "v" })
  1243. local log = {
  1244. Name = name,
  1245. Function = function_info,
  1246. Remote = weakRemoteTable,
  1247. Log = remoteFrame,
  1248. Blocked = blocked,
  1249. Source = src,
  1250. GenScript = "-- Generating, please wait... (click to reload)\n-- (If this message persists, the remote args are likely extremely long)",
  1251. ReturnValue = returnValue,
  1252. }
  1253. logs[#logs + 1] = log
  1254. schedule(function()
  1255. log.GenScript = genScript(remote, args)
  1256. if blocked then
  1257. logs[#logs].GenScript = "-- THIS REMOTE WAS PREVENTED FROM FIRING THE SERVER BY SIMPLESPY\n\n"
  1258. .. logs[#logs].GenScript
  1259. end
  1260. end)
  1261. local connect = remoteFrame.Button.MouseButton1Click:Connect(function()
  1262. eventSelect(remoteFrame)
  1263. end)
  1264. if layoutOrderNum < 1 then
  1265. layoutOrderNum = 999999999
  1266. end
  1267. remoteFrame.LayoutOrder = layoutOrderNum
  1268. layoutOrderNum = layoutOrderNum - 1
  1269. remoteFrame.Parent = LogList
  1270. table.insert(remoteLogs, 1, { connect, remoteFrame })
  1271. clean()
  1272. updateRemoteCanvas()
  1273. end
  1274.  
  1275. --- Generates a script from the provided arguments (first has to be remote path)
  1276. function genScript(remote, args)
  1277. prevTables = {}
  1278. local gen = ""
  1279.  
  1280. local function tableToString(tbl)
  1281. local result = "{"
  1282. for k, v in pairs(tbl) do
  1283. local key = type(k) == "string" and '["' .. k .. '"]' or tostring(k)
  1284. local value
  1285. if type(v) == "table" then
  1286. value = tableToString(v)
  1287. elseif type(v) == "string" then
  1288. value = '"' .. v .. '"'
  1289. elseif type(v) == "userdata" and typeof(v) ~= "Instance" then
  1290. value = string.format("nil --[[%s]]", typeof(v))
  1291. elseif type(v) == "userdata" then
  1292. value = "game." .. v:GetFullName()
  1293. else
  1294. value = tostring(v)
  1295. end
  1296. result = result .. "\n " .. key .. " = " .. value .. ","
  1297. end
  1298. return result:sub(1, -2) .. "\n}"
  1299. end
  1300.  
  1301. if #args > 0 then
  1302. if not pcall(function()
  1303. gen = v2v({ args = args }) .. "\n"
  1304. end) then
  1305. gen = gen .. "-- TableToString failure! Reverting to legacy functionality (results may vary)\nlocal args = {"
  1306. for i, v in pairs(args) do
  1307. if type(v) == "table" then
  1308. gen = gen .. "\n [" .. tostring(i) .. "] = " .. tableToString(v) .. ","
  1309. else
  1310. if type(i) == "string" then
  1311. gen = gen .. '\n ["' .. i .. '"] = '
  1312. elseif type(i) == "userdata" and typeof(i) ~= "Instance" then
  1313. gen = gen .. "\n [" .. string.format("nil --[[%s]]", typeof(v)) .. ")] = "
  1314. elseif type(i) == "userdata" then
  1315. gen = gen .. "\n [game." .. i:GetFullName() .. ")] = "
  1316. end
  1317.  
  1318. if type(v) ~= "Instance" and type(v) ~= "userdata" then
  1319. gen = gen .. "object"
  1320. elseif type(v) == "string" then
  1321. gen = gen .. '"' .. v .. '"'
  1322. elseif type(v) == "userdata" and typeof(v) ~= "Instance" then
  1323. gen = gen .. string.format("nil --[[%s]]", typeof(v))
  1324. elseif type(v) == "userdata" then
  1325. gen = gen .. "game." .. v:GetFullName()
  1326. end
  1327. end
  1328. end
  1329. gen = gen .. "\n}\n\n"
  1330. end
  1331.  
  1332. if not remote:IsDescendantOf(game) and not getnilrequired then
  1333. gen = "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" .. gen
  1334. end
  1335.  
  1336. if remote:IsA("RemoteEvent") then
  1337. gen = gen .. v2s(remote) .. ":FireServer(unpack(args))"
  1338. elseif remote:IsA("RemoteFunction") then
  1339. gen = gen .. v2s(remote) .. ":InvokeServer(unpack(args))"
  1340. end
  1341. else
  1342. if remote:IsA("RemoteEvent") then
  1343. gen = gen .. v2s(remote) .. ":FireServer()"
  1344. elseif remote:IsA("RemoteFunction") then
  1345. gen = gen .. v2s(remote) .. ":InvokeServer()"
  1346. end
  1347. end
  1348.  
  1349. gen = "-- Script generated by SimpleSpy - credits to exx#9394\n\n" .. gen
  1350. prevTables = {}
  1351. return gen
  1352. end
  1353.  
  1354. --- value-to-string: value, string (out), level (indentation), parent table, var name, is from tovar
  1355. function v2s(v, l, p, n, vtv, i, pt, path, tables, tI)
  1356. if not tI then
  1357. tI = { 0 }
  1358. else
  1359. tI[1] += 1
  1360. end
  1361. if typeof(v) == "number" then
  1362. if v == math.huge then
  1363. return "math.huge"
  1364. elseif tostring(v):match("nan") then
  1365. return "0/0 --[[NaN]]"
  1366. end
  1367. return tostring(v)
  1368. elseif typeof(v) == "boolean" then
  1369. return tostring(v)
  1370. elseif typeof(v) == "string" then
  1371. return formatstr(v, l)
  1372. elseif typeof(v) == "function" then
  1373. return f2s(v)
  1374. elseif typeof(v) == "table" then
  1375. return t2s(v, l, p, n, vtv, i, pt, path, tables, tI)
  1376. elseif typeof(v) == "Instance" then
  1377. return i2p(v)
  1378. elseif typeof(v) == "userdata" then
  1379. return "newproxy(true)"
  1380. elseif type(v) == "userdata" then
  1381. return u2s(v)
  1382. elseif type(v) == "vector" then
  1383. return string.format("Vector3.new(%s, %s, %s)", v2s(v.X), v2s(v.Y), v2s(v.Z))
  1384. else
  1385. return "nil --[[" .. typeof(v) .. "]]"
  1386. end
  1387. end
  1388.  
  1389. --- value-to-variable
  1390. --- @param t any
  1391. function v2v(t)
  1392. topstr = ""
  1393. bottomstr = ""
  1394. getnilrequired = false
  1395. local ret = ""
  1396. local count = 1
  1397. for i, v in pairs(t) do
  1398. if type(i) == "string" and i:match("^[%a_]+[%w_]*$") then
  1399. ret = ret .. "local " .. i .. " = " .. v2s(v, nil, nil, i, true) .. "\n"
  1400. elseif tostring(i):match("^[%a_]+[%w_]*$") then
  1401. ret = ret
  1402. .. "local "
  1403. .. tostring(i):lower()
  1404. .. "_"
  1405. .. tostring(count)
  1406. .. " = "
  1407. .. v2s(v, nil, nil, tostring(i):lower() .. "_" .. tostring(count), true)
  1408. .. "\n"
  1409. else
  1410. ret = ret
  1411. .. "local "
  1412. .. type(v)
  1413. .. "_"
  1414. .. tostring(count)
  1415. .. " = "
  1416. .. v2s(v, nil, nil, type(v) .. "_" .. tostring(count), true)
  1417. .. "\n"
  1418. end
  1419. count = count + 1
  1420. end
  1421. if getnilrequired then
  1422. topstr = "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"
  1423. .. topstr
  1424. end
  1425. if #topstr > 0 then
  1426. ret = topstr .. "\n" .. ret
  1427. end
  1428. if #bottomstr > 0 then
  1429. ret = ret .. bottomstr
  1430. end
  1431. return ret
  1432. end
  1433.  
  1434. --- table-to-string
  1435. --- @param t table
  1436. --- @param l number
  1437. --- @param p table
  1438. --- @param n string
  1439. --- @param vtv boolean
  1440. --- @param i any
  1441. --- @param pt table
  1442. --- @param path string
  1443. --- @param tables table
  1444. --- @param tI table
  1445. function t2s(t, l, p, n, vtv, i, pt, path, tables, tI)
  1446. local globalIndex = table.find(getgenv(), t) -- checks if table is a global
  1447. if type(globalIndex) == "string" then
  1448. return globalIndex
  1449. end
  1450. if not tI then
  1451. tI = { 0 }
  1452. end
  1453. if not path then -- sets path to empty string (so it doesn't have to manually provided every time)
  1454. path = ""
  1455. end
  1456. if not l then -- sets the level to 0 (for indentation) and tables for logging tables it already serialized
  1457. l = 0
  1458. tables = {}
  1459. end
  1460. if not p then -- p is the previous table but doesn't really matter if it's the first
  1461. p = t
  1462. end
  1463. for _, v in pairs(tables) do -- checks if the current table has been serialized before
  1464. if n and rawequal(v, t) then
  1465. bottomstr = bottomstr
  1466. .. "\n"
  1467. .. tostring(n)
  1468. .. tostring(path)
  1469. .. " = "
  1470. .. tostring(n)
  1471. .. tostring(({ v2p(v, p) })[2])
  1472. return "{} --[[DUPLICATE]]"
  1473. end
  1474. end
  1475. table.insert(tables, t) -- logs table to past tables
  1476. local s = "{" -- start of serialization
  1477. local size = 0
  1478. l = l + indent -- set indentation level
  1479. for k, v in pairs(t) do -- iterates over table
  1480. size = size + 1 -- changes size for max limit
  1481. if size > (_G.SimpleSpyMaxTableSize or 1000) then
  1482. s = s
  1483. .. "\n"
  1484. .. string.rep(" ", l)
  1485. .. "-- MAXIMUM TABLE SIZE REACHED, CHANGE '_G.SimpleSpyMaxTableSize' TO ADJUST MAXIMUM SIZE "
  1486. break
  1487. end
  1488. if rawequal(k, t) then -- checks if the table being iterated over is being used as an index within itself (yay, lua)
  1489. bottomstr = bottomstr
  1490. .. "\n"
  1491. .. tostring(n)
  1492. .. tostring(path)
  1493. .. "["
  1494. .. tostring(n)
  1495. .. tostring(path)
  1496. .. "]"
  1497. .. " = "
  1498. .. (
  1499. rawequal(v, k) and tostring(n) .. tostring(path)
  1500. or v2s(v, l, p, n, vtv, k, t, path .. "[" .. tostring(n) .. tostring(path) .. "]", tables)
  1501. )
  1502. size -= 1
  1503. continue
  1504. end
  1505. local currentPath = "" -- initializes the path of 'v' within 't'
  1506. if type(k) == "string" and k:match("^[%a_]+[%w_]*$") then -- cleanly handles table path generation (for the first half)
  1507. currentPath = "." .. k
  1508. else
  1509. currentPath = "[" .. k2s(k, l, p, n, vtv, k, t, path .. currentPath, tables, tI) .. "]"
  1510. end
  1511. if size % 100 == 0 then
  1512. scheduleWait()
  1513. end
  1514. -- actually serializes the member of the table
  1515. s = s
  1516. .. "\n"
  1517. .. string.rep(" ", l)
  1518. .. "["
  1519. .. k2s(k, l, p, n, vtv, k, t, path .. currentPath, tables, tI)
  1520. .. "] = "
  1521. .. v2s(v, l, p, n, vtv, k, t, path .. currentPath, tables, tI)
  1522. .. ","
  1523. end
  1524. if #s > 1 then -- removes the last comma because it looks nicer (no way to tell if it's done 'till it's done so...)
  1525. s = s:sub(1, #s - 1)
  1526. end
  1527. if size > 0 then -- cleanly indents the last curly bracket
  1528. s = s .. "\n" .. string.rep(" ", l - indent)
  1529. end
  1530. return s .. "}"
  1531. end
  1532.  
  1533. --- key-to-string
  1534. function k2s(v, ...)
  1535. if keyToString then
  1536. if typeof(v) == "userdata" and getrawmetatable(v) then
  1537. return string.format(
  1538. '"<void> (%s)" --[[Potentially hidden data (tostring in SimpleSpy:HookRemote/GetRemoteFiredSignal at your own risk)]]',
  1539. safetostring(v)
  1540. )
  1541. elseif typeof(v) == "userdata" then
  1542. return string.format('"<void> (%s)"', safetostring(v))
  1543. elseif type(v) == "userdata" and typeof(v) ~= "Instance" then
  1544. return string.format('"<%s> (%s)"', typeof(v), tostring(v))
  1545. elseif type(v) == "function" then
  1546. return string.format('"<Function> (%s)"', tostring(v))
  1547. end
  1548. end
  1549. return v2s(v, ...)
  1550. end
  1551.  
  1552. --- function-to-string
  1553. function f2s(f)
  1554. for k, x in pairs(getgenv()) do
  1555. local isgucci, gpath
  1556. if rawequal(x, f) then
  1557. isgucci, gpath = true, ""
  1558. elseif type(x) == "table" then
  1559. isgucci, gpath = v2p(f, x)
  1560. end
  1561. if isgucci and type(k) ~= "function" then
  1562. if type(k) == "string" and k:match("^[%a_]+[%w_]*$") then
  1563. return k .. gpath
  1564. else
  1565. return "getgenv()[" .. v2s(k) .. "]" .. gpath
  1566. end
  1567. end
  1568. end
  1569. if funcEnabled and debug.getinfo(f).name:match("^[%a_]+[%w_]*$") then
  1570. return "function()end --[[" .. debug.getinfo(f).name .. "]]"
  1571. end
  1572. return "function()end --[[" .. tostring(f) .. "]]"
  1573. end
  1574.  
  1575. --- instance-to-path
  1576. --- @param i userdata
  1577. function i2p(i)
  1578. local player = getplayer(i)
  1579. local parent = i
  1580. local out = ""
  1581. if parent == nil then
  1582. return "nil"
  1583. elseif player then
  1584. while true do
  1585. if parent and parent == player.Character then
  1586. if player == Players.LocalPlayer then
  1587. return 'game:GetService("Players").LocalPlayer.Character' .. out
  1588. else
  1589. return i2p(player) .. ".Character" .. out
  1590. end
  1591. else
  1592. if parent.Name:match("[%a_]+[%w+]*") ~= parent.Name then
  1593. out = ":FindFirstChild(" .. formatstr(parent.Name) .. ")" .. out
  1594. else
  1595. out = "." .. parent.Name .. out
  1596. end
  1597. end
  1598. parent = parent.Parent
  1599. end
  1600. elseif parent ~= game then
  1601. while true do
  1602. if parent and parent.Parent == game then
  1603. local service = game:FindService(parent.ClassName)
  1604. if service then
  1605. if parent.ClassName == "Workspace" then
  1606. return "workspace" .. out
  1607. else
  1608. return 'game:GetService("' .. service.ClassName .. '")' .. out
  1609. end
  1610. else
  1611. if parent.Name:match("[%a_]+[%w_]*") then
  1612. return "game." .. parent.Name .. out
  1613. else
  1614. return "game:FindFirstChild(" .. formatstr(parent.Name) .. ")" .. out
  1615. end
  1616. end
  1617. elseif parent.Parent == nil then
  1618. getnilrequired = true
  1619. return "getNil(" .. formatstr(parent.Name) .. ', "' .. parent.ClassName .. '")' .. out
  1620. elseif parent == Players.LocalPlayer then
  1621. out = ".LocalPlayer" .. out
  1622. else
  1623. if parent.Name:match("[%a_]+[%w_]*") ~= parent.Name then
  1624. out = ":FindFirstChild(" .. formatstr(parent.Name) .. ")" .. out
  1625. else
  1626. out = "." .. parent.Name .. out
  1627. end
  1628. end
  1629. parent = parent.Parent
  1630. end
  1631. else
  1632. return "game"
  1633. end
  1634. end
  1635.  
  1636. --- userdata-to-string: userdata
  1637. --- @param u userdata
  1638. function u2s(u)
  1639. if typeof(u) == "TweenInfo" then
  1640. -- TweenInfo
  1641. return "TweenInfo.new("
  1642. .. tostring(u.Time)
  1643. .. ", Enum.EasingStyle."
  1644. .. tostring(u.EasingStyle)
  1645. .. ", Enum.EasingDirection."
  1646. .. tostring(u.EasingDirection)
  1647. .. ", "
  1648. .. tostring(u.RepeatCount)
  1649. .. ", "
  1650. .. tostring(u.Reverses)
  1651. .. ", "
  1652. .. tostring(u.DelayTime)
  1653. .. ")"
  1654. elseif typeof(u) == "Ray" then
  1655. -- Ray
  1656. return "Ray.new(" .. u2s(u.Origin) .. ", " .. u2s(u.Direction) .. ")"
  1657. elseif typeof(u) == "NumberSequence" then
  1658. -- NumberSequence
  1659. local ret = "NumberSequence.new("
  1660. for i, v in pairs(u.KeyPoints) do
  1661. ret = ret .. tostring(v)
  1662. if i < #u.Keypoints then
  1663. ret = ret .. ", "
  1664. end
  1665. end
  1666. return ret .. ")"
  1667. elseif typeof(u) == "DockWidgetPluginGuiInfo" then
  1668. -- DockWidgetPluginGuiInfo
  1669. return "DockWidgetPluginGuiInfo.new(Enum.InitialDockState" .. tostring(u) .. ")"
  1670. elseif typeof(u) == "ColorSequence" then
  1671. -- ColorSequence
  1672. local ret = "ColorSequence.new("
  1673. for i, v in pairs(u.KeyPoints) do
  1674. ret = ret .. "Color3.new(" .. tostring(v) .. ")"
  1675. if i < #u.Keypoints then
  1676. ret = ret .. ", "
  1677. end
  1678. end
  1679. return ret .. ")"
  1680. elseif typeof(u) == "BrickColor" then
  1681. -- BrickColor
  1682. return "BrickColor.new(" .. tostring(u.Number) .. ")"
  1683. elseif typeof(u) == "NumberRange" then
  1684. -- NumberRange
  1685. return "NumberRange.new(" .. tostring(u.Min) .. ", " .. tostring(u.Max) .. ")"
  1686. elseif typeof(u) == "Region3" then
  1687. -- Region3
  1688. local center = u.CFrame.Position
  1689. local size = u.CFrame.Size
  1690. local vector1 = center - size / 2
  1691. local vector2 = center + size / 2
  1692. return "Region3.new(" .. u2s(vector1) .. ", " .. u2s(vector2) .. ")"
  1693. elseif typeof(u) == "Faces" then
  1694. -- Faces
  1695. local faces = {}
  1696. if u.Top then
  1697. table.insert(faces, "Enum.NormalId.Top")
  1698. end
  1699. if u.Bottom then
  1700. table.insert(faces, "Enum.NormalId.Bottom")
  1701. end
  1702. if u.Left then
  1703. table.insert(faces, "Enum.NormalId.Left")
  1704. end
  1705. if u.Right then
  1706. table.insert(faces, "Enum.NormalId.Right")
  1707. end
  1708. if u.Back then
  1709. table.insert(faces, "Enum.NormalId.Back")
  1710. end
  1711. if u.Front then
  1712. table.insert(faces, "Enum.NormalId.Front")
  1713. end
  1714. return "Faces.new(" .. table.concat(faces, ", ") .. ")"
  1715. elseif typeof(u) == "EnumItem" then
  1716. return tostring(u)
  1717. elseif typeof(u) == "Enums" then
  1718. return "Enum"
  1719. elseif typeof(u) == "Enum" then
  1720. return "Enum." .. tostring(u)
  1721. elseif typeof(u) == "RBXScriptSignal" then
  1722. return "nil --[[RBXScriptSignal]]"
  1723. elseif typeof(u) == "Vector3" then
  1724. return string.format("Vector3.new(%s, %s, %s)", v2s(u.X), v2s(u.Y), v2s(u.Z))
  1725. elseif typeof(u) == "CFrame" then
  1726. local xAngle, yAngle, zAngle = u:ToEulerAnglesXYZ()
  1727. return string.format(
  1728. "CFrame.new(%s, %s, %s) * CFrame.Angles(%s, %s, %s)",
  1729. v2s(u.X),
  1730. v2s(u.Y),
  1731. v2s(u.Z),
  1732. v2s(xAngle),
  1733. v2s(yAngle),
  1734. v2s(zAngle)
  1735. )
  1736. elseif typeof(u) == "DockWidgetPluginGuiInfo" then
  1737. return string.format(
  1738. "DockWidgetPluginGuiInfo(%s, %s, %s, %s, %s, %s, %s)",
  1739. "Enum.InitialDockState.Right",
  1740. v2s(u.InitialEnabled),
  1741. v2s(u.InitialEnabledShouldOverrideRestore),
  1742. v2s(u.FloatingXSize),
  1743. v2s(u.FloatingYSize),
  1744. v2s(u.MinWidth),
  1745. v2s(u.MinHeight)
  1746. )
  1747. elseif typeof(u) == "PathWaypoint" then
  1748. return string.format("PathWaypoint.new(%s, %s)", v2s(u.Position), v2s(u.Action))
  1749. elseif typeof(u) == "UDim" then
  1750. return string.format("UDim.new(%s, %s)", v2s(u.Scale), v2s(u.Offset))
  1751. elseif typeof(u) == "UDim2" then
  1752. return string.format(
  1753. "UDim2.new(%s, %s, %s, %s)",
  1754. v2s(u.X.Scale),
  1755. v2s(u.X.Offset),
  1756. v2s(u.Y.Scale),
  1757. v2s(u.Y.Offset)
  1758. )
  1759. elseif typeof(u) == "Rect" then
  1760. return string.format("Rect.new(%s, %s)", v2s(u.Min), v2s(u.Max))
  1761. else
  1762. return string.format("nil --[[%s]]", typeof(u))
  1763. end
  1764. end
  1765.  
  1766. --- Gets the player an instance is descended from
  1767. function getplayer(instance)
  1768. for _, v in pairs(Players:GetPlayers()) do
  1769. if v.Character and (instance:IsDescendantOf(v.Character) or instance == v.Character) then
  1770. return v
  1771. end
  1772. end
  1773. end
  1774.  
  1775. --- value-to-path (in table)
  1776. function v2p(x, t, path, prev)
  1777. if not path then
  1778. path = ""
  1779. end
  1780. if not prev then
  1781. prev = {}
  1782. end
  1783. if rawequal(x, t) then
  1784. return true, ""
  1785. end
  1786. for i, v in pairs(t) do
  1787. if rawequal(v, x) then
  1788. if type(i) == "string" and i:match("^[%a_]+[%w_]*$") then
  1789. return true, (path .. "." .. i)
  1790. else
  1791. return true, (path .. "[" .. v2s(i) .. "]")
  1792. end
  1793. end
  1794. if type(v) == "table" then
  1795. local duplicate = false
  1796. for _, y in pairs(prev) do
  1797. if rawequal(y, v) then
  1798. duplicate = true
  1799. end
  1800. end
  1801. if not duplicate then
  1802. table.insert(prev, t)
  1803. local found
  1804. found, p = v2p(x, v, path, prev)
  1805. if found then
  1806. if type(i) == "string" and i:match("^[%a_]+[%w_]*$") then
  1807. return true, "." .. i .. p
  1808. else
  1809. return true, "[" .. v2s(i) .. "]" .. p
  1810. end
  1811. end
  1812. end
  1813. end
  1814. end
  1815. return false, ""
  1816. end
  1817.  
  1818. --- format s: string, byte encrypt (for weird symbols)
  1819. function formatstr(s, indentation)
  1820. if not indentation then
  1821. indentation = 0
  1822. end
  1823. local handled, reachedMax = handlespecials(s, indentation)
  1824. return '"'
  1825. .. handled
  1826. .. '"'
  1827. .. (
  1828. reachedMax
  1829. and " --[[ MAXIMUM STRING SIZE REACHED, CHANGE '_G.SimpleSpyMaxStringSize' TO ADJUST MAXIMUM SIZE ]]"
  1830. or ""
  1831. )
  1832. end
  1833.  
  1834. --- Adds \'s to the text as a replacement to whitespace chars and other things because string.format can't yayeet
  1835. function handlespecials(value, indentation)
  1836. local buildStr = {}
  1837. local i = 1
  1838. local char = string.sub(value, i, i)
  1839. local indentStr
  1840. while char ~= "" do
  1841. if char == '"' then
  1842. buildStr[i] = '\\"'
  1843. elseif char == "\\" then
  1844. buildStr[i] = "\\\\"
  1845. elseif char == "\n" then
  1846. buildStr[i] = "\\n"
  1847. elseif char == "\t" then
  1848. buildStr[i] = "\\t"
  1849. elseif string.byte(char) > 126 or string.byte(char) < 32 then
  1850. buildStr[i] = string.format("\\%d", string.byte(char))
  1851. else
  1852. buildStr[i] = char
  1853. end
  1854. i = i + 1
  1855. char = string.sub(value, i, i)
  1856. if i % 200 == 0 then
  1857. indentStr = indentStr or string.rep(" ", indentation + indent)
  1858. table.move({ '"\n', indentStr, '... "' }, 1, 3, i, buildStr)
  1859. i += 3
  1860. end
  1861. end
  1862. return table.concat(buildStr)
  1863. end
  1864.  
  1865. -- safe (ish) tostring
  1866. function safetostring(v: any)
  1867. if typeof(v) == "userdata" or type(v) == "table" then
  1868. local mt = getrawmetatable(v)
  1869. local badtostring = mt and rawget(mt, "__tostring")
  1870. if mt and badtostring then
  1871. rawset(mt, "__tostring", nil)
  1872. local out = tostring(v)
  1873. rawset(mt, "__tostring", badtostring)
  1874. return out
  1875. end
  1876. end
  1877. return tostring(v)
  1878. end
  1879.  
  1880. --- finds script from 'src' from getinfo, returns nil if not found
  1881. --- @param src string
  1882. function getScriptFromSrc(src)
  1883. local realPath
  1884. local runningTest
  1885. --- @type number
  1886. local s, e
  1887. local match = false
  1888. if src:sub(1, 1) == "=" then
  1889. realPath = game
  1890. s = 2
  1891. else
  1892. runningTest = src:sub(2, e and e - 1 or -1)
  1893. for _, v in pairs(getnilinstances()) do
  1894. if v.Name == runningTest then
  1895. realPath = v
  1896. break
  1897. end
  1898. end
  1899. s = #runningTest + 1
  1900. end
  1901. if realPath then
  1902. e = src:sub(s, -1):find("%.")
  1903. local i = 0
  1904. repeat
  1905. i += 1
  1906. if not e then
  1907. runningTest = src:sub(s, -1)
  1908. local test = realPath.FindFirstChild(realPath, runningTest)
  1909. if test then
  1910. realPath = test
  1911. end
  1912. match = true
  1913. else
  1914. runningTest = src:sub(s, e)
  1915. local test = realPath.FindFirstChild(realPath, runningTest)
  1916. local yeOld = e
  1917. if test then
  1918. realPath = test
  1919. s = e + 2
  1920. e = src:sub(e + 2, -1):find("%.")
  1921. e = e and e + yeOld or e
  1922. else
  1923. e = src:sub(e + 2, -1):find("%.")
  1924. e = e and e + yeOld or e
  1925. end
  1926. end
  1927. until match or i >= 50
  1928. end
  1929. return realPath
  1930. end
  1931.  
  1932. --- schedules the provided function (and calls it with any args after)
  1933. function schedule(f, ...)
  1934. table.insert(scheduled, { f, ... })
  1935. end
  1936.  
  1937. --- yields the current thread until the scheduler gives the ok
  1938. function scheduleWait()
  1939. local thread = coroutine.running()
  1940. schedule(function()
  1941. coroutine.resume(thread)
  1942. end)
  1943. coroutine.yield()
  1944. end
  1945.  
  1946. --- the big (well tbh small now) boi task scheduler himself, handles p much anything as quicc as possible
  1947. function taskscheduler()
  1948. if not toggle then
  1949. scheduled = {}
  1950. return
  1951. end
  1952. if #scheduled > 1000 then
  1953. table.remove(scheduled, #scheduled)
  1954. end
  1955. if #scheduled > 0 then
  1956. local currentf = scheduled[1]
  1957. table.remove(scheduled, 1)
  1958. if type(currentf) == "table" and type(currentf[1]) == "function" then
  1959. pcall(unpack(currentf))
  1960. end
  1961. end
  1962. end
  1963.  
  1964. --- Handles remote logs
  1965. function remoteHandler(hookfunction, methodName, remote, args, funcInfo, calling, returnValue)
  1966. local validInstance, validClass = pcall(function()
  1967. return remote:IsA("RemoteEvent") or remote:IsA("RemoteFunction")
  1968. end)
  1969. if validInstance and validClass then
  1970. local func = funcInfo.func
  1971. if not calling then
  1972. _, calling = pcall(getScriptFromSrc, funcInfo.source)
  1973. end
  1974. coroutine.wrap(function()
  1975. if remoteSignals[remote] then
  1976. remoteSignals[remote]:Fire(args)
  1977. end
  1978. end)()
  1979. if autoblock then
  1980. if excluding[remote] then
  1981. return
  1982. end
  1983. if not history[remote] then
  1984. history[remote] = { badOccurances = 0, lastCall = tick() }
  1985. end
  1986. if tick() - history[remote].lastCall < 1 then
  1987. history[remote].badOccurances += 1
  1988. return
  1989. else
  1990. history[remote].badOccurances = 0
  1991. end
  1992. if history[remote].badOccurances > 3 then
  1993. excluding[remote] = true
  1994. return
  1995. end
  1996. history[remote].lastCall = tick()
  1997. end
  1998. local functionInfoStr
  1999. local src
  2000. if func and islclosure(func) then
  2001. local functionInfo = {}
  2002. functionInfo.info = funcInfo
  2003. pcall(function()
  2004. functionInfo.constants = debug.getconstants(func)
  2005. end)
  2006. pcall(function()
  2007. functionInfoStr = v2v({ functionInfo = functionInfo })
  2008. end)
  2009. pcall(function()
  2010. if type(calling) == "userdata" then
  2011. src = calling
  2012. end
  2013. end)
  2014. end
  2015. if methodName:lower() == "fireserver" then
  2016. newRemote(
  2017. "event",
  2018. remote.Name,
  2019. args,
  2020. remote,
  2021. functionInfoStr,
  2022. (blocklist[remote] or blocklist[remote.Name]),
  2023. src
  2024. )
  2025. elseif methodName:lower() == "invokeserver" then
  2026. newRemote(
  2027. "function",
  2028. remote.Name,
  2029. args,
  2030. remote,
  2031. functionInfoStr,
  2032. (blocklist[remote] or blocklist[remote.Name]),
  2033. src,
  2034. returnValue
  2035. )
  2036. end
  2037. end
  2038. end
  2039.  
  2040. --- Used for hookfunction
  2041. function hookRemote(remoteType, remote, ...)
  2042. if typeof(remote) == "Instance" then
  2043. local args = { ... }
  2044. local validInstance, remoteName = pcall(function()
  2045. return remote.Name
  2046. end)
  2047. if validInstance and not (blacklist[remote] or blacklist[remoteName]) then
  2048. local funcInfo = {}
  2049. local calling
  2050. if funcEnabled then
  2051. funcInfo = debug.getinfo(4) or funcInfo
  2052. calling = useGetCallingScript and getcallingscript() or nil
  2053. end
  2054. if recordReturnValues and remoteType == "RemoteFunction" then
  2055. local thread = coroutine.running()
  2056. local args = { ... }
  2057. task.defer(function()
  2058. local returnValue
  2059. if remoteHooks[remote] then
  2060. args = { remoteHooks[remote](unpack(args)) }
  2061. returnValue = originalFunction(remote, unpack(args))
  2062. else
  2063. returnValue = originalFunction(remote, unpack(args))
  2064. end
  2065. schedule(
  2066. remoteHandler,
  2067. true,
  2068. remoteType == "RemoteEvent" and "fireserver" or "invokeserver",
  2069. remote,
  2070. args,
  2071. funcInfo,
  2072. calling,
  2073. returnValue
  2074. )
  2075. if blocklist[remote] or blocklist[remoteName] then
  2076. coroutine.resume(thread)
  2077. else
  2078. coroutine.resume(thread, unpack(returnValue))
  2079. end
  2080. end)
  2081. else
  2082. schedule(
  2083. remoteHandler,
  2084. true,
  2085. remoteType == "RemoteEvent" and "fireserver" or "invokeserver",
  2086. remote,
  2087. args,
  2088. funcInfo,
  2089. calling
  2090. )
  2091. if blocklist[remote] or blocklist[remoteName] then
  2092. return
  2093. end
  2094. end
  2095. end
  2096. end
  2097. if recordReturnValues and remoteType == "RemoteFunction" then
  2098. return coroutine.yield()
  2099. elseif remoteType == "RemoteEvent" then
  2100. if remoteHooks[remote] then
  2101. return originalEvent(remote, remoteHooks[remote](...))
  2102. end
  2103. return originalEvent(remote, ...)
  2104. else
  2105. if remoteHooks[remote] then
  2106. return originalFunction(remote, remoteHooks[remote](...))
  2107. end
  2108. return originalFunction(remote, ...)
  2109. end
  2110. end
  2111.  
  2112. local newnamecall = newcclosure(function(remote, ...)
  2113. if typeof(remote) == "Instance" then
  2114. local args = { ... }
  2115. local methodName = getnamecallmethod()
  2116. local validInstance, remoteName = pcall(function()
  2117. return remote.Name
  2118. end)
  2119. if
  2120. validInstance
  2121. and (methodName == "FireServer" or methodName == "fireServer" or methodName == "InvokeServer" or methodName == "invokeServer")
  2122. and not (blacklist[remote] or blacklist[remoteName])
  2123. then
  2124. local funcInfo = {}
  2125. local calling
  2126. if funcEnabled then
  2127. funcInfo = debug.getinfo(3) or funcInfo
  2128. calling = useGetCallingScript and getcallingscript() or nil
  2129. end
  2130. if recordReturnValues and (methodName == "InvokeServer" or methodName == "invokeServer") then
  2131. local namecallThread = coroutine.running()
  2132. local args = { ... }
  2133. task.defer(function()
  2134. local returnValue
  2135. setnamecallmethod(methodName)
  2136. if remoteHooks[remote] then
  2137. args = { remoteHooks[remote](unpack(args)) }
  2138. returnValue = { original(remote, unpack(args)) }
  2139. else
  2140. returnValue = { original(remote, unpack(args)) }
  2141. end
  2142. coroutine.resume(namecallThread, unpack(returnValue))
  2143. coroutine.wrap(function()
  2144. schedule(remoteHandler, false, methodName, remote, args, funcInfo, calling, returnValue)
  2145. end)()
  2146. end)
  2147. else
  2148. coroutine.wrap(function()
  2149. schedule(remoteHandler, false, methodName, remote, args, funcInfo, calling)
  2150. end)()
  2151. end
  2152. end
  2153. if recordReturnValues and (methodName == "InvokeServer" or methodName == "invokeServer") then
  2154. return coroutine.yield()
  2155. elseif
  2156. validInstance
  2157. and (methodName == "FireServer" or methodName == "fireServer" or methodName == "InvokeServer" or methodName == "invokeServer")
  2158. and (blocklist[remote] or blocklist[remoteName])
  2159. then
  2160. return nil
  2161. elseif
  2162. (not recordReturnValues or methodName ~= "InvokeServer" or methodName ~= "invokeServer")
  2163. and validInstance
  2164. and (methodName == "FireServer" or methodName == "fireServer" or methodName == "InvokeServer" or methodName == "invokeServer")
  2165. and remoteHooks[remote]
  2166. then
  2167. return original(remote, remoteHooks[remote](...))
  2168. else
  2169. return original(remote, ...)
  2170. end
  2171. end
  2172. return original(remote, ...)
  2173. end, original)
  2174.  
  2175. local newFireServer = newcclosure(function(...)
  2176. return hookRemote("RemoteEvent", ...)
  2177. end, originalEvent)
  2178.  
  2179. local newInvokeServer = newcclosure(function(...)
  2180. return hookRemote("RemoteFunction", ...)
  2181. end, originalFunction)
  2182.  
  2183. --- Toggles on and off the remote spy
  2184. function toggleSpy()
  2185. if not toggle then
  2186. if hookmetamethod then
  2187. local oldNamecall = hookmetamethod(game, "__namecall", newnamecall)
  2188. original = original or function(...)
  2189. return oldNamecall(...)
  2190. end
  2191. _G.OriginalNamecall = original
  2192. else
  2193. gm = gm or getrawmetatable(game)
  2194. original = original or function(...)
  2195. return gm.__namecall(...)
  2196. end
  2197. setreadonly(gm, false)
  2198. if not original then
  2199. warn("SimpleSpy: namecall method not found!")
  2200. onToggleButtonClick()
  2201. return
  2202. end
  2203. gm.__namecall = newnamecall
  2204. setreadonly(gm, true)
  2205. end
  2206. originalEvent = hookfunction(remoteEvent.FireServer, newFireServer)
  2207. originalFunction = hookfunction(remoteFunction.InvokeServer, newInvokeServer)
  2208. else
  2209. if hookmetamethod then
  2210. if original then
  2211. hookmetamethod(game, "__namecall", original)
  2212. end
  2213. else
  2214. gm = gm or getrawmetatable(game)
  2215. setreadonly(gm, false)
  2216. gm.__namecall = original
  2217. setreadonly(gm, true)
  2218. end
  2219. hookfunction(remoteEvent.FireServer, originalEvent)
  2220. hookfunction(remoteFunction.InvokeServer, originalFunction)
  2221. end
  2222. end
  2223.  
  2224. --- Toggles between the two remotespy methods (hookfunction currently = disabled)
  2225. function toggleSpyMethod()
  2226. toggleSpy()
  2227. toggle = not toggle
  2228. end
  2229.  
  2230. --- Shuts down the remote spy
  2231. function shutdown()
  2232. if schedulerconnect then
  2233. schedulerconnect:Disconnect()
  2234. end
  2235. for _, connection in pairs(connections) do
  2236. coroutine.wrap(function()
  2237. connection:Disconnect()
  2238. end)()
  2239. end
  2240. SimpleSpy2:Destroy()
  2241. hookfunction(remoteEvent.FireServer, originalEvent)
  2242. hookfunction(remoteFunction.InvokeServer, originalFunction)
  2243. if hookmetamethod then
  2244. if original then
  2245. hookmetamethod(game, "__namecall", original)
  2246. end
  2247. else
  2248. gm = gm or getrawmetatable(game)
  2249. setreadonly(gm, false)
  2250. gm.__namecall = original
  2251. setreadonly(gm, true)
  2252. end
  2253. _G.SimpleSpyExecuted = false
  2254. end
  2255.  
  2256. -- main
  2257. if not _G.SimpleSpyExecuted then
  2258. local succeeded, err = pcall(function()
  2259. if not RunService:IsClient() then
  2260. error("SimpleSpy cannot run on the server!")
  2261. end
  2262. if
  2263. not hookfunction
  2264. or not getrawmetatable
  2265. or getrawmetatable and not getrawmetatable(game).__namecall
  2266. or not setreadonly
  2267. then
  2268. local missing = {}
  2269. if not hookfunction then
  2270. table.insert(missing, "hookfunction")
  2271. end
  2272. if not getrawmetatable then
  2273. table.insert(missing, "getrawmetatable")
  2274. end
  2275. if getrawmetatable and not getrawmetatable(game).__namecall then
  2276. table.insert(missing, "getrawmetatable(game).__namecall")
  2277. end
  2278. if not setreadonly then
  2279. table.insert(missing, "setreadonly")
  2280. end
  2281. shutdown()
  2282. error(
  2283. "This environment does not support method hooks!\n(Your exploit is not capable of running SimpleSpy)\nMissing: "
  2284. .. table.concat(missing, ", ")
  2285. )
  2286. end
  2287. _G.SimpleSpyShutdown = shutdown
  2288. ContentProvider:PreloadAsync({
  2289. "rbxassetid://6065821980",
  2290. "rbxassetid://6065774948",
  2291. "rbxassetid://6065821086",
  2292. "rbxassetid://6065821596",
  2293. ImageLabel,
  2294. ImageLabel_2,
  2295. ImageLabel_3,
  2296. })
  2297. -- if gethui then funcEnabled = false end
  2298. onToggleButtonClick()
  2299. RemoteTemplate.Parent = nil
  2300. FunctionTemplate.Parent = nil
  2301. codebox = Highlight.new(CodeBox)
  2302. codebox:setRaw("")
  2303. getgenv().SimpleSpy = SimpleSpy
  2304. getgenv().getNil = function(name, class)
  2305. for _, v in pairs(getnilinstances()) do
  2306. if v.ClassName == class and v.Name == name then
  2307. return v
  2308. end
  2309. end
  2310. end
  2311. TextLabel:GetPropertyChangedSignal("Text"):Connect(scaleToolTip)
  2312. -- TopBar.InputBegan:Connect(onBarInput)
  2313. MinimizeButton.MouseButton1Click:Connect(toggleMinimize)
  2314. MaximizeButton.MouseButton1Click:Connect(toggleSideTray)
  2315. Simple.MouseButton1Click:Connect(onToggleButtonClick)
  2316. CloseButton.MouseEnter:Connect(onXButtonHover)
  2317. CloseButton.MouseLeave:Connect(onXButtonUnhover)
  2318. Simple.MouseEnter:Connect(onToggleButtonHover)
  2319. Simple.MouseLeave:Connect(onToggleButtonUnhover)
  2320. CloseButton.MouseButton1Click:Connect(shutdown)
  2321. table.insert(connections, UserInputService.InputBegan:Connect(backgroundUserInput))
  2322. connectResize()
  2323. SimpleSpy2.Enabled = true
  2324. coroutine.wrap(function()
  2325. wait(1)
  2326. onToggleButtonUnhover()
  2327. end)()
  2328. schedulerconnect = RunService.Heartbeat:Connect(taskscheduler)
  2329. if syn and syn.protect_gui then
  2330. pcall(syn.protect_gui, SimpleSpy2)
  2331. end
  2332. bringBackOnResize()
  2333. SimpleSpy2.Parent = --[[gethui and gethui() or]]
  2334. CoreGui
  2335. _G.SimpleSpyExecuted = true
  2336. if not Players.LocalPlayer then
  2337. Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
  2338. end
  2339. Mouse = Players.LocalPlayer:GetMouse()
  2340. oldIcon = Mouse.Icon
  2341. table.insert(connections, Mouse.Move:Connect(mouseMoved))
  2342. end)
  2343. if not succeeded then
  2344. warn(
  2345. "A fatal error has occured, SimpleSpy was unable to launch properly.\nPlease DM this error message to @exx#9394:\n\n"
  2346. .. tostring(err)
  2347. )
  2348. SimpleSpy2:Destroy()
  2349. hookfunction(remoteEvent.FireServer, originalEvent)
  2350. hookfunction(remoteFunction.InvokeServer, originalFunction)
  2351. if hookmetamethod then
  2352. if original then
  2353. hookmetamethod(game, "__namecall", original)
  2354. end
  2355. else
  2356. setreadonly(gm, false)
  2357. gm.__namecall = original
  2358. setreadonly(gm, true)
  2359. end
  2360. return
  2361. end
  2362. else
  2363. SimpleSpy2:Destroy()
  2364. return
  2365. end
  2366.  
  2367. ----- ADD ONS ----- (easily add or remove additonal functionality to the RemoteSpy!)
  2368. --[[
  2369. Some helpful things:
  2370. - add your function in here, and create buttons for them through the 'newButton' function
  2371. - the first argument provided is the TextButton the player clicks to run the function
  2372. - generated scripts are generated when the namecall is initially fired and saved in remoteFrame objects
  2373. - blacklisted remotes will be ignored directly in namecall (less lag)
  2374. - the properties of a 'remoteFrame' object:
  2375. {
  2376. Name: (string) The name of the Remote
  2377. GenScript: (string) The generated script that appears in the codebox (generated when namecall fired)
  2378. Source: (Instance (LocalScript)) The script that fired/invoked the remote
  2379. Remote: (Instance (RemoteEvent) | Instance (RemoteFunction)) The remote that was fired/invoked
  2380. Log: (Instance (TextButton)) The button being used for the remote (same as 'selected.Log')
  2381. }
  2382. - globals list: (contact @exx#9394 for more information or if you have suggestions for more to be added)
  2383. - closed: (boolean) whether or not the GUI is currently minimized
  2384. - logs: (table[remoteFrame]) full of remoteFrame objects (properties listed above)
  2385. - selected: (remoteFrame) the currently selected remoteFrame (properties listed above)
  2386. - blacklist: (string[] | Instance[] (RemoteEvent) | Instance[] (RemoteFunction)) an array of blacklisted names and remotes
  2387. - codebox: (Instance (TextBox)) the textbox that holds all the code- cleared often
  2388. ]]
  2389. -- Copies the contents of the codebox
  2390. newButton("Copy Code", function()
  2391. return "Click to copy code"
  2392. end, function()
  2393. setclipboard(codebox:getString())
  2394. TextLabel.Text = "Copied successfully!"
  2395. end)
  2396.  
  2397. --- Copies the source script (that fired the remote)
  2398. newButton("Copy Remote", function()
  2399. return "Click to copy the path of the remote"
  2400. end, function()
  2401. if selected then
  2402. setclipboard(v2s(selected.Remote.remote))
  2403. TextLabel.Text = "Copied!"
  2404. end
  2405. end)
  2406.  
  2407. -- Executes the contents of the codebox through loadstring
  2408. newButton("Run Code", function()
  2409. return "Click to execute code"
  2410. end, function()
  2411. local orText = "Click to execute code"
  2412. TextLabel.Text = "Executing..."
  2413. local succeeded = pcall(function()
  2414. return loadstring(codebox:getString())()
  2415. end)
  2416. if succeeded then
  2417. TextLabel.Text = "Executed successfully!"
  2418. else
  2419. TextLabel.Text = "Execution error!"
  2420. end
  2421. end)
  2422.  
  2423. --- Gets the calling script (not super reliable but w/e)
  2424. newButton("Get Script", function()
  2425. return "Click to copy calling script to clipboard\nWARNING: Not super reliable, nil == could not find"
  2426. end, function()
  2427. if selected then
  2428. setclipboard(SimpleSpy:ValueToString(selected.Source))
  2429. TextLabel.Text = "Done!"
  2430. end
  2431. end)
  2432.  
  2433. --- Decompiles the script that fired the remote and puts it in the code box
  2434. newButton("Function Info", function()
  2435. return "Click to view calling function information"
  2436. end, function()
  2437. if selected then
  2438. if selected.Function then
  2439. codebox:setRaw(
  2440. "-- Calling function info\n-- Generated by the SimpleSpy serializer\n\n" .. tostring(selected.Function)
  2441. )
  2442. end
  2443. TextLabel.Text = "Done! Function info generated by the SimpleSpy Serializer."
  2444. end
  2445. end)
  2446.  
  2447. --- Clears the Remote logs
  2448. newButton("Clr Logs", function()
  2449. return "Click to clear logs"
  2450. end, function()
  2451. TextLabel.Text = "Clearing..."
  2452. logs = {}
  2453. for _, v in pairs(LogList:GetChildren()) do
  2454. if not v:IsA("UIListLayout") then
  2455. v:Destroy()
  2456. end
  2457. end
  2458. codebox:setRaw("")
  2459. selected = nil
  2460. TextLabel.Text = "Logs cleared!"
  2461. end)
  2462.  
  2463. --- Excludes the selected.Log Remote from the RemoteSpy
  2464. newButton("Exclude (i)", function()
  2465. return "Click to exclude this Remote.\nExcluding a remote makes SimpleSpy ignore it, but it will continue to be usable."
  2466. end, function()
  2467. if selected then
  2468. blacklist[selected.Remote.remote] = true
  2469. TextLabel.Text = "Excluded!"
  2470. end
  2471. end)
  2472.  
  2473. --- Excludes all Remotes that share the same name as the selected.Log remote from the RemoteSpy
  2474. newButton("Exclude (n)", function()
  2475. return "Click to exclude all remotes with this name.\nExcluding a remote makes SimpleSpy ignore it, but it will continue to be usable."
  2476. end, function()
  2477. if selected then
  2478. blacklist[selected.Name] = true
  2479. TextLabel.Text = "Excluded!"
  2480. end
  2481. end)
  2482.  
  2483. --- clears blacklist
  2484. newButton("Clr Blacklist", function()
  2485. return "Click to clear the blacklist.\nExcluding a remote makes SimpleSpy ignore it, but it will continue to be usable."
  2486. end, function()
  2487. blacklist = {}
  2488. TextLabel.Text = "Blacklist cleared!"
  2489. end)
  2490.  
  2491. --- Prevents the selected.Log Remote from firing the server (still logged)
  2492. newButton("Block (i)", function()
  2493. return "Click to stop this remote from firing.\nBlocking a remote won't remove it from SimpleSpy logs, but it will not continue to fire the server."
  2494. end, function()
  2495. if selected then
  2496. if selected.Remote.remote then
  2497. blocklist[selected.Remote.remote] = true
  2498. TextLabel.Text = "Excluded!"
  2499. else
  2500. TextLabel.Text = "Error! Instance may no longer exist, try using Block (n)."
  2501. end
  2502. end
  2503. end)
  2504.  
  2505. --- Prevents all remotes from firing that share the same name as the selected.Log remote from the RemoteSpy (still logged)
  2506. newButton("Block (n)", function()
  2507. return "Click to stop remotes with this name from firing.\nBlocking a remote won't remove it from SimpleSpy logs, but it will not continue to fire the server."
  2508. end, function()
  2509. if selected then
  2510. blocklist[selected.Name] = true
  2511. TextLabel.Text = "Excluded!"
  2512. end
  2513. end)
  2514.  
  2515. --- clears blacklist
  2516. newButton("Clr Blocklist", function()
  2517. return "Click to stop blocking remotes.\nBlocking a remote won't remove it from SimpleSpy logs, but it will not continue to fire the server."
  2518. end, function()
  2519. blocklist = {}
  2520. TextLabel.Text = "Blocklist cleared!"
  2521. end)
  2522.  
  2523. --- Attempts to decompile the source script
  2524. newButton("Decompile", function()
  2525. return "Attempts to decompile source script\nWARNING: Not super reliable, nil == could not find"
  2526. end, function()
  2527. if selected then
  2528. if selected.Source then
  2529. codebox:setRaw(decompile(selected.Source))
  2530. TextLabel.Text = "Done!"
  2531. else
  2532. TextLabel.Text = "Source not found!"
  2533. end
  2534. end
  2535. end)
  2536.  
  2537. newButton("Disable Info", function()
  2538. return string.format(
  2539. "[%s] Toggle function info (because it can cause lag in some games)",
  2540. funcEnabled and "ENABLED" or "DISABLED"
  2541. )
  2542. end, function()
  2543. funcEnabled = not funcEnabled
  2544. TextLabel.Text = string.format(
  2545. "[%s] Toggle function info (because it can cause lag in some games)",
  2546. funcEnabled and "ENABLED" or "DISABLED"
  2547. )
  2548. end)
  2549.  
  2550. newButton("Autoblock", function()
  2551. return string.format(
  2552. "[%s] [BETA] Intelligently detects and excludes spammy remote calls from logs",
  2553. autoblock and "ENABLED" or "DISABLED"
  2554. )
  2555. end, function()
  2556. autoblock = not autoblock
  2557. TextLabel.Text = string.format(
  2558. "[%s] [BETA] Intelligently detects and excludes spammy remote calls from logs",
  2559. autoblock and "ENABLED" or "DISABLED"
  2560. )
  2561. history = {}
  2562. excluding = {}
  2563. end)
  2564.  
  2565. newButton("CallingScript", function()
  2566. return string.format(
  2567. "[%s] [UNSAFE] Uses 'getcallingscript' to get calling script for Decompile and GetScript. Much more reliable, but opens up SimpleSpy to detection and/or instability.",
  2568. useGetCallingScript and "ENABLED" or "DISABLED"
  2569. )
  2570. end, function()
  2571. useGetCallingScript = not useGetCallingScript
  2572. TextLabel.Text = string.format(
  2573. "[%s] [UNSAFE] Uses 'getcallingscript' to get calling script for Decompile and GetScript. Much more reliable, but opens up SimpleSpy to detection and/or instability.",
  2574. useGetCallingScript and "ENABLED" or "DISABLED"
  2575. )
  2576. end)
  2577.  
  2578. newButton("KeyToString", function()
  2579. return string.format(
  2580. "[%s] [BETA] Uses an experimental new function to replicate Roblox's behavior when a non-primitive type is used as a key in a table. Still in development and may not properly reflect tostringed (empty) userdata.",
  2581. keyToString and "ENABLED" or "DISABLED"
  2582. )
  2583. end, function()
  2584. keyToString = not keyToString
  2585. TextLabel.Text = string.format(
  2586. "[%s] [BETA] Uses an experimental new function to replicate Roblox's behavior when a non-primitive type is used as a key in a table. Still in development and may not properly reflect tostringed (empty) userdata.",
  2587. keyToString and "ENABLED" or "DISABLED"
  2588. )
  2589. end)
  2590.  
  2591. newButton("ToggleReturnValues", function()
  2592. return string.format(
  2593. "[%s] [EXPERIMENTAL] Enables recording of return values for 'GetReturnValue'\n\nUse this method at your own risk, as it could be detectable.",
  2594. recordReturnValues and "ENABLED" or "DISABLED"
  2595. )
  2596. end, function()
  2597. recordReturnValues = not recordReturnValues
  2598. TextLabel.Text = string.format(
  2599. "[%s] [EXPERIMENTAL] Enables recording of return values for 'GetReturnValue'\n\nUse this method at your own risk, as it could be detectable.",
  2600. recordReturnValues and "ENABLED" or "DISABLED"
  2601. )
  2602. end)
  2603.  
  2604. newButton("GetReturnValue", function()
  2605. return "[Experimental] If 'ReturnValues' is enabled, this will show the recorded return value for the RemoteFunction (if available)."
  2606. end, function()
  2607. if selected then
  2608. codebox:setRaw(SimpleSpy:ValueToVar(selected.ReturnValue, "returnValue"))
  2609. end
  2610. end)
  2611.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement