zuv

Untitled

zuv
Nov 12th, 2022
565
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 80.23 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 = "Lunar Spy"
  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 = "Lunar Spy"
  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. if
  933. not closed
  934. and mousePos.X >= TopBar.AbsolutePosition.X
  935. and mousePos.X <= TopBar.AbsolutePosition.X + TopBar.AbsoluteSize.X
  936. and mousePos.Y >= Background.AbsolutePosition.Y
  937. and mousePos.Y <= Background.AbsolutePosition.Y + Background.AbsoluteSize.Y
  938. then
  939. if not mouseInGui then
  940. mouseInGui = true
  941. mouseEntered()
  942. end
  943. else
  944. mouseInGui = false
  945. end
  946. end
  947.  
  948. --- Adjusts the ui elements to the 'Maximized' size
  949. function maximizeSize(speed)
  950. if not speed then
  951. speed = 0.05
  952. end
  953. TweenService
  954. :Create(
  955. LeftPanel,
  956. TweenInfo.new(speed),
  957. { Size = UDim2.fromOffset(LeftPanel.AbsoluteSize.X, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y) }
  958. )
  959. :Play()
  960. TweenService
  961. :Create(RightPanel, TweenInfo.new(speed), {
  962. Size = UDim2.fromOffset(
  963. Background.AbsoluteSize.X - LeftPanel.AbsoluteSize.X,
  964. Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y
  965. ),
  966. })
  967. :Play()
  968. TweenService
  969. :Create(
  970. TopBar,
  971. TweenInfo.new(speed),
  972. { Size = UDim2.fromOffset(Background.AbsoluteSize.X, TopBar.AbsoluteSize.Y) }
  973. )
  974. :Play()
  975. TweenService
  976. :Create(ScrollingFrame, TweenInfo.new(speed), {
  977. Size = UDim2.fromOffset(Background.AbsoluteSize.X - LeftPanel.AbsoluteSize.X, 110),
  978. Position = UDim2.fromOffset(0, Background.AbsoluteSize.Y - 119 - TopBar.AbsoluteSize.Y),
  979. })
  980. :Play()
  981. TweenService
  982. :Create(CodeBox, TweenInfo.new(speed), {
  983. Size = UDim2.fromOffset(
  984. Background.AbsoluteSize.X - LeftPanel.AbsoluteSize.X,
  985. Background.AbsoluteSize.Y - 119 - TopBar.AbsoluteSize.Y
  986. ),
  987. })
  988. :Play()
  989. TweenService
  990. :Create(
  991. LogList,
  992. TweenInfo.new(speed),
  993. { Size = UDim2.fromOffset(LogList.AbsoluteSize.X, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y - 18) }
  994. )
  995. :Play()
  996. end
  997.  
  998. --- Adjusts the ui elements to close the side
  999. function minimizeSize(speed)
  1000. if not speed then
  1001. speed = 0.05
  1002. end
  1003. TweenService
  1004. :Create(
  1005. LeftPanel,
  1006. TweenInfo.new(speed),
  1007. { Size = UDim2.fromOffset(LeftPanel.AbsoluteSize.X, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y) }
  1008. )
  1009. :Play()
  1010. TweenService
  1011. :Create(
  1012. RightPanel,
  1013. TweenInfo.new(speed),
  1014. { Size = UDim2.fromOffset(0, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y) }
  1015. )
  1016. :Play()
  1017. TweenService
  1018. :Create(
  1019. TopBar,
  1020. TweenInfo.new(speed),
  1021. { Size = UDim2.fromOffset(LeftPanel.AbsoluteSize.X, TopBar.AbsoluteSize.Y) }
  1022. )
  1023. :Play()
  1024. TweenService
  1025. :Create(ScrollingFrame, TweenInfo.new(speed), {
  1026. Size = UDim2.fromOffset(0, 119),
  1027. Position = UDim2.fromOffset(0, Background.AbsoluteSize.Y - 119 - TopBar.AbsoluteSize.Y),
  1028. })
  1029. :Play()
  1030. TweenService
  1031. :Create(
  1032. CodeBox,
  1033. TweenInfo.new(speed),
  1034. { Size = UDim2.fromOffset(0, Background.AbsoluteSize.Y - 119 - TopBar.AbsoluteSize.Y) }
  1035. )
  1036. :Play()
  1037. TweenService
  1038. :Create(
  1039. LogList,
  1040. TweenInfo.new(speed),
  1041. { Size = UDim2.fromOffset(LogList.AbsoluteSize.X, Background.AbsoluteSize.Y - TopBar.AbsoluteSize.Y - 18) }
  1042. )
  1043. :Play()
  1044. end
  1045.  
  1046. --- Ensures size is within screensize limitations
  1047. function validateSize()
  1048. local x, y = Background.AbsoluteSize.X, Background.AbsoluteSize.Y
  1049. local screenSize = workspace.CurrentCamera.ViewportSize
  1050. if x + Background.AbsolutePosition.X > screenSize.X then
  1051. if screenSize.X - Background.AbsolutePosition.X >= 450 then
  1052. x = screenSize.X - Background.AbsolutePosition.X
  1053. else
  1054. x = 450
  1055. end
  1056. elseif y + Background.AbsolutePosition.Y > screenSize.Y then
  1057. if screenSize.X - Background.AbsolutePosition.Y >= 268 then
  1058. y = screenSize.Y - Background.AbsolutePosition.Y
  1059. else
  1060. y = 268
  1061. end
  1062. end
  1063. Background.Size = UDim2.fromOffset(x, y)
  1064. end
  1065.  
  1066. --- Called on user input while mouse in 'Background' frame
  1067. --- @param input InputObject
  1068. function backgroundUserInput(input)
  1069. local mousePos = UserInputService:GetMouseLocation() - Vector2.new(0, 36)
  1070. local inResizeRange, type = isInResizeRange(mousePos)
  1071. if input.UserInputType == Enum.UserInputType.MouseButton1 and inResizeRange then
  1072. local lastPos = UserInputService:GetMouseLocation()
  1073. local offset = Background.AbsoluteSize - lastPos
  1074. local currentPos = lastPos + offset
  1075. RunService:BindToRenderStep("SIMPLESPY_RESIZE", 1, function()
  1076. local newPos = UserInputService:GetMouseLocation()
  1077. if newPos ~= lastPos then
  1078. local currentX = (newPos + offset).X
  1079. local currentY = (newPos + offset).Y
  1080. if currentX < 450 then
  1081. currentX = 450
  1082. end
  1083. if currentY < 268 then
  1084. currentY = 268
  1085. end
  1086. currentPos = Vector2.new(currentX, currentY)
  1087. Background.Size = UDim2.fromOffset(
  1088. (not sideClosed and not closed and (type == "X" or type == "B")) and currentPos.X
  1089. or Background.AbsoluteSize.X,
  1090. (--[[(not sideClosed or currentPos.X <= LeftPanel.AbsolutePosition.X + LeftPanel.AbsoluteSize.X) and]]not closed and (type == "Y" or type == "B"))
  1091. and currentPos.Y
  1092. or Background.AbsoluteSize.Y
  1093. )
  1094. validateSize()
  1095. if sideClosed then
  1096. minimizeSize()
  1097. else
  1098. maximizeSize()
  1099. end
  1100. lastPos = newPos
  1101. end
  1102. end)
  1103. table.insert(
  1104. connections,
  1105. UserInputService.InputEnded:Connect(function(inputE)
  1106. if input == inputE then
  1107. RunService:UnbindFromRenderStep("SIMPLESPY_RESIZE")
  1108. end
  1109. end)
  1110. )
  1111. elseif isInDragRange(mousePos) then
  1112. onBarInput(input)
  1113. end
  1114. end
  1115.  
  1116. --- Gets the player an instance is descended from
  1117. function getPlayerFromInstance(instance)
  1118. for _, v in pairs(Players:GetPlayers()) do
  1119. if v.Character and (instance:IsDescendantOf(v.Character) or instance == v.Character) then
  1120. return v
  1121. end
  1122. end
  1123. end
  1124.  
  1125. --- Runs on MouseButton1Click of an event frame
  1126. function eventSelect(frame)
  1127. if selected and selected.Log and selected.Log.Button then
  1128. TweenService
  1129. :Create(selected.Log.Button, TweenInfo.new(0.5), { BackgroundColor3 = Color3.fromRGB(0, 0, 0) })
  1130. :Play()
  1131. selected = nil
  1132. end
  1133. for _, v in pairs(logs) do
  1134. if frame == v.Log then
  1135. selected = v
  1136. end
  1137. end
  1138. if selected and selected.Log then
  1139. TweenService
  1140. :Create(frame.Button, TweenInfo.new(0.5), { BackgroundColor3 = Color3.fromRGB(92, 126, 229) })
  1141. :Play()
  1142. codebox:setRaw(selected.GenScript)
  1143. end
  1144. if sideClosed then
  1145. toggleSideTray()
  1146. end
  1147. end
  1148.  
  1149. --- Updates the canvas size to fit the current amount of function buttons
  1150. function updateFunctionCanvas()
  1151. ScrollingFrame.CanvasSize = UDim2.fromOffset(UIGridLayout.AbsoluteContentSize.X, UIGridLayout.AbsoluteContentSize.Y)
  1152. end
  1153.  
  1154. --- Updates the canvas size to fit the amount of current remotes
  1155. function updateRemoteCanvas()
  1156. LogList.CanvasSize = UDim2.fromOffset(UIListLayout.AbsoluteContentSize.X, UIListLayout.AbsoluteContentSize.Y)
  1157. end
  1158.  
  1159. --- Allows for toggling of the tooltip and easy setting of le description
  1160. --- @param enable boolean
  1161. --- @param text string
  1162. function makeToolTip(enable, text)
  1163. if enable then
  1164. if ToolTip.Visible then
  1165. ToolTip.Visible = false
  1166. RunService:UnbindFromRenderStep("ToolTip")
  1167. end
  1168. local first = true
  1169. RunService:BindToRenderStep("ToolTip", 1, function()
  1170. local topLeft = Vector2.new(Mouse.X + 20, Mouse.Y + 20)
  1171. local bottomRight = topLeft + ToolTip.AbsoluteSize
  1172. if topLeft.X < 0 then
  1173. topLeft = Vector2.new(0, topLeft.Y)
  1174. elseif bottomRight.X > workspace.CurrentCamera.ViewportSize.X then
  1175. topLeft = Vector2.new(workspace.CurrentCamera.ViewportSize.X - ToolTip.AbsoluteSize.X, topLeft.Y)
  1176. end
  1177. if topLeft.Y < 0 then
  1178. topLeft = Vector2.new(topLeft.X, 0)
  1179. elseif bottomRight.Y > workspace.CurrentCamera.ViewportSize.Y - 35 then
  1180. topLeft = Vector2.new(topLeft.X, workspace.CurrentCamera.ViewportSize.Y - ToolTip.AbsoluteSize.Y - 35)
  1181. end
  1182. if topLeft.X <= Mouse.X and topLeft.Y <= Mouse.Y then
  1183. topLeft = Vector2.new(Mouse.X - ToolTip.AbsoluteSize.X - 2, Mouse.Y - ToolTip.AbsoluteSize.Y - 2)
  1184. end
  1185. if first then
  1186. ToolTip.Position = UDim2.fromOffset(topLeft.X, topLeft.Y)
  1187. first = false
  1188. else
  1189. ToolTip:TweenPosition(UDim2.fromOffset(topLeft.X, topLeft.Y), "Out", "Linear", 0.1)
  1190. end
  1191. end)
  1192. TextLabel.Text = text
  1193. ToolTip.Visible = true
  1194. else
  1195. if ToolTip.Visible then
  1196. ToolTip.Visible = false
  1197. RunService:UnbindFromRenderStep("ToolTip")
  1198. end
  1199. end
  1200. end
  1201.  
  1202. --- Creates new function button (below codebox)
  1203. --- @param name string
  1204. ---@param description function
  1205. ---@param onClick function
  1206. function newButton(name, description, onClick)
  1207. local button = FunctionTemplate:Clone()
  1208. button.Text.Text = name
  1209. button.Button.MouseEnter:Connect(function()
  1210. makeToolTip(true, description())
  1211. end)
  1212. button.Button.MouseLeave:Connect(function()
  1213. makeToolTip(false)
  1214. end)
  1215. button.AncestryChanged:Connect(function()
  1216. makeToolTip(false)
  1217. end)
  1218. button.Button.MouseButton1Click:Connect(function(...)
  1219. onClick(button, ...)
  1220. end)
  1221. button.Parent = ScrollingFrame
  1222. updateFunctionCanvas()
  1223. end
  1224.  
  1225. --- Adds new Remote to logs
  1226. --- @param name string The name of the remote being logged
  1227. --- @param type string The type of the remote being logged (either 'function' or 'event')
  1228. --- @param args any
  1229. --- @param remote any
  1230. --- @param function_info string
  1231. --- @param blocked any
  1232. function newRemote(type, name, args, remote, function_info, blocked, src, returnValue)
  1233. local remoteFrame = RemoteTemplate:Clone()
  1234. remoteFrame.Text.Text = string.sub(name, 1, 50)
  1235. remoteFrame.ColorBar.BackgroundColor3 = type == "event" and Color3.new(255, 242, 0) or Color3.fromRGB(99, 86, 245)
  1236. local id = Instance.new("IntValue")
  1237. id.Name = "ID"
  1238. id.Value = #logs + 1
  1239. id.Parent = remoteFrame
  1240. local weakRemoteTable = setmetatable({ remote = remote }, { __mode = "v" })
  1241. local log = {
  1242. Name = name,
  1243. Function = function_info,
  1244. Remote = weakRemoteTable,
  1245. Log = remoteFrame,
  1246. Blocked = blocked,
  1247. Source = src,
  1248. GenScript = "-- Generating, please wait... (click to reload)\n-- (If this message persists, the remote args are likely extremely long)",
  1249. ReturnValue = returnValue,
  1250. }
  1251. logs[#logs + 1] = log
  1252. schedule(function()
  1253. log.GenScript = genScript(remote, args)
  1254. if blocked then
  1255. logs[#logs].GenScript = "-- THIS REMOTE WAS PREVENTED FROM FIRING THE SERVER BY Lunar Spy\n\n"
  1256. .. logs[#logs].GenScript
  1257. end
  1258. end)
  1259. local connect = remoteFrame.Button.MouseButton1Click:Connect(function()
  1260. eventSelect(remoteFrame)
  1261. end)
  1262. if layoutOrderNum < 1 then
  1263. layoutOrderNum = 999999999
  1264. end
  1265. remoteFrame.LayoutOrder = layoutOrderNum
  1266. layoutOrderNum = layoutOrderNum - 1
  1267. remoteFrame.Parent = LogList
  1268. table.insert(remoteLogs, 1, { connect, remoteFrame })
  1269. clean()
  1270. updateRemoteCanvas()
  1271. end
  1272.  
  1273. --- Generates a script from the provided arguments (first has to be remote path)
  1274. function genScript(remote, args)
  1275. prevTables = {}
  1276. local gen = ""
  1277. if #args > 0 then
  1278. if not pcall(function()
  1279. gen = v2v({ args = args }) .. "\n"
  1280. end) then
  1281. gen = gen
  1282. .. "-- TableToString failure! Reverting to legacy functionality (results may vary)\nlocal args = {"
  1283. if
  1284. not pcall(function()
  1285. for i, v in pairs(args) do
  1286. if type(i) ~= "Instance" and type(i) ~= "userdata" then
  1287. gen = gen .. "\n [object] = "
  1288. elseif type(i) == "string" then
  1289. gen = gen .. '\n ["' .. i .. '"] = '
  1290. elseif type(i) == "userdata" and typeof(i) ~= "Instance" then
  1291. gen = gen .. "\n [" .. string.format("nil --[[%s]]", typeof(v)) .. ")] = "
  1292. elseif type(i) == "userdata" then
  1293. gen = gen .. "\n [game." .. i:GetFullName() .. ")] = "
  1294. end
  1295. if type(v) ~= "Instance" and type(v) ~= "userdata" then
  1296. gen = gen .. "object"
  1297. elseif type(v) == "string" then
  1298. gen = gen .. '"' .. v .. '"'
  1299. elseif type(v) == "userdata" and typeof(v) ~= "Instance" then
  1300. gen = gen .. string.format("nil --[[%s]]", typeof(v))
  1301. elseif type(v) == "userdata" then
  1302. gen = gen .. "game." .. v:GetFullName()
  1303. end
  1304. end
  1305. gen = gen .. "\n}\n\n"
  1306. end)
  1307. then
  1308. gen = gen .. "}\n-- Legacy tableToString failure! Unable to decompile."
  1309. end
  1310. end
  1311. if not remote:IsDescendantOf(game) and not getnilrequired then
  1312. 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"
  1313. .. gen
  1314. end
  1315. if remote:IsA("RemoteEvent") then
  1316. gen = gen .. v2s(remote) .. ":FireServer(unpack(args))"
  1317. elseif remote:IsA("RemoteFunction") then
  1318. gen = gen .. v2s(remote) .. ":InvokeServer(unpack(args))"
  1319. end
  1320. else
  1321. if remote:IsA("RemoteEvent") then
  1322. gen = gen .. v2s(remote) .. ":FireServer()"
  1323. elseif remote:IsA("RemoteFunction") then
  1324. gen = gen .. v2s(remote) .. ":InvokeServer()"
  1325. end
  1326. end
  1327. prevTables = {}
  1328. return gen
  1329. end
  1330.  
  1331. --- value-to-string: value, string (out), level (indentation), parent table, var name, is from tovar
  1332. function v2s(v, l, p, n, vtv, i, pt, path, tables, tI)
  1333. if not tI then
  1334. tI = { 0 }
  1335. else
  1336. tI[1] += 1
  1337. end
  1338. if typeof(v) == "number" then
  1339. if v == math.huge then
  1340. return "math.huge"
  1341. elseif tostring(v):match("nan") then
  1342. return "0/0 --[[NaN]]"
  1343. end
  1344. return tostring(v)
  1345. elseif typeof(v) == "boolean" then
  1346. return tostring(v)
  1347. elseif typeof(v) == "string" then
  1348. return formatstr(v, l)
  1349. elseif typeof(v) == "function" then
  1350. return f2s(v)
  1351. elseif typeof(v) == "table" then
  1352. return t2s(v, l, p, n, vtv, i, pt, path, tables, tI)
  1353. elseif typeof(v) == "Instance" then
  1354. return i2p(v)
  1355. elseif typeof(v) == "userdata" then
  1356. return "newproxy(true)"
  1357. elseif type(v) == "userdata" then
  1358. return u2s(v)
  1359. elseif type(v) == "vector" then
  1360. return string.format("Vector3.new(%s, %s, %s)", v2s(v.X), v2s(v.Y), v2s(v.Z))
  1361. else
  1362. return "nil --[[" .. typeof(v) .. "]]"
  1363. end
  1364. end
  1365.  
  1366. --- value-to-variable
  1367. --- @param t any
  1368. function v2v(t)
  1369. topstr = ""
  1370. bottomstr = ""
  1371. getnilrequired = false
  1372. local ret = ""
  1373. local count = 1
  1374. for i, v in pairs(t) do
  1375. if type(i) == "string" and i:match("^[%a_]+[%w_]*$") then
  1376. ret = ret .. "local " .. i .. " = " .. v2s(v, nil, nil, i, true) .. "\n"
  1377. elseif tostring(i):match("^[%a_]+[%w_]*$") then
  1378. ret = ret
  1379. .. "local "
  1380. .. tostring(i):lower()
  1381. .. "_"
  1382. .. tostring(count)
  1383. .. " = "
  1384. .. v2s(v, nil, nil, tostring(i):lower() .. "_" .. tostring(count), true)
  1385. .. "\n"
  1386. else
  1387. ret = ret
  1388. .. "local "
  1389. .. type(v)
  1390. .. "_"
  1391. .. tostring(count)
  1392. .. " = "
  1393. .. v2s(v, nil, nil, type(v) .. "_" .. tostring(count), true)
  1394. .. "\n"
  1395. end
  1396. count = count + 1
  1397. end
  1398. if getnilrequired then
  1399. 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"
  1400. .. topstr
  1401. end
  1402. if #topstr > 0 then
  1403. ret = topstr .. "\n" .. ret
  1404. end
  1405. if #bottomstr > 0 then
  1406. ret = ret .. bottomstr
  1407. end
  1408. return ret
  1409. end
  1410.  
  1411. --- table-to-string
  1412. --- @param t table
  1413. --- @param l number
  1414. --- @param p table
  1415. --- @param n string
  1416. --- @param vtv boolean
  1417. --- @param i any
  1418. --- @param pt table
  1419. --- @param path string
  1420. --- @param tables table
  1421. --- @param tI table
  1422. function t2s(t, l, p, n, vtv, i, pt, path, tables, tI)
  1423. local globalIndex = table.find(getgenv(), t) -- checks if table is a global
  1424. if type(globalIndex) == "string" then
  1425. return globalIndex
  1426. end
  1427. if not tI then
  1428. tI = { 0 }
  1429. end
  1430. if not path then -- sets path to empty string (so it doesn't have to manually provided every time)
  1431. path = ""
  1432. end
  1433. if not l then -- sets the level to 0 (for indentation) and tables for logging tables it already serialized
  1434. l = 0
  1435. tables = {}
  1436. end
  1437. if not p then -- p is the previous table but doesn't really matter if it's the first
  1438. p = t
  1439. end
  1440. for _, v in pairs(tables) do -- checks if the current table has been serialized before
  1441. if n and rawequal(v, t) then
  1442. bottomstr = bottomstr
  1443. .. "\n"
  1444. .. tostring(n)
  1445. .. tostring(path)
  1446. .. " = "
  1447. .. tostring(n)
  1448. .. tostring(({ v2p(v, p) })[2])
  1449. return "{} --[[DUPLICATE]]"
  1450. end
  1451. end
  1452. table.insert(tables, t) -- logs table to past tables
  1453. local s = "{" -- start of serialization
  1454. local size = 0
  1455. l = l + indent -- set indentation level
  1456. for k, v in pairs(t) do -- iterates over table
  1457. size = size + 1 -- changes size for max limit
  1458. if size > (_G.SimpleSpyMaxTableSize or 1000) then
  1459. s = s
  1460. .. "\n"
  1461. .. string.rep(" ", l)
  1462. .. "-- MAXIMUM TABLE SIZE REACHED, CHANGE '_G.SimpleSpyMaxTableSize' TO ADJUST MAXIMUM SIZE "
  1463. break
  1464. end
  1465. if rawequal(k, t) then -- checks if the table being iterated over is being used as an index within itself (yay, lua)
  1466. bottomstr = bottomstr
  1467. .. "\n"
  1468. .. tostring(n)
  1469. .. tostring(path)
  1470. .. "["
  1471. .. tostring(n)
  1472. .. tostring(path)
  1473. .. "]"
  1474. .. " = "
  1475. .. (
  1476. rawequal(v, k) and tostring(n) .. tostring(path)
  1477. or v2s(v, l, p, n, vtv, k, t, path .. "[" .. tostring(n) .. tostring(path) .. "]", tables)
  1478. )
  1479. size -= 1
  1480. continue
  1481. end
  1482. local currentPath = "" -- initializes the path of 'v' within 't'
  1483. if type(k) == "string" and k:match("^[%a_]+[%w_]*$") then -- cleanly handles table path generation (for the first half)
  1484. currentPath = "." .. k
  1485. else
  1486. currentPath = "[" .. k2s(k, l, p, n, vtv, k, t, path .. currentPath, tables, tI) .. "]"
  1487. end
  1488. if size % 100 == 0 then
  1489. scheduleWait()
  1490. end
  1491. -- actually serializes the member of the table
  1492. s = s
  1493. .. "\n"
  1494. .. string.rep(" ", l)
  1495. .. "["
  1496. .. k2s(k, l, p, n, vtv, k, t, path .. currentPath, tables, tI)
  1497. .. "] = "
  1498. .. v2s(v, l, p, n, vtv, k, t, path .. currentPath, tables, tI)
  1499. .. ","
  1500. end
  1501. 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...)
  1502. s = s:sub(1, #s - 1)
  1503. end
  1504. if size > 0 then -- cleanly indents the last curly bracket
  1505. s = s .. "\n" .. string.rep(" ", l - indent)
  1506. end
  1507. return s .. "}"
  1508. end
  1509.  
  1510. --- key-to-string
  1511. function k2s(v, ...)
  1512. if keyToString then
  1513. if typeof(v) == "userdata" and getrawmetatable(v) then
  1514. return string.format(
  1515. '"<void> (%s)" --[[Potentially hidden data (tostring in Lunar Spy:HookRemote/GetRemoteFiredSignal at your own risk)]]',
  1516. safetostring(v)
  1517. )
  1518. elseif typeof(v) == "userdata" then
  1519. return string.format('"<void> (%s)"', safetostring(v))
  1520. elseif type(v) == "userdata" and typeof(v) ~= "Instance" then
  1521. return string.format('"<%s> (%s)"', typeof(v), tostring(v))
  1522. elseif type(v) == "function" then
  1523. return string.format('"<Function> (%s)"', tostring(v))
  1524. end
  1525. end
  1526. return v2s(v, ...)
  1527. end
  1528.  
  1529. --- function-to-string
  1530. function f2s(f)
  1531. for k, x in pairs(getgenv()) do
  1532. local isgucci, gpath
  1533. if rawequal(x, f) then
  1534. isgucci, gpath = true, ""
  1535. elseif type(x) == "table" then
  1536. isgucci, gpath = v2p(f, x)
  1537. end
  1538. if isgucci and type(k) ~= "function" then
  1539. if type(k) == "string" and k:match("^[%a_]+[%w_]*$") then
  1540. return k .. gpath
  1541. else
  1542. return "getgenv()[" .. v2s(k) .. "]" .. gpath
  1543. end
  1544. end
  1545. end
  1546. if funcEnabled and debug.getinfo(f).name:match("^[%a_]+[%w_]*$") then
  1547. return "function()end --[[" .. debug.getinfo(f).name .. "]]"
  1548. end
  1549. return "function()end --[[" .. tostring(f) .. "]]"
  1550. end
  1551.  
  1552. --- instance-to-path
  1553. --- @param i userdata
  1554. function i2p(i)
  1555. local player = getplayer(i)
  1556. local parent = i
  1557. local out = ""
  1558. if parent == nil then
  1559. return "nil"
  1560. elseif player then
  1561. while true do
  1562. if parent and parent == player.Character then
  1563. if player == Players.LocalPlayer then
  1564. return 'game:GetService("Players").LocalPlayer.Character' .. out
  1565. else
  1566. return i2p(player) .. ".Character" .. out
  1567. end
  1568. else
  1569. if parent.Name:match("[%a_]+[%w+]*") ~= parent.Name then
  1570. out = ":FindFirstChild(" .. formatstr(parent.Name) .. ")" .. out
  1571. else
  1572. out = "." .. parent.Name .. out
  1573. end
  1574. end
  1575. parent = parent.Parent
  1576. end
  1577. elseif parent ~= game then
  1578. while true do
  1579. if parent and parent.Parent == game then
  1580. local service = game:FindService(parent.ClassName)
  1581. if service then
  1582. if parent.ClassName == "Workspace" then
  1583. return "workspace" .. out
  1584. else
  1585. return 'game:GetService("' .. service.ClassName .. '")' .. out
  1586. end
  1587. else
  1588. if parent.Name:match("[%a_]+[%w_]*") then
  1589. return "game." .. parent.Name .. out
  1590. else
  1591. return "game:FindFirstChild(" .. formatstr(parent.Name) .. ")" .. out
  1592. end
  1593. end
  1594. elseif parent.Parent == nil then
  1595. getnilrequired = true
  1596. return "getNil(" .. formatstr(parent.Name) .. ', "' .. parent.ClassName .. '")' .. out
  1597. elseif parent == Players.LocalPlayer then
  1598. out = ".LocalPlayer" .. out
  1599. else
  1600. if parent.Name:match("[%a_]+[%w_]*") ~= parent.Name then
  1601. out = ":FindFirstChild(" .. formatstr(parent.Name) .. ")" .. out
  1602. else
  1603. out = "." .. parent.Name .. out
  1604. end
  1605. end
  1606. parent = parent.Parent
  1607. end
  1608. else
  1609. return "game"
  1610. end
  1611. end
  1612.  
  1613. --- userdata-to-string: userdata
  1614. --- @param u userdata
  1615. function u2s(u)
  1616. if typeof(u) == "TweenInfo" then
  1617. -- TweenInfo
  1618. return "TweenInfo.new("
  1619. .. tostring(u.Time)
  1620. .. ", Enum.EasingStyle."
  1621. .. tostring(u.EasingStyle)
  1622. .. ", Enum.EasingDirection."
  1623. .. tostring(u.EasingDirection)
  1624. .. ", "
  1625. .. tostring(u.RepeatCount)
  1626. .. ", "
  1627. .. tostring(u.Reverses)
  1628. .. ", "
  1629. .. tostring(u.DelayTime)
  1630. .. ")"
  1631. elseif typeof(u) == "Ray" then
  1632. -- Ray
  1633. return "Ray.new(" .. u2s(u.Origin) .. ", " .. u2s(u.Direction) .. ")"
  1634. elseif typeof(u) == "NumberSequence" then
  1635. -- NumberSequence
  1636. local ret = "NumberSequence.new("
  1637. for i, v in pairs(u.KeyPoints) do
  1638. ret = ret .. tostring(v)
  1639. if i < #u.Keypoints then
  1640. ret = ret .. ", "
  1641. end
  1642. end
  1643. return ret .. ")"
  1644. elseif typeof(u) == "DockWidgetPluginGuiInfo" then
  1645. -- DockWidgetPluginGuiInfo
  1646. return "DockWidgetPluginGuiInfo.new(Enum.InitialDockState" .. tostring(u) .. ")"
  1647. elseif typeof(u) == "ColorSequence" then
  1648. -- ColorSequence
  1649. local ret = "ColorSequence.new("
  1650. for i, v in pairs(u.KeyPoints) do
  1651. ret = ret .. "Color3.new(" .. tostring(v) .. ")"
  1652. if i < #u.Keypoints then
  1653. ret = ret .. ", "
  1654. end
  1655. end
  1656. return ret .. ")"
  1657. elseif typeof(u) == "BrickColor" then
  1658. -- BrickColor
  1659. return "BrickColor.new(" .. tostring(u.Number) .. ")"
  1660. elseif typeof(u) == "NumberRange" then
  1661. -- NumberRange
  1662. return "NumberRange.new(" .. tostring(u.Min) .. ", " .. tostring(u.Max) .. ")"
  1663. elseif typeof(u) == "Region3" then
  1664. -- Region3
  1665. local center = u.CFrame.Position
  1666. local size = u.CFrame.Size
  1667. local vector1 = center - size / 2
  1668. local vector2 = center + size / 2
  1669. return "Region3.new(" .. u2s(vector1) .. ", " .. u2s(vector2) .. ")"
  1670. elseif typeof(u) == "Faces" then
  1671. -- Faces
  1672. local faces = {}
  1673. if u.Top then
  1674. table.insert(faces, "Enum.NormalId.Top")
  1675. end
  1676. if u.Bottom then
  1677. table.insert(faces, "Enum.NormalId.Bottom")
  1678. end
  1679. if u.Left then
  1680. table.insert(faces, "Enum.NormalId.Left")
  1681. end
  1682. if u.Right then
  1683. table.insert(faces, "Enum.NormalId.Right")
  1684. end
  1685. if u.Back then
  1686. table.insert(faces, "Enum.NormalId.Back")
  1687. end
  1688. if u.Front then
  1689. table.insert(faces, "Enum.NormalId.Front")
  1690. end
  1691. return "Faces.new(" .. table.concat(faces, ", ") .. ")"
  1692. elseif typeof(u) == "EnumItem" then
  1693. return tostring(u)
  1694. elseif typeof(u) == "Enums" then
  1695. return "Enum"
  1696. elseif typeof(u) == "Enum" then
  1697. return "Enum." .. tostring(u)
  1698. elseif typeof(u) == "RBXScriptSignal" then
  1699. return "nil --[[RBXScriptSignal]]"
  1700. elseif typeof(u) == "Vector3" then
  1701. return string.format("Vector3.new(%s, %s, %s)", v2s(u.X), v2s(u.Y), v2s(u.Z))
  1702. elseif typeof(u) == "CFrame" then
  1703. local xAngle, yAngle, zAngle = u:ToEulerAnglesXYZ()
  1704. return string.format(
  1705. "CFrame.new(%s, %s, %s) * CFrame.Angles(%s, %s, %s)",
  1706. v2s(u.X),
  1707. v2s(u.Y),
  1708. v2s(u.Z),
  1709. v2s(xAngle),
  1710. v2s(yAngle),
  1711. v2s(zAngle)
  1712. )
  1713. elseif typeof(u) == "DockWidgetPluginGuiInfo" then
  1714. return string.format(
  1715. "DockWidgetPluginGuiInfo(%s, %s, %s, %s, %s, %s, %s)",
  1716. "Enum.InitialDockState.Right",
  1717. v2s(u.InitialEnabled),
  1718. v2s(u.InitialEnabledShouldOverrideRestore),
  1719. v2s(u.FloatingXSize),
  1720. v2s(u.FloatingYSize),
  1721. v2s(u.MinWidth),
  1722. v2s(u.MinHeight)
  1723. )
  1724. elseif typeof(u) == "PathWaypoint" then
  1725. return string.format("PathWaypoint.new(%s, %s)", v2s(u.Position), v2s(u.Action))
  1726. elseif typeof(u) == "UDim" then
  1727. return string.format("UDim.new(%s, %s)", v2s(u.Scale), v2s(u.Offset))
  1728. elseif typeof(u) == "UDim2" then
  1729. return string.format(
  1730. "UDim2.new(%s, %s, %s, %s)",
  1731. v2s(u.X.Scale),
  1732. v2s(u.X.Offset),
  1733. v2s(u.Y.Scale),
  1734. v2s(u.Y.Offset)
  1735. )
  1736. elseif typeof(u) == "Rect" then
  1737. return string.format("Rect.new(%s, %s)", v2s(u.Min), v2s(u.Max))
  1738. else
  1739. return string.format("nil --[[%s]]", typeof(u))
  1740. end
  1741. end
  1742.  
  1743. --- Gets the player an instance is descended from
  1744. function getplayer(instance)
  1745. for _, v in pairs(Players:GetPlayers()) do
  1746. if v.Character and (instance:IsDescendantOf(v.Character) or instance == v.Character) then
  1747. return v
  1748. end
  1749. end
  1750. end
  1751.  
  1752. --- value-to-path (in table)
  1753. function v2p(x, t, path, prev)
  1754. if not path then
  1755. path = ""
  1756. end
  1757. if not prev then
  1758. prev = {}
  1759. end
  1760. if rawequal(x, t) then
  1761. return true, ""
  1762. end
  1763. for i, v in pairs(t) do
  1764. if rawequal(v, x) then
  1765. if type(i) == "string" and i:match("^[%a_]+[%w_]*$") then
  1766. return true, (path .. "." .. i)
  1767. else
  1768. return true, (path .. "[" .. v2s(i) .. "]")
  1769. end
  1770. end
  1771. if type(v) == "table" then
  1772. local duplicate = false
  1773. for _, y in pairs(prev) do
  1774. if rawequal(y, v) then
  1775. duplicate = true
  1776. end
  1777. end
  1778. if not duplicate then
  1779. table.insert(prev, t)
  1780. local found
  1781. found, p = v2p(x, v, path, prev)
  1782. if found then
  1783. if type(i) == "string" and i:match("^[%a_]+[%w_]*$") then
  1784. return true, "." .. i .. p
  1785. else
  1786. return true, "[" .. v2s(i) .. "]" .. p
  1787. end
  1788. end
  1789. end
  1790. end
  1791. end
  1792. return false, ""
  1793. end
  1794.  
  1795. --- format s: string, byte encrypt (for weird symbols)
  1796. function formatstr(s, indentation)
  1797. if not indentation then
  1798. indentation = 0
  1799. end
  1800. local handled, reachedMax = handlespecials(s, indentation)
  1801. return '"'
  1802. .. handled
  1803. .. '"'
  1804. .. (
  1805. reachedMax
  1806. and " --[[ MAXIMUM STRING SIZE REACHED, CHANGE '_G.SimpleSpyMaxStringSize' TO ADJUST MAXIMUM SIZE ]]"
  1807. or ""
  1808. )
  1809. end
  1810.  
  1811. --- Adds \'s to the text as a replacement to whitespace chars and other things because string.format can't yayeet
  1812. function handlespecials(value, indentation)
  1813. local buildStr = {}
  1814. local i = 1
  1815. local char = string.sub(value, i, i)
  1816. local indentStr
  1817. while char ~= "" do
  1818. if char == '"' then
  1819. buildStr[i] = '\\"'
  1820. elseif char == "\\" then
  1821. buildStr[i] = "\\\\"
  1822. elseif char == "\n" then
  1823. buildStr[i] = "\\n"
  1824. elseif char == "\t" then
  1825. buildStr[i] = "\\t"
  1826. elseif string.byte(char) > 126 or string.byte(char) < 32 then
  1827. buildStr[i] = string.format("\\%d", string.byte(char))
  1828. else
  1829. buildStr[i] = char
  1830. end
  1831. i = i + 1
  1832. char = string.sub(value, i, i)
  1833. if i % 200 == 0 then
  1834. indentStr = indentStr or string.rep(" ", indentation + indent)
  1835. table.move({ '"\n', indentStr, '... "' }, 1, 3, i, buildStr)
  1836. i += 3
  1837. end
  1838. end
  1839. return table.concat(buildStr)
  1840. end
  1841.  
  1842. -- safe (ish) tostring
  1843. function safetostring(v: any)
  1844. if typeof(v) == "userdata" or type(v) == "table" then
  1845. local mt = getrawmetatable(v)
  1846. local badtostring = mt and rawget(mt, "__tostring")
  1847. if mt and badtostring then
  1848. rawset(mt, "__tostring", nil)
  1849. local out = tostring(v)
  1850. rawset(mt, "__tostring", badtostring)
  1851. return out
  1852. end
  1853. end
  1854. return tostring(v)
  1855. end
  1856.  
  1857. --- finds script from 'src' from getinfo, returns nil if not found
  1858. --- @param src string
  1859. function getScriptFromSrc(src)
  1860. local realPath
  1861. local runningTest
  1862. --- @type number
  1863. local s, e
  1864. local match = false
  1865. if src:sub(1, 1) == "=" then
  1866. realPath = game
  1867. s = 2
  1868. else
  1869. runningTest = src:sub(2, e and e - 1 or -1)
  1870. for _, v in pairs(getnilinstances()) do
  1871. if v.Name == runningTest then
  1872. realPath = v
  1873. break
  1874. end
  1875. end
  1876. s = #runningTest + 1
  1877. end
  1878. if realPath then
  1879. e = src:sub(s, -1):find("%.")
  1880. local i = 0
  1881. repeat
  1882. i += 1
  1883. if not e then
  1884. runningTest = src:sub(s, -1)
  1885. local test = realPath.FindFirstChild(realPath, runningTest)
  1886. if test then
  1887. realPath = test
  1888. end
  1889. match = true
  1890. else
  1891. runningTest = src:sub(s, e)
  1892. local test = realPath.FindFirstChild(realPath, runningTest)
  1893. local yeOld = e
  1894. if test then
  1895. realPath = test
  1896. s = e + 2
  1897. e = src:sub(e + 2, -1):find("%.")
  1898. e = e and e + yeOld or e
  1899. else
  1900. e = src:sub(e + 2, -1):find("%.")
  1901. e = e and e + yeOld or e
  1902. end
  1903. end
  1904. until match or i >= 50
  1905. end
  1906. return realPath
  1907. end
  1908.  
  1909. --- schedules the provided function (and calls it with any args after)
  1910. function schedule(f, ...)
  1911. table.insert(scheduled, { f, ... })
  1912. end
  1913.  
  1914. --- yields the current thread until the scheduler gives the ok
  1915. function scheduleWait()
  1916. local thread = coroutine.running()
  1917. schedule(function()
  1918. coroutine.resume(thread)
  1919. end)
  1920. coroutine.yield()
  1921. end
  1922.  
  1923. --- the big (well tbh small now) boi task scheduler himself, handles p much anything as quicc as possible
  1924. function taskscheduler()
  1925. if not toggle then
  1926. scheduled = {}
  1927. return
  1928. end
  1929. if #scheduled > 1000 then
  1930. table.remove(scheduled, #scheduled)
  1931. end
  1932. if #scheduled > 0 then
  1933. local currentf = scheduled[1]
  1934. table.remove(scheduled, 1)
  1935. if type(currentf) == "table" and type(currentf[1]) == "function" then
  1936. pcall(unpack(currentf))
  1937. end
  1938. end
  1939. end
  1940.  
  1941. --- Handles remote logs
  1942. function remoteHandler(hookfunction, methodName, remote, args, funcInfo, calling, returnValue)
  1943. local validInstance, validClass = pcall(function()
  1944. return remote:IsA("RemoteEvent") or remote:IsA("RemoteFunction")
  1945. end)
  1946. if validInstance and validClass then
  1947. local func = funcInfo.func
  1948. if not calling then
  1949. _, calling = pcall(getScriptFromSrc, funcInfo.source)
  1950. end
  1951. coroutine.wrap(function()
  1952. if remoteSignals[remote] then
  1953. remoteSignals[remote]:Fire(args)
  1954. end
  1955. end)()
  1956. if autoblock then
  1957. if excluding[remote] then
  1958. return
  1959. end
  1960. if not history[remote] then
  1961. history[remote] = { badOccurances = 0, lastCall = tick() }
  1962. end
  1963. if tick() - history[remote].lastCall < 1 then
  1964. history[remote].badOccurances += 1
  1965. return
  1966. else
  1967. history[remote].badOccurances = 0
  1968. end
  1969. if history[remote].badOccurances > 3 then
  1970. excluding[remote] = true
  1971. return
  1972. end
  1973. history[remote].lastCall = tick()
  1974. end
  1975. local functionInfoStr
  1976. local src
  1977. if func and islclosure(func) then
  1978. local functionInfo = {}
  1979. functionInfo.info = funcInfo
  1980. pcall(function()
  1981. functionInfo.constants = debug.getconstants(func)
  1982. end)
  1983. pcall(function()
  1984. functionInfoStr = v2v({ functionInfo = functionInfo })
  1985. end)
  1986. pcall(function()
  1987. if type(calling) == "userdata" then
  1988. src = calling
  1989. end
  1990. end)
  1991. end
  1992. if methodName:lower() == "fireserver" then
  1993. newRemote(
  1994. "event",
  1995. remote.Name,
  1996. args,
  1997. remote,
  1998. functionInfoStr,
  1999. (blocklist[remote] or blocklist[remote.Name]),
  2000. src
  2001. )
  2002. elseif methodName:lower() == "invokeserver" then
  2003. newRemote(
  2004. "function",
  2005. remote.Name,
  2006. args,
  2007. remote,
  2008. functionInfoStr,
  2009. (blocklist[remote] or blocklist[remote.Name]),
  2010. src,
  2011. returnValue
  2012. )
  2013. end
  2014. end
  2015. end
  2016.  
  2017. --- Used for hookfunction
  2018. function hookRemote(remoteType, remote, ...)
  2019. if typeof(remote) == "Instance" then
  2020. local args = { ... }
  2021. local validInstance, remoteName = pcall(function()
  2022. return remote.Name
  2023. end)
  2024. if validInstance and not (blacklist[remote] or blacklist[remoteName]) then
  2025. local funcInfo = {}
  2026. local calling
  2027. if funcEnabled then
  2028. funcInfo = debug.getinfo(4) or funcInfo
  2029. calling = useGetCallingScript and getcallingscript() or nil
  2030. end
  2031. if recordReturnValues and remoteType == "RemoteFunction" then
  2032. local thread = coroutine.running()
  2033. local args = { ... }
  2034. task.defer(function()
  2035. local returnValue
  2036. if remoteHooks[remote] then
  2037. args = { remoteHooks[remote](unpack(args)) }
  2038. returnValue = originalFunction(remote, unpack(args))
  2039. else
  2040. returnValue = originalFunction(remote, unpack(args))
  2041. end
  2042. schedule(
  2043. remoteHandler,
  2044. true,
  2045. remoteType == "RemoteEvent" and "fireserver" or "invokeserver",
  2046. remote,
  2047. args,
  2048. funcInfo,
  2049. calling,
  2050. returnValue
  2051. )
  2052. if blocklist[remote] or blocklist[remoteName] then
  2053. coroutine.resume(thread)
  2054. else
  2055. coroutine.resume(thread, unpack(returnValue))
  2056. end
  2057. end)
  2058. else
  2059. schedule(
  2060. remoteHandler,
  2061. true,
  2062. remoteType == "RemoteEvent" and "fireserver" or "invokeserver",
  2063. remote,
  2064. args,
  2065. funcInfo,
  2066. calling
  2067. )
  2068. if blocklist[remote] or blocklist[remoteName] then
  2069. return
  2070. end
  2071. end
  2072. end
  2073. end
  2074. if recordReturnValues and remoteType == "RemoteFunction" then
  2075. return coroutine.yield()
  2076. elseif remoteType == "RemoteEvent" then
  2077. if remoteHooks[remote] then
  2078. return originalEvent(remote, remoteHooks[remote](...))
  2079. end
  2080. return originalEvent(remote, ...)
  2081. else
  2082. if remoteHooks[remote] then
  2083. return originalFunction(remote, remoteHooks[remote](...))
  2084. end
  2085. return originalFunction(remote, ...)
  2086. end
  2087. end
  2088.  
  2089. local newnamecall = newcclosure(function(remote, ...)
  2090. if typeof(remote) == "Instance" then
  2091. local args = { ... }
  2092. local methodName = getnamecallmethod()
  2093. local validInstance, remoteName = pcall(function()
  2094. return remote.Name
  2095. end)
  2096. if
  2097. validInstance
  2098. and (methodName == "FireServer" or methodName == "fireServer" or methodName == "InvokeServer" or methodName == "invokeServer")
  2099. and not (blacklist[remote] or blacklist[remoteName])
  2100. then
  2101. local funcInfo = {}
  2102. local calling
  2103. if funcEnabled then
  2104. funcInfo = debug.getinfo(3) or funcInfo
  2105. calling = useGetCallingScript and getcallingscript() or nil
  2106. end
  2107. if recordReturnValues and (methodName == "InvokeServer" or methodName == "invokeServer") then
  2108. local namecallThread = coroutine.running()
  2109. local args = { ... }
  2110. task.defer(function()
  2111. local returnValue
  2112. setnamecallmethod(methodName)
  2113. if remoteHooks[remote] then
  2114. args = { remoteHooks[remote](unpack(args)) }
  2115. returnValue = { original(remote, unpack(args)) }
  2116. else
  2117. returnValue = { original(remote, unpack(args)) }
  2118. end
  2119. coroutine.resume(namecallThread, unpack(returnValue))
  2120. coroutine.wrap(function()
  2121. schedule(remoteHandler, false, methodName, remote, args, funcInfo, calling, returnValue)
  2122. end)()
  2123. end)
  2124. else
  2125. coroutine.wrap(function()
  2126. schedule(remoteHandler, false, methodName, remote, args, funcInfo, calling)
  2127. end)()
  2128. end
  2129. end
  2130. if recordReturnValues and (methodName == "InvokeServer" or methodName == "invokeServer") then
  2131. return coroutine.yield()
  2132. elseif
  2133. validInstance
  2134. and (methodName == "FireServer" or methodName == "fireServer" or methodName == "InvokeServer" or methodName == "invokeServer")
  2135. and (blocklist[remote] or blocklist[remoteName])
  2136. then
  2137. return nil
  2138. elseif
  2139. (not recordReturnValues or methodName ~= "InvokeServer" or methodName ~= "invokeServer")
  2140. and validInstance
  2141. and (methodName == "FireServer" or methodName == "fireServer" or methodName == "InvokeServer" or methodName == "invokeServer")
  2142. and remoteHooks[remote]
  2143. then
  2144. return original(remote, remoteHooks[remote](...))
  2145. else
  2146. return original(remote, ...)
  2147. end
  2148. end
  2149. return original(remote, ...)
  2150. end, original)
  2151.  
  2152. local newFireServer = newcclosure(function(...)
  2153. return hookRemote("RemoteEvent", ...)
  2154. end, originalEvent)
  2155.  
  2156. local newInvokeServer = newcclosure(function(...)
  2157. return hookRemote("RemoteFunction", ...)
  2158. end, originalFunction)
  2159.  
  2160. --- Toggles on and off the remote spy
  2161. function toggleSpy()
  2162. if not toggle then
  2163. if hookmetamethod then
  2164. local oldNamecall = hookmetamethod(game, "__namecall", newnamecall)
  2165. original = original or function(...)
  2166. return oldNamecall(...)
  2167. end
  2168. _G.OriginalNamecall = original
  2169. else
  2170. gm = gm or getrawmetatable(game)
  2171. original = original or function(...)
  2172. return gm.__namecall(...)
  2173. end
  2174. setreadonly(gm, false)
  2175. if not original then
  2176. warn("Lunar Spy: namecall method not found!")
  2177. onToggleButtonClick()
  2178. return
  2179. end
  2180. gm.__namecall = newnamecall
  2181. setreadonly(gm, true)
  2182. end
  2183. originalEvent = hookfunction(remoteEvent.FireServer, newFireServer)
  2184. originalFunction = hookfunction(remoteFunction.InvokeServer, newInvokeServer)
  2185. else
  2186. if hookmetamethod then
  2187. if original then
  2188. hookmetamethod(game, "__namecall", original)
  2189. end
  2190. else
  2191. gm = gm or getrawmetatable(game)
  2192. setreadonly(gm, false)
  2193. gm.__namecall = original
  2194. setreadonly(gm, true)
  2195. end
  2196. hookfunction(remoteEvent.FireServer, originalEvent)
  2197. hookfunction(remoteFunction.InvokeServer, originalFunction)
  2198. end
  2199. end
  2200.  
  2201. --- Toggles between the two remotespy methods (hookfunction currently = disabled)
  2202. function toggleSpyMethod()
  2203. toggleSpy()
  2204. toggle = not toggle
  2205. end
  2206.  
  2207. --- Shuts down the remote spy
  2208. function shutdown()
  2209. if schedulerconnect then
  2210. schedulerconnect:Disconnect()
  2211. end
  2212. for _, connection in pairs(connections) do
  2213. coroutine.wrap(function()
  2214. connection:Disconnect()
  2215. end)()
  2216. end
  2217. SimpleSpy2:Destroy()
  2218. hookfunction(remoteEvent.FireServer, originalEvent)
  2219. hookfunction(remoteFunction.InvokeServer, originalFunction)
  2220. if hookmetamethod then
  2221. if original then
  2222. hookmetamethod(game, "__namecall", original)
  2223. end
  2224. else
  2225. gm = gm or getrawmetatable(game)
  2226. setreadonly(gm, false)
  2227. gm.__namecall = original
  2228. setreadonly(gm, true)
  2229. end
  2230. _G.SimpleSpyExecuted = false
  2231. end
  2232.  
  2233. -- main
  2234. if not _G.SimpleSpyExecuted then
  2235. local succeeded, err = pcall(function()
  2236. if not RunService:IsClient() then
  2237. error("Lunar Spy cannot run on the server!")
  2238. end
  2239. if
  2240. not hookfunction
  2241. or not getrawmetatable
  2242. or getrawmetatable and not getrawmetatable(game).__namecall
  2243. or not setreadonly
  2244. then
  2245. local missing = {}
  2246. if not hookfunction then
  2247. table.insert(missing, "hookfunction")
  2248. end
  2249. if not getrawmetatable then
  2250. table.insert(missing, "getrawmetatable")
  2251. end
  2252. if getrawmetatable and not getrawmetatable(game).__namecall then
  2253. table.insert(missing, "getrawmetatable(game).__namecall")
  2254. end
  2255. if not setreadonly then
  2256. table.insert(missing, "setreadonly")
  2257. end
  2258. shutdown()
  2259. error(
  2260. "This environment does not support method hooks!\n(Your exploit is not capable of running Lunar Spy)\nMissing: "
  2261. .. table.concat(missing, ", ")
  2262. )
  2263. end
  2264. _G.SimpleSpyShutdown = shutdown
  2265. ContentProvider:PreloadAsync({
  2266. "rbxassetid://6065821980",
  2267. "rbxassetid://6065774948",
  2268. "rbxassetid://6065821086",
  2269. "rbxassetid://6065821596",
  2270. ImageLabel,
  2271. ImageLabel_2,
  2272. ImageLabel_3,
  2273. })
  2274. -- if gethui then funcEnabled = false end
  2275. onToggleButtonClick()
  2276. RemoteTemplate.Parent = nil
  2277. FunctionTemplate.Parent = nil
  2278. codebox = Highlight.new(CodeBox)
  2279. codebox:setRaw("")
  2280. getgenv().SimpleSpy = SimpleSpy
  2281. getgenv().getNil = function(name, class)
  2282. for _, v in pairs(getnilinstances()) do
  2283. if v.ClassName == class and v.Name == name then
  2284. return v
  2285. end
  2286. end
  2287. end
  2288. TextLabel:GetPropertyChangedSignal("Text"):Connect(scaleToolTip)
  2289. -- TopBar.InputBegan:Connect(onBarInput)
  2290. MinimizeButton.MouseButton1Click:Connect(toggleMinimize)
  2291. MaximizeButton.MouseButton1Click:Connect(toggleSideTray)
  2292. Simple.MouseButton1Click:Connect(onToggleButtonClick)
  2293. CloseButton.MouseEnter:Connect(onXButtonHover)
  2294. CloseButton.MouseLeave:Connect(onXButtonUnhover)
  2295. Simple.MouseEnter:Connect(onToggleButtonHover)
  2296. Simple.MouseLeave:Connect(onToggleButtonUnhover)
  2297. CloseButton.MouseButton1Click:Connect(shutdown)
  2298. table.insert(connections, UserInputService.InputBegan:Connect(backgroundUserInput))
  2299. connectResize()
  2300. SimpleSpy2.Enabled = true
  2301. coroutine.wrap(function()
  2302. wait(1)
  2303. onToggleButtonUnhover()
  2304. end)()
  2305. schedulerconnect = RunService.Heartbeat:Connect(taskscheduler)
  2306. if syn and syn.protect_gui then
  2307. pcall(syn.protect_gui, SimpleSpy2)
  2308. end
  2309. bringBackOnResize()
  2310. SimpleSpy2.Parent = --[[gethui and gethui() or]]
  2311. CoreGui
  2312. _G.SimpleSpyExecuted = true
  2313. if not Players.LocalPlayer then
  2314. Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
  2315. end
  2316. Mouse = Players.LocalPlayer:GetMouse()
  2317. oldIcon = Mouse.Icon
  2318. table.insert(connections, Mouse.Move:Connect(mouseMoved))
  2319. end)
  2320. if not succeeded then
  2321. warn(
  2322. "A fatal error has occured, Lunar Spy was unable to launch properly.\nPlease DM this error message to @exx#9394:\n\n"
  2323. .. tostring(err)
  2324. )
  2325. SimpleSpy2:Destroy()
  2326. hookfunction(remoteEvent.FireServer, originalEvent)
  2327. hookfunction(remoteFunction.InvokeServer, originalFunction)
  2328. if hookmetamethod then
  2329. if original then
  2330. hookmetamethod(game, "__namecall", original)
  2331. end
  2332. else
  2333. setreadonly(gm, false)
  2334. gm.__namecall = original
  2335. setreadonly(gm, true)
  2336. end
  2337. return
  2338. end
  2339. else
  2340. SimpleSpy2:Destroy()
  2341. return
  2342. end
  2343.  
  2344. ----- ADD ONS ----- (easily add or remove additonal functionality to the RemoteSpy!)
  2345. --[[
  2346. Some helpful things:
  2347. - add your function in here, and create buttons for them through the 'newButton' function
  2348. - the first argument provided is the TextButton the player clicks to run the function
  2349. - generated scripts are generated when the namecall is initially fired and saved in remoteFrame objects
  2350. - blacklisted remotes will be ignored directly in namecall (less lag)
  2351. - the properties of a 'remoteFrame' object:
  2352. {
  2353. Name: (string) The name of the Remote
  2354. GenScript: (string) The generated script that appears in the codebox (generated when namecall fired)
  2355. Source: (Instance (LocalScript)) The script that fired/invoked the remote
  2356. Remote: (Instance (RemoteEvent) | Instance (RemoteFunction)) The remote that was fired/invoked
  2357. Log: (Instance (TextButton)) The button being used for the remote (same as 'selected.Log')
  2358. }
  2359. - globals list: (contact @exx#9394 for more information or if you have suggestions for more to be added)
  2360. - closed: (boolean) whether or not the GUI is currently minimized
  2361. - logs: (table[remoteFrame]) full of remoteFrame objects (properties listed above)
  2362. - selected: (remoteFrame) the currently selected remoteFrame (properties listed above)
  2363. - blacklist: (string[] | Instance[] (RemoteEvent) | Instance[] (RemoteFunction)) an array of blacklisted names and remotes
  2364. - codebox: (Instance (TextBox)) the textbox that holds all the code- cleared often
  2365. ]]
  2366. -- Copies the contents of the codebox
  2367. newButton("Copy Code", function()
  2368. return "Click to copy code"
  2369. end, function()
  2370. setclipboard(codebox:getString())
  2371. TextLabel.Text = "Copied successfully!"
  2372. end)
  2373.  
  2374. --- Copies the source script (that fired the remote)
  2375. newButton("Copy Remote", function()
  2376. return "Click to copy the path of the remote"
  2377. end, function()
  2378. if selected then
  2379. setclipboard(v2s(selected.Remote.remote))
  2380. TextLabel.Text = "Copied!"
  2381. end
  2382. end)
  2383.  
  2384. -- Executes the contents of the codebox through loadstring
  2385. newButton("Run Code", function()
  2386. return "Click to execute code"
  2387. end, function()
  2388. local orText = "Click to execute code"
  2389. TextLabel.Text = "Executing..."
  2390. local succeeded = pcall(function()
  2391. return loadstring(codebox:getString())()
  2392. end)
  2393. if succeeded then
  2394. TextLabel.Text = "Executed successfully!"
  2395. else
  2396. TextLabel.Text = "Execution error!"
  2397. end
  2398. end)
  2399.  
  2400. --- Gets the calling script (not super reliable but w/e)
  2401. newButton("Get Script", function()
  2402. return "Click to copy calling script to clipboard\nWARNING: Not super reliable, nil == could not find"
  2403. end, function()
  2404. if selected then
  2405. setclipboard(SimpleSpy:ValueToString(selected.Source))
  2406. TextLabel.Text = "Done!"
  2407. end
  2408. end)
  2409.  
  2410. --- Decompiles the script that fired the remote and puts it in the code box
  2411. newButton("Function Info", function()
  2412. return "Click to view calling function information"
  2413. end, function()
  2414. if selected then
  2415. if selected.Function then
  2416. codebox:setRaw(
  2417. "-- Calling function info\n-- Generated by the Lunar Spy serializer\n\n" .. tostring(selected.Function)
  2418. )
  2419. end
  2420. TextLabel.Text = "Done! Function info generated by the Lunar Spy Serializer."
  2421. end
  2422. end)
  2423.  
  2424. --- Clears the Remote logs
  2425. newButton("Clr Logs", function()
  2426. return "Click to clear logs"
  2427. end, function()
  2428. TextLabel.Text = "Clearing..."
  2429. logs = {}
  2430. for _, v in pairs(LogList:GetChildren()) do
  2431. if not v:IsA("UIListLayout") then
  2432. v:Destroy()
  2433. end
  2434. end
  2435. codebox:setRaw("")
  2436. selected = nil
  2437. TextLabel.Text = "Logs cleared!"
  2438. end)
  2439.  
  2440. --- Excludes the selected.Log Remote from the RemoteSpy
  2441. newButton("Exclude (i)", function()
  2442. return "Click to exclude this Remote.\nExcluding a remote makes Lunar Spy ignore it, but it will continue to be usable."
  2443. end, function()
  2444. if selected then
  2445. blacklist[selected.Remote.remote] = true
  2446. TextLabel.Text = "Excluded!"
  2447. end
  2448. end)
  2449.  
  2450. --- Excludes all Remotes that share the same name as the selected.Log remote from the RemoteSpy
  2451. newButton("Exclude (n)", function()
  2452. return "Click to exclude all remotes with this name.\nExcluding a remote makes SimpleSpy ignore it, but it will continue to be usable."
  2453. end, function()
  2454. if selected then
  2455. blacklist[selected.Name] = true
  2456. TextLabel.Text = "Excluded!"
  2457. end
  2458. end)
  2459.  
  2460. --- clears blacklist
  2461. newButton("Clr Blacklist", function()
  2462. return "Click to clear the blacklist.\nExcluding a remote makes Lunar Spy ignore it, but it will continue to be usable."
  2463. end, function()
  2464. blacklist = {}
  2465. TextLabel.Text = "Blacklist cleared!"
  2466. end)
  2467.  
  2468. --- Prevents the selected.Log Remote from firing the server (still logged)
  2469. newButton("Block (i)", function()
  2470. 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."
  2471. end, function()
  2472. if selected then
  2473. if selected.Remote.remote then
  2474. blocklist[selected.Remote.remote] = true
  2475. TextLabel.Text = "Excluded!"
  2476. else
  2477. TextLabel.Text = "Error! Instance may no longer exist, try using Block (n)."
  2478. end
  2479. end
  2480. end)
  2481.  
  2482. --- Prevents all remotes from firing that share the same name as the selected.Log remote from the RemoteSpy (still logged)
  2483. newButton("Block (n)", function()
  2484. 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."
  2485. end, function()
  2486. if selected then
  2487. blocklist[selected.Name] = true
  2488. TextLabel.Text = "Excluded!"
  2489. end
  2490. end)
  2491.  
  2492. --- clears blacklist
  2493. newButton("Clr Blocklist", function()
  2494. return "Click to stop blocking remotes.\nBlocking a remote won't remove it from Lunar Spy logs, but it will not continue to fire the server."
  2495. end, function()
  2496. blocklist = {}
  2497. TextLabel.Text = "Blocklist cleared!"
  2498. end)
  2499.  
  2500. --- Attempts to decompile the source script
  2501. newButton("Decompile", function()
  2502. return "Attempts to decompile source script\nWARNING: Not super reliable, nil == could not find"
  2503. end, function()
  2504. if selected then
  2505. if selected.Source then
  2506. codebox:setRaw(decompile(selected.Source))
  2507. TextLabel.Text = "Done!"
  2508. else
  2509. TextLabel.Text = "Source not found!"
  2510. end
  2511. end
  2512. end)
  2513.  
  2514. newButton("Disable Info", function()
  2515. return string.format(
  2516. "[%s] Toggle function info (because it can cause lag in some games)",
  2517. funcEnabled and "ENABLED" or "DISABLED"
  2518. )
  2519. end, function()
  2520. funcEnabled = not funcEnabled
  2521. TextLabel.Text = string.format(
  2522. "[%s] Toggle function info (because it can cause lag in some games)",
  2523. funcEnabled and "ENABLED" or "DISABLED"
  2524. )
  2525. end)
  2526.  
  2527. newButton("Autoblock", function()
  2528. return string.format(
  2529. "[%s] [BETA] Intelligently detects and excludes spammy remote calls from logs",
  2530. autoblock and "ENABLED" or "DISABLED"
  2531. )
  2532. end, function()
  2533. autoblock = not autoblock
  2534. TextLabel.Text = string.format(
  2535. "[%s] [BETA] Intelligently detects and excludes spammy remote calls from logs",
  2536. autoblock and "ENABLED" or "DISABLED"
  2537. )
  2538. history = {}
  2539. excluding = {}
  2540. end)
  2541.  
  2542. newButton("CallingScript", function()
  2543. return string.format(
  2544. "[%s] [UNSAFE] Uses 'getcallingscript' to get calling script for Decompile and GetScript. Much more reliable, but opens up Lunar Spy to detection and/or instability.",
  2545. useGetCallingScript and "ENABLED" or "DISABLED"
  2546. )
  2547. end, function()
  2548. useGetCallingScript = not useGetCallingScript
  2549. TextLabel.Text = string.format(
  2550. "[%s] [UNSAFE] Uses 'getcallingscript' to get calling script for Decompile and GetScript. Much more reliable, but opens up Lunar Spy to detection and/or instability.",
  2551. useGetCallingScript and "ENABLED" or "DISABLED"
  2552. )
  2553. end)
  2554.  
  2555. newButton("KeyToString", function()
  2556. return string.format(
  2557. "[%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.",
  2558. keyToString and "ENABLED" or "DISABLED"
  2559. )
  2560. end, function()
  2561. keyToString = not keyToString
  2562. TextLabel.Text = string.format(
  2563. "[%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.",
  2564. keyToString and "ENABLED" or "DISABLED"
  2565. )
  2566. end)
  2567.  
  2568. newButton("ToggleReturnValues", function()
  2569. return string.format(
  2570. "[%s] [EXPERIMENTAL] Enables recording of return values for 'GetReturnValue'\n\nUse this method at your own risk, as it could be detectable.",
  2571. recordReturnValues and "ENABLED" or "DISABLED"
  2572. )
  2573. end, function()
  2574. recordReturnValues = not recordReturnValues
  2575. TextLabel.Text = string.format(
  2576. "[%s] [EXPERIMENTAL] Enables recording of return values for 'GetReturnValue'\n\nUse this method at your own risk, as it could be detectable.",
  2577. recordReturnValues and "ENABLED" or "DISABLED"
  2578. )
  2579. end)
  2580.  
  2581. newButton("GetReturnValue", function()
  2582. return "[Experimental] If 'ReturnValues' is enabled, this will show the recorded return value for the RemoteFunction (if available)."
  2583. end, function()
  2584. if selected then
  2585. codebox:setRaw(SimpleSpy:ValueToVar(selected.ReturnValue, "returnValue"))
  2586. end
  2587. end)
Advertisement
Add Comment
Please, Sign In to add comment