Advertisement
BjeffeHund

Untitled

Feb 28th, 2020
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 92.59 KB | None | 0 0
  1. --[[
  2. _______ _______ _______ _______ _________ _______ _______ _ _______ _______
  3. ( ____ \( ____ )( ___ )( ____ \\__ __/|\ /|( ___ )( ___ )| \ /\ ( ____ \( ____ )|\ /|
  4. | ( \/| ( )|| ( ) || ( \/ ) ( | ) ( || ( ) || ( ) || \ / / | ( \/| ( )|( \ / )
  5. | (__ | (____)|| | | || (_____ | | | (___) || | | || | | || (_/ / | (_____ | (____)| \ (_) /
  6. | __) | __)| | | |(_____ ) | | | ___ || | | || | | || _ ( (_____ )| _____) \ /
  7. | ( | (\ ( | | | | ) | | | | ( ) || | | || | | || ( \ \ ) || ( ) (
  8. | ) | ) \ \__| (___) |/\____) | | | | ) ( || (___) || (___) || / \ \ /\____) || ) | |
  9. |/ |/ \__/(_______)\_______) )_( |/ \|(_______)(_______)|_/ \/ \_______)|/ \_/
  10.  
  11. ~ Nootchtai; 12/13/2019;
  12.  
  13. ~ KNOWN BUGS ~
  14. * Dropdown showing up even when not hovered on a target frame.
  15. * PROTMOSASHER: Can't track Http (they're protected)
  16. ~ FIXED ~
  17. * Fixed dropdown menu not working sometimes.
  18.  
  19. Possbile future features:
  20. Upvalue scanning
  21. Viewing all hooks in real time in an output style window
  22. Not yet implemented:
  23. /shrug
  24. --[==[Mandatory Functions for operation]==]--
  25. * hookfunction
  26. * newcclosure
  27. * getreg
  28. * setclipboard
  29. * setreadonly
  30. * checkcaller
  31. * debug library (period)
  32. ]]--
  33.  
  34. local FrostHook = {
  35. Tooltips = true, -- Tooltips for understanding what certain buttons do.
  36. Monitoring = { -- What remotes/bindables to monitor.
  37. ["RemoteEvent"]=true, -- :FireServer(arguments)
  38. ["RemoteFunction"]=true, -- :InvokeServer(arguments)
  39. ["BindableEvent"]=true, -- :Fire(arguments)
  40. ["BindableFunction"]=true, -- :Invoke(arguments)
  41. ["__namecall"]=true, -- FireServer(remote, arguments)
  42. -- maybe hook __index?? /shrug
  43. ["HttpGet"]=true, -- game:HttpGet(...)
  44. ["HttpPost"]=true, -- game:HttpPost(...)
  45. ["GetObjects"]=true, -- game:GetObjects(...)
  46. },
  47. Ignored_Remotes = { -- Ignore remotes by name
  48. -- ROBLOCK CHAT STUFFS
  49. ["GetInitDataRequest"]=true,
  50. ["MutePlayerRequest"]=true,
  51. ["UnMutePlayerRequest"]=true,
  52. ["ChannelNameColorUpdated"]=true,
  53. ["OnChannelJoined"]=true,
  54. ["OnChannelLeft"]=true,
  55. ["OnMainChannelSet"]=true,
  56. ["OnMessageDoneFiltering"]=true,
  57. ["OnMuted"]=true,
  58. ["OnNewMessage"]=true,
  59. ["OnNewSystemMessage"]=true,
  60. ["MessagesChanged"]=true,
  61. ["MessagePosted"]=true,
  62. ["ChatBarFocusChanged"]=true,
  63. ["OnUnmuted"]=true,
  64. ["SayMessageRequest"]=true,
  65. ["SetBlockedUserIdsRequest"]=true,
  66. -- /shrug
  67. ["Event"]=true, -- nani wonder where this is comin from
  68. },
  69. Data_Type_Colors = { -- The colors of the data types in the call viewer (unknown will be white)
  70. ["string"] = Color3.fromRGB(85, 170, 127),
  71. ["table"] = Color3.fromRGB(60, 60, 60),
  72. ["boolean"] = Color3.fromRGB(85, 170, 255),
  73. },
  74. EditorColors = { -- The color types for the Code editor
  75. ["Word"] = Color3.fromRGB(58, 117, 175),
  76. ["Nil"] = Color3.fromRGB(115, 115, 172),
  77. ["Table"] = Color3.fromRGB(181, 120, 90),
  78. ["Scope"] = Color3.fromRGB(194, 64, 97),
  79. ["Comment"] = Color3.fromRGB(50, 50, 50),
  80. ["String"] = Color3.fromRGB(85, 170, 127),
  81. },
  82. RemoteColors = { -- The colors for the remotes in the Cache + List views.
  83. ["RemoteEvent"] = Color3.fromRGB(85, 170, 255),
  84. ["RemoteFunction"] = Color3.fromRGB(85, 170, 255),
  85. ["BindableEvent"] = Color3.fromRGB(85, 170, 255),
  86. ["BindableFunction"] = Color3.fromRGB(85, 170, 255),
  87. },
  88. HttpColors = {
  89. ["HttpGet"] = Color3.fromRGB(85, 170, 255),
  90. ["HttpPost"] = Color3.fromRGB(85, 170, 255),
  91. ["GetObjects"] = Color3.fromRGB(85, 170, 255),
  92. },
  93. Constraints = { -- Interface Constraints for resizing.
  94. Min = UDim2.new(0,400,0,250),
  95. Max = UDim2.new(0,800,0,500)
  96. },
  97. env = { -- Inherited from Hydroxide.
  98. get_upvalues = debug.getupvalues or getupvalues or getupvals or false, --
  99. get_upvalue = debug.getupvalue or getupvalue or getupval or false, --
  100. get_metatable = getrawmetatable or debug.getmetatable or false, --
  101. get_namecall = getnamecallmethod or get_namecall_method or false, --
  102. get_reg = getreg or debug.getregistry or false, --
  103. set_readonly = setreadonly or ((make_writeable and make_readonly) and function(t,b) if b then return make_readonly(t) else return make_writeable(t) end end) or false, --
  104. is_l_closure = islclosure or is_l_closure or (iscclosure and function(closure) return not iscclosure(closure) end) or false, --
  105. is_x_closure = is_synapse_function or is_protosmasher_closure or issentinelclosure or false, --
  106. hook_function = hookfunction or hookfunc or detour_function or false, --
  107. new_cclosure = newcclosure or function(t) return t end or false, -- why proto why
  108. to_clipboard = (syn and syn.write_clipboard) or writeclipboard or toclipboard or setclipboard or false, --
  109. check_caller = checkcaller or is_protosmasher_caller or false, --
  110. },
  111. Services = setmetatable({},{__index = function(self, index)
  112. return game:GetService(index) or nil;
  113. end}),
  114.  
  115. -- Internals --
  116. Search_Directories = {
  117. game:GetService("ReplicatedStorage"),
  118. game:GetService("Players").LocalPlayer,
  119. game:GetService("Players").LocalPlayer.Character,
  120. },
  121. Cache = {
  122. _entry = nil,
  123. },
  124. HttpCache = {
  125. _entry = nil,
  126. },
  127. Hook_Cache = {},
  128. FireCounts = {
  129. ["RemoteEvent"] = 0,
  130. ["RemoteFunction"] = 0,
  131. ["BindableEvent"] = 0,
  132. ["BindableFunction"] = 0,
  133. ["HttpGet"] = 0,
  134. ["HttpPost"] = 0,
  135. ["GetObjects"] = 0,
  136. _updated = false,
  137. _latest = false,
  138. },
  139. RemoteFuncRef = {
  140. ["RemoteFunction"] = "InvokeServer",
  141. ["RemoteEvent"] = "FireServer",
  142. ["BindableFunction"] = "Invoke",
  143. ["BindableEvent"] = "Fire",
  144. },
  145. HttpFuncRef = {
  146. ["GetObjects"] = game.GetObjects,
  147. ["HttpGet"] = game.HttpGet,
  148. ["HttpPost"] = game.HttpPost,
  149. },
  150. Internal_Ignored = {},
  151. Interface = game:GetObjects("rbxassetid://4507087024")[1],
  152. Connections = {},
  153. CustomDrag = {
  154. DragActive = {},
  155. ResizeActive = {},
  156. },
  157. ScriptGeneration = {
  158. AppendBeginning = "\n", -- These two will be for appending comments to the beggining/end of the generated script.
  159. AppendEnding = "\n",
  160. },
  161. TextEditor = {
  162. Interface = script.Parent,
  163. TabSize = 8,
  164. Font = "SourceSansSemibold",
  165. FontSize = 14,
  166. Cache = {},
  167. LineCache = {_len=0},
  168. Imported = false,
  169. },
  170. }
  171.  
  172. FrostHook.Keywords = { -- Keyword string matching for code editor.
  173. ["and"] = {FrostHook.EditorColors.Word, "[%s-]", "[%s-]"},
  174. ["break"] = {FrostHook.EditorColors.Word, "[%s?%p?]","[%s?%p?]"},
  175. ["do"] = {FrostHook.EditorColors.Word, "%s*", "[%s]"},
  176. ["if"] = {FrostHook.EditorColors.Word, "%s*", "[%s]"},
  177. ["else"] = {FrostHook.EditorColors.Word, "[%s]", "[%s]"},
  178. ["elseif"] = {FrostHook.EditorColors.Word, "[%s]", "[%s]"},
  179. ["then"] = {FrostHook.EditorColors.Word, "[%s]", "[%s]"},
  180. ["end"] = {FrostHook.EditorColors.Word, "%s*%p*", "[%s-%p-]"},
  181. ["true"] = {FrostHook.EditorColors.Nil, "%s*", "[%s-%p-]"},
  182. ["false"] = {FrostHook.EditorColors.Nil, "%s*", "[%s-%p-]"},
  183. ["for"] = {FrostHook.EditorColors.Word, "%s*", "%s"},
  184. ["function"] = {FrostHook.EditorColors.Word, "%s?%p?", "[%s?%p?]"},
  185. ["in"] = {FrostHook.EditorColors.Word, ".", "[%s]"},
  186. ["local"] = {FrostHook.EditorColors.Scope, "%s?", "[%s]"},
  187. ["nil"] = {FrostHook.EditorColors.Nil, "%s?", "[%s?%p?]"},
  188. ["not"] = {FrostHook.EditorColors.Word, "[%s?%p?]", "[%s?%p?]"},
  189. ["or"] = {FrostHook.EditorColors.Word, "[%s]", "[%s]"},
  190. ["repeat"] = {FrostHook.EditorColors.Word, "%s*%p*", "[%s]"},
  191. ["return"] = {FrostHook.EditorColors.Word, "[%s]", "[%s?%p?]"},
  192. ["until"] = {FrostHook.EditorColors.Word, "[%s]", "[%s]"},
  193. ["while"] = {FrostHook.EditorColors.Word, "[%s]*", "[%s]*"},
  194.  
  195. ["self"] = {FrostHook.EditorColors.Nil, "", ""},
  196. ["game"] = {FrostHook.EditorColors.Word, "", ""},
  197. ["script"] = {FrostHook.EditorColors.Word, "", ""},
  198.  
  199. ["table"] = {FrostHook.EditorColors.Table, "[.]*", "%."},
  200. ["math"] = {FrostHook.EditorColors.Table, "[.]*", "%."},
  201. ["string"] = {FrostHook.EditorColors.Table, "[.]*", "%."},
  202.  
  203. ["print"] = {FrostHook.EditorColors.Word, "[.]*", "[%p]"},
  204. ["loadstring"] = {FrostHook.EditorColors.Word, "[.]*", "[%p]"},
  205. ["tostring"] = {FrostHook.EditorColors.Word, "[.]*", "[%p]"},
  206. ["dofile"] = {FrostHook.EditorColors.Word, "[.]*", "[%p]"},
  207. ["require"] = {FrostHook.EditorColors.Word, "[.]*", "[%p]"},
  208. ["tonumber"] = {FrostHook.EditorColors.Word, "[.]*", "[%p]"},
  209. ["writefile"] = {FrostHook.EditorColors.Word, "[.]*", "[%p]"},
  210. ["readfile"] = {FrostHook.EditorColors.Word, "[.]*", "[%p]"},
  211. }
  212.  
  213. for i,v in next, FrostHook.env do
  214. assert(v, "Your exploit does not support FrostHook's Spy Tool :(")
  215. end
  216.  
  217. repeat
  218. wait()
  219. until game:IsLoaded();
  220.  
  221. local Mouse = FrostHook.Services.Players.LocalPlayer:GetMouse();
  222.  
  223. do -- FrostHook Main Object
  224. local metadata = {};
  225. local methods = {
  226. Destroy = function(self)
  227. getgenv().FrostHookSpy = nil;
  228. self.Interface:Destroy();
  229. for _,Connection in pairs(self.Connections) do
  230. Connection:Disconnect();
  231. end
  232. self:StopTracking();
  233. FrostHook = nil;
  234. end,
  235. RegisterConnection = function(self, event, runtime_func)
  236. local connection;
  237. connection = event:Connect(function(...)
  238. local arguments = {...}
  239. local status,error_msg = pcall(function()
  240. return runtime_func(unpack(arguments))
  241. end);
  242. if not status then
  243. warn("Connection fault: "..tostring(error_msg))
  244. for i,v in pairs(FrostHook.Connections) do
  245. if v == connection then
  246. table.remove(FrostHook.Connections, i)
  247. v:Disconnect();
  248. end
  249. end
  250. end
  251. end)
  252. table.insert(self.Connections, connection);
  253. return connection;
  254. end,
  255. RequestCache = function(self, reqtype, varargs)
  256. if self.HttpCache[reqtype] then
  257. table.insert(self.HttpCache[reqtype].Logs, varargs)
  258. self.FireCounts[reqtype] = self.FireCounts[reqtype] - self.HttpCache[reqtype].FireCount;
  259. self.HttpCache[reqtype].FireCount = #self.HttpCache[reqtype].Logs;
  260. self.FireCounts[reqtype] = self.FireCounts[reqtype] + self.HttpCache[reqtype].FireCount;
  261. self.FireCounts["_latest"]:Fire(reqtype); -- hmmm idk about this
  262. self.HttpCache[reqtype].Updated:Fire("Add", varargs);
  263. self.FireCounts._updated:Fire(true);
  264. elseif not self.HttpCache[reqtype] then
  265. local updated = Instance.new("BindableEvent")
  266. updated.Name = "Updated";
  267. self.Internal_Ignored[updated] = true;
  268.  
  269. self.HttpCache[reqtype] = {
  270. Logs = {
  271. varargs,
  272. },
  273. Spying = true,
  274. FireCount = 1,
  275. Updated = updated;
  276. }
  277.  
  278. self.FireCounts[reqtype] = self.FireCounts[reqtype] + 1;
  279. self.FireCounts._updated:Fire(true);
  280. end
  281. end,
  282. ClearRequestCache = function(self, reqtype)
  283. if self.HttpCache[reqtype] then
  284. self.HttpCache[reqtype].Logs = {};
  285. self.FireCounts[reqtype] = self.FireCounts[reqtype] - self.HttpCache[reqtype].FireCount;
  286. self.HttpCache[reqtype].FireCount = 0;
  287. self.HttpCache[reqtype].Updated:Fire("Clear");
  288. self.FireCounts._updated:Fire();
  289. end
  290. end,
  291. CacheData = function(self, remote, varargs, populate)
  292. if populate and not self.Cache[remote] then -- populate the cache with already known remotes/bindables
  293. local updated = Instance.new("BindableEvent")
  294. updated.Name = "Updated";
  295. self.Internal_Ignored[updated] = true;
  296.  
  297. self.Cache[remote] = {
  298. Logs = {},
  299. Spying = true,
  300. FireCount = 0,
  301. Updated = updated,
  302. }
  303. return;
  304. end
  305.  
  306. if self.Cache[remote] then
  307. local s,e = pcall(function()
  308. table.insert(self.Cache[remote].Logs, varargs)
  309. self.FireCounts[remote.ClassName] = self.FireCounts[remote.ClassName] - self.Cache[remote].FireCount; -- take away old firecount
  310. self.Cache[remote].FireCount = #self.Cache[remote].Logs;
  311. self.FireCounts[remote.ClassName] = self.FireCounts[remote.ClassName] + self.Cache[remote].FireCount; -- add new firecount
  312. self.FireCounts["_latest"]:Fire(remote); -- The latest updated remote
  313.  
  314. self.Cache[remote].Updated:Fire("Add", varargs);
  315. self.FireCounts._updated:Fire(true);
  316. end)
  317. if not s then
  318. warn("FH Cache error: ", e);
  319. end
  320. else -- First time set-up for the unexpected data.
  321. self.FireCounts[remote.ClassName] = self.FireCounts[remote.ClassName] + 1;
  322.  
  323. local updated = Instance.new("BindableEvent")
  324. updated.Name = "Updated";
  325. self.Internal_Ignored[updated] = true;
  326.  
  327. self.Cache[remote] = {
  328. Logs = {
  329. varargs,
  330. },
  331. Spying = true,
  332. FireCount = 1,
  333. Updated = updated,
  334. }
  335. end
  336. end,
  337. ClearCacheData = function(self, remote)
  338. if self.Cache[remote] then
  339. self.Cache[remote].Logs = {}; -- clear cache
  340. self.FireCounts[remote.ClassName] = self.FireCounts[remote.ClassName] - self.Cache[remote].FireCount;
  341. self.Cache[remote].FireCount = 0;
  342. self.Cache[remote].Updated:Fire("Clear");
  343. self.FireCounts._updated:Fire();
  344. end
  345. end,
  346. IsRemote = function(self, obj)
  347. return obj.ClassName == "RemoteEvent" or obj.ClassName == "RemoteFunction" or obj.ClassName == "BindableEvent" or obj.ClassName == "BindableFunction"
  348. end,
  349. TrackHttp = function(self)
  350. for name,func in pairs(self.HttpFuncRef) do
  351. if self.Monitoring[name] then
  352. pcall(function()
  353. local temp_hook;
  354. temp_hook = self.env.hook_function(func, self.env.new_cclosure(function(req, ...)
  355. local varargs = {...}
  356. if self.HttpCache[name] and self.HttpCache[name].Spying then
  357. self:RequestCache(name, varargs);
  358. elseif not self.HttpCache[name] then
  359. self:RequestCache(name, varargs);
  360. end
  361. return temp_hook(name, ...)
  362. end))
  363. self.Hook_Cache[name] = temp_hook;
  364. end);
  365. end
  366. end
  367. end,
  368. TrackRemotes = function(self)
  369. local to_hook = {
  370. ["RemoteEvent"] = Instance.new("RemoteEvent").FireServer,
  371. ["RemoteFunction"] = Instance.new("RemoteFunction").InvokeServer,
  372. ["BindableEvent"] = Instance.new("BindableEvent").Fire,
  373. ["BindableFunction"] = Instance.new("BindableFunction").Invoke,
  374. }
  375.  
  376. for class,func in pairs(to_hook) do
  377. if self.Monitoring[class] then
  378. local temp_hook;
  379. temp_hook = self.env.hook_function(func, self.env.new_cclosure(function(remote, ...)
  380. local varargs = {...};
  381. if self.env.check_caller() or (self.Internal_Ignored[remote]) then
  382. return temp_hook(remote, ...);
  383. end
  384.  
  385. if not(self.Ignored_Remotes[remote.Name]) then
  386. if self.Cache[remote] and self.Cache[remote].Spying then
  387. self:CacheData(remote, varargs)
  388. elseif not self.Cache[remote] then
  389. self:CacheData(remote, varargs)
  390. end
  391. end
  392. return temp_hook(remote, ...);
  393. end))
  394. self.Hook_Cache[class] = temp_hook;
  395. end
  396. end
  397.  
  398. if self.Monitoring["__namecall"] then
  399. local gmeta = getrawmetatable(game);
  400. self.Hook_Cache["namecall"] = gmeta.__namecall;
  401. self.env.set_readonly(gmeta, false);
  402.  
  403. local namecall = Instance.new("BindableFunction")
  404. self.Internal_Ignored[namecall] = true;
  405. namecall.OnInvoke = self.env.new_cclosure(function(remote, varargs)
  406. if not(self.Ignored_Remotes[remote.Name]) then
  407. if self.Cache[remote] and self.Cache[remote].Spying then
  408. self:CacheData(remote, varargs)
  409. elseif not self.Cache[remote] then
  410. self:CacheData(remote, varargs)
  411. end
  412. end
  413. end);
  414.  
  415. gmeta.__namecall = self.env.new_cclosure(function(remote, ...)
  416. local varargs = {...};
  417.  
  418. if self:IsRemote(remote) then
  419. if self.env.check_caller() or (self.Internal_Ignored[remote]) then
  420. return self.Hook_Cache["namecall"](remote, ...);
  421. end
  422. namecall.Invoke(namecall, remote, varargs);
  423. end
  424.  
  425. return self.Hook_Cache["namecall"](remote, ...);
  426. end)
  427.  
  428. self.env.set_readonly(gmeta, true);
  429. end
  430. end,
  431. StopTracking = function(self) -- This will also stop tracking http calls in future
  432. local to_fix = {
  433. ["RemoteEvent"] = Instance.new("RemoteEvent").FireServer,
  434. ["RemoteFunction"] = Instance.new("RemoteFunction").InvokeServer,
  435. ["BindableEvent"] = Instance.new("BindableEvent").Fire,
  436. ["BindableFunction"] = Instance.new("BindableFunction").Invoke,
  437. }
  438.  
  439. for class,func in pairs(to_fix) do
  440. for ref,hook in pairs(self.Hook_Cache) do
  441. if class == ref then
  442. self.env.hook_function(func, hook);
  443. end
  444. end
  445. end
  446.  
  447. for name,func in pairs(self.HttpFuncRef) do
  448. for ref,hook in pairs(self.Hook_Cache) do
  449. if name == ref then
  450. self.env.hook_function(func, hook);
  451. end
  452. end
  453. end
  454.  
  455. if self.Monitoring["__namecall"] and self.Hook_Cache["namecall"] then
  456. local gmeta = getrawmetatable(game);
  457. self.env.set_readonly(gmeta, false)
  458. gmeta.__namecall = self.Hook_Cache["namecall"];
  459. self.env.set_readonly(gmeta, true);
  460. end
  461. end,
  462. SetTooltip = function(self, this_object, description)
  463. if not(self.Tooltips) then
  464. return;
  465. end
  466.  
  467. local tooltip = self.Interface.Templates.Tooltip;
  468.  
  469. local textSize = game:GetService("TextService"):GetTextSize(description, 14, "SourceSansBold", Vector2.new(math.huge,20))
  470.  
  471. this_object.MouseEnter:Connect(function()
  472. tooltip.Text = description;
  473. tooltip.Size = UDim2.new(0,textSize.X + 5,0,20)
  474. tooltip.Visible = true;
  475. end)
  476.  
  477. this_object.MouseLeave:Connect(function()
  478. tooltip.Text = "";
  479. tooltip.Visible = false;
  480. end)
  481.  
  482. this_object.AncestryChanged:Connect(function()
  483. tooltip.Text = "";
  484. tooltip.Visible = false;
  485. end)
  486. end,
  487. DatatypeFormat = function(self, data)
  488. local datatype = typeof(data);
  489. local cleaned_string = tostring(data);
  490. local datacol = Color3.new(1,1,1)
  491. local potential_col = self.Data_Type_Colors[datatype]
  492.  
  493. if potential_col ~= nil then
  494. datacol = potential_col;
  495. end;
  496.  
  497. if datatype == "string" then
  498. cleaned_string = '"'..tostring(data)..'"';
  499. elseif datatype == "Vector3" then
  500. cleaned_string = "Vector3.new("..table.concat({data.X,data.Y,data.Z}, ", ")..")"
  501. elseif datatype == "UDim2" then
  502. cleaned_string = "UDim2.new("..table.concat({data.X.Scale,data.X.Offset,data.Y.Scale,data.Y.Offset}, ", ")..")"
  503. elseif datatype == "UDim" then
  504. cleaned_string = "UDim.new("..table.concat({data.Scale,data.Offset}, ", ")..")"
  505. elseif datatype == "CFrame" then
  506. cleaned_string = "CFrame.new("..table.concat({data.X,data.Y,data.Z}, ", ")..")" -- this is a piss poor way of handling cframes
  507. elseif datatype == "Vector2" then
  508. cleaned_string = "Vector2.new("..table.concat({data.X,data.Y}, ", ")..")"
  509. end
  510. return datacol, cleaned_string;
  511. end,
  512. };
  513.  
  514. metadata.__index = function(self, index)
  515. if methods[index] then
  516. return function(s, ...)
  517. return methods[index](self, ...);
  518. end
  519. end
  520. end
  521.  
  522. metadata.__call = function(self)
  523. assert(getgenv().FrostHookSpy==nil, "FrostHook RemoteSpy is already running!")
  524. getgenv().FrostHookSpy = true;
  525.  
  526. if self.Services.CoreGui:FindFirstChild("FH_SPY") then
  527. self.Services.CoreGui.FH_SPY:Destroy();
  528. end
  529.  
  530. if syn and syn.protectgui then
  531. syn.protectgui(self.Interface);
  532. end
  533.  
  534. self.Interface.Parent = self.Services.CoreGui;
  535.  
  536. do -- set up the entry added bindable
  537. local Entry = Instance.new("BindableEvent")
  538. Entry.Name = "Entry";
  539. self.Cache["_entry"] = Entry;
  540. self.Internal_Ignored[Entry] = true;
  541. local Latest = Instance.new("BindableEvent")
  542. Latest.Name = "Latest"
  543. self.FireCounts["_latest"] = Latest;
  544. self.Internal_Ignored[Latest] = true;
  545. local FCUpdated = Instance.new("BindableEvent")
  546. FCUpdated.Name = "FireCountUpdated";
  547. self.FireCounts._updated = FCUpdated;
  548. self.Internal_Ignored[FCUpdated] = true;
  549. end
  550.  
  551. do -- Handle Interface
  552. local Spy = self.Interface;
  553. local topbar = Spy.Topbar;
  554. local Main = topbar.Main;
  555. local drag = Main.drag
  556. local MainPanel = Main.MainPanel;
  557. local TabPanel = Main.TabPanel;
  558. local SearchBar = TabPanel.Space.Search;
  559. local ExecuteButton = TabPanel.Space.Execute;
  560. local CloseButton = Main.Topbar_shadow.TopbarButtons.Close;
  561. self:SetTooltip(CloseButton, "Close window")
  562. local DestroyButton = Main.Topbar_shadow.TopbarButtons:FindFirstChild("Destroy"); -- Yuck, .Destroy thinks it's the roblox method
  563. self:SetTooltip(DestroyButton, "Spy:Destroy()")
  564. local Templates = Spy.Templates;
  565. local tooltip = Templates.Tooltip;
  566. local ExampleCall = Templates.ExampleCall;
  567. local OpenButton = Spy.Open.button;
  568. local CurrentTab = "List";
  569. local ViewingType = "";
  570. local Panels,Categories,Tabs = {},{},{};
  571. local HoveringObject;
  572. local HoveringCallData = {
  573. object = nil,
  574. varargs = nil,
  575. };
  576. local AddRemoveOverride = false;
  577. local TabSize = 10;
  578.  
  579. local function CreateObjectTemplate(object, Remote)
  580. local ObjectFrame = object:Clone();
  581. ObjectFrame.Name = tostring(Remote);
  582. ObjectFrame.Label.Text = tostring(Remote);
  583.  
  584. local _textSize = game:GetService("TextService"):GetTextSize(tostring(Remote), 14, "SourceSansBold", Vector2.new(math.huge,20))
  585.  
  586. ObjectFrame.Label.Size = UDim2.new(0,_textSize.X + 5,1,0)
  587.  
  588. local _info = TweenInfo.new(0.2,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0)
  589. local _select = game:GetService("TweenService"):Create(ObjectFrame.Label, _info, {["TextStrokeTransparency"]=0.1})
  590. local _unselect = game:GetService("TweenService"):Create(ObjectFrame.Label, _info, {["TextStrokeTransparency"]=1})
  591.  
  592. ObjectFrame.MouseEnter:Connect(function()
  593. HoveringObject = Remote;
  594. _select:Play();
  595. end)
  596.  
  597. ObjectFrame.MouseLeave:Connect(function()
  598. if HoveringObject == Remote then
  599. HoveringObject = nil;
  600. end
  601. _unselect:Play();
  602. end)
  603.  
  604. ObjectFrame.Visible = true;
  605. return ObjectFrame;
  606. end
  607.  
  608. local function PopulateObject2(Remote, Data)
  609. local ObjectFrame = CreateObjectTemplate(Templates.Object_2, Remote)
  610. local switch = ObjectFrame.Switch_Toggle;
  611.  
  612. local thisRemoteColor = self.RemoteColors[Remote.ClassName];
  613. ObjectFrame.Emblem.ImageColor3 = thisRemoteColor
  614.  
  615. local function toggle_switch(bool)
  616. if not bool then
  617. switch.Visible_Switch.ImageColor3 = Color3.new(1,1,1);
  618. switch.Visible_Switch.Position = UDim2.new(0,7,0.5,0);
  619. return
  620. end
  621. switch.Visible_Switch.ImageColor3 = thisRemoteColor;
  622. switch.Visible_Switch.Position = UDim2.new(1,-21,0.5,0);
  623. end
  624.  
  625. toggle_switch(Data.Spying)
  626.  
  627. local cached;
  628. cached = Data.Updated.Event:Connect(function(Operation)
  629. if Operation == "SpyChange" then
  630. toggle_switch(Data.Spying)
  631. return;
  632. end
  633. end)
  634.  
  635. ObjectFrame.AncestryChanged:Connect(function()
  636. if ObjectFrame.Parent == nil then
  637. cached:Disconnect();
  638. end
  639. end)
  640.  
  641. switch.Interact.MouseButton1Down:Connect(function()
  642. Data.Spying = not Data.Spying;
  643. toggle_switch(Data.Spying)
  644. end)
  645.  
  646. ObjectFrame.Parent = Panels["List"];
  647. end
  648.  
  649. local function PopulateHttpObject2(Type, Data)
  650. local ObjectFrame = CreateObjectTemplate(Templates.Object_2, Type)
  651. local switch = ObjectFrame.Switch_Toggle;
  652.  
  653. local thisReqColor = self.HttpColors[Type];
  654. ObjectFrame.Emblem.ImageColor3 = thisReqColor
  655.  
  656. local function toggle_switch(bool)
  657. if not bool then
  658. switch.Visible_Switch.ImageColor3 = Color3.new(1,1,1);
  659. switch.Visible_Switch.Position = UDim2.new(0,7,0.5,0);
  660. return
  661. end
  662. switch.Visible_Switch.ImageColor3 = thisReqColor;
  663. switch.Visible_Switch.Position = UDim2.new(1,-21,0.5,0);
  664. end
  665.  
  666. toggle_switch(Data.Spying)
  667.  
  668. local cached;
  669. cached = Data.Updated.Event:Connect(function(Operation)
  670. if Operation == "SpyChange" then
  671. toggle_switch(Data.Spying)
  672. return;
  673. end
  674. end)
  675.  
  676. ObjectFrame.AncestryChanged:Connect(function()
  677. if ObjectFrame.Parent == nil then
  678. cached:Disconnect();
  679. end
  680. end)
  681.  
  682. switch.Interact.MouseButton1Down:Connect(function()
  683. Data.Spying = not Data.Spying;
  684. toggle_switch(Data.Spying)
  685. end)
  686.  
  687. ObjectFrame.Parent = Panels["List"];
  688. end
  689.  
  690. local function PopulateObject(Remote, Data)
  691. local ObjectFrame = CreateObjectTemplate(Templates.Object, Remote)
  692. local FireAmount = ObjectFrame.Label.amount;
  693. local Clear_Cache = ObjectFrame.Clear;
  694. local thisRemoteColor = self.RemoteColors[Remote.ClassName];
  695.  
  696. ObjectFrame.Emblem.ImageColor3 = thisRemoteColor
  697. Clear_Cache.BackgroundColor3 = thisRemoteColor;
  698. Clear_Cache.Font = "SourceSansBold"
  699. FireAmount.Text = tostring(Data.FireCount)
  700.  
  701. Clear_Cache.MouseButton1Down:Connect(function()
  702. self:ClearCacheData(Remote);
  703. ObjectFrame:Destroy();
  704. end)
  705.  
  706. Data.Updated.Event:Connect(function(Operation)
  707. if FireAmount and Operation ~= "SpyChange" then
  708. FireAmount.Text = Data.FireCount;
  709. end
  710. end)
  711.  
  712. ObjectFrame.Parent = Panels["View"];
  713. return FireAmount;
  714. end
  715.  
  716. local function PopulateHttpObject(Type, Data)
  717. local ObjectFrame = CreateObjectTemplate(Templates.Object, Type)
  718. local FireAmount = ObjectFrame.Label.amount;
  719. local Clear_Cache = ObjectFrame.Clear;
  720.  
  721. local thisReqColor = self.HttpColors[Type];
  722.  
  723. ObjectFrame.Emblem.ImageColor3 = thisReqColor;
  724. Clear_Cache.BackgroundColor3 = thisReqColor;
  725. Clear_Cache.Font = "SourceSansBold"
  726. FireAmount.Text = tostring(Data.FireCount)
  727.  
  728. Clear_Cache.MouseButton1Down:Connect(function()
  729. print(Type)
  730. self:ClearRequestCache(Type);
  731. ObjectFrame:Destroy();
  732. end)
  733.  
  734. Data.Updated.Event:Connect(function(Operation)
  735. if FireAmount and Operation ~= "SpyChange" then
  736. FireAmount.Text = Data.FireCount;
  737. end
  738. end)
  739.  
  740. ObjectFrame.Parent = Panels["View"];
  741. return FireAmount;
  742. end
  743.  
  744. local function PopulateObjects(Type)
  745. for _,OldObject in pairs(Panels["View"]:GetChildren()) do
  746. if OldObject:IsA("Frame") then
  747. OldObject:Destroy();
  748. end
  749. end
  750.  
  751. local NumObjects = 0;
  752. for Remote,Data in pairs(self.Cache) do
  753. if tostring(Remote) ~= "_entry" and Remote.ClassName == Type and Data.FireCount > 0 then
  754. PopulateObject(Remote, Data);
  755. NumObjects = NumObjects + 1;
  756. end
  757. end
  758.  
  759. Panels["View"].CanvasSize = UDim2.new(0,0,0,20*NumObjects)
  760. Panels["View"].CanvasPosition = Vector2.new();
  761. end
  762.  
  763. local function PopulateHttpObjects(Type)
  764. for _,OldObject in pairs(Panels["View"]:GetChildren()) do
  765. if OldObject:IsA("Frame") then
  766. OldObject:Destroy();
  767. end
  768. end
  769.  
  770. local NumObjects = 0;
  771. for Req,Data in pairs(self.HttpCache) do
  772. if Req ~= "_entry" and Req == Type and Data.FireCount > 0 then
  773. PopulateHttpObject(Req, Data);
  774. NumObjects = NumObjects + 1;
  775. end
  776. end
  777.  
  778. Panels["View"].CanvasSize = UDim2.new(0,0,0,20*NumObjects)
  779. Panels["View"].CanvasPosition = Vector2.new();
  780. end
  781.  
  782. local function PopulateListObjects(Type)
  783. for _,OldObject in pairs(Panels["List"]:GetChildren()) do
  784. if OldObject:IsA("Frame") then
  785. OldObject:Destroy();
  786. end
  787. end
  788.  
  789. local NumObjects = 0;
  790. for Remote,Data in pairs(self.Cache) do
  791. if tostring(Remote) ~= "_entry" and Remote.ClassName == Type then
  792. PopulateObject2(Remote, Data);
  793. NumObjects = NumObjects + 1;
  794. end
  795. end
  796.  
  797. Panels["List"].CanvasSize = UDim2.new(0,0,0,20*NumObjects)
  798. Panels["List"].CanvasPosition = Vector2.new();
  799. end
  800.  
  801. local function PopulateHttpListObjects(Type)
  802. for _,OldObject in pairs(Panels["List"]:GetChildren()) do
  803. if OldObject:IsA("Frame") then
  804. OldObject:Destroy();
  805. end
  806. end
  807.  
  808. local NumObjects = 0;
  809. for Req,Data in pairs(self.HttpCache) do
  810. if Req ~= "_entry" and Req == Type then
  811. PopulateHttpObject2(Req, Data);
  812. NumObjects = NumObjects + 1;
  813. end
  814. end
  815. end
  816.  
  817. local function CallDropdown(remote, string_func, varargs)
  818. if Spy:FindFirstChild("CallDropdown") then
  819. Spy.CallDropdown:Destroy();
  820. end
  821. local this_dropdown = Templates.CallDropdown:Clone();
  822. this_dropdown.Position = UDim2.new(0,Mouse.X - 5,0,Mouse.Y - 5)
  823.  
  824. this_dropdown.MouseLeave:Connect(function()
  825. if HoveringCallData.object == remote or HoveringCallData.varargs == varargs then
  826. HoveringCallData.object = nil;
  827. HoveringCallData.varargs = nil;
  828. end
  829. this_dropdown:Destroy();
  830. end)
  831.  
  832. local Call = this_dropdown.CallAgain;
  833. local GenerateScript = this_dropdown.GenScript;
  834.  
  835. Call.MouseButton1Down:Connect(function()
  836. local func = remote[self.RemoteFuncRef[remote.ClassName]];
  837. if func then
  838. pcall(function()
  839. func(remote, unpack(varargs));
  840. end);
  841. end
  842. end)
  843.  
  844. GenerateScript.MouseButton1Down:Connect(function()
  845. local Code = FrostHook.ScriptGeneration.AppendBeginning;
  846. local Variables,Cache = {},{table=0,number=0,userdata=0,string=0,boolean=0};
  847.  
  848. for i,v in pairs(varargs) do
  849. local var, new_Cache = FrostHook.ScriptGeneration:var_name(Cache, v);
  850. local RefValue = FrostHook.ScriptGeneration:transform_value(v)
  851. Cache = new_Cache;
  852.  
  853. table.insert(Variables, {
  854. Variable = var,
  855. Value = RefValue,
  856. })
  857. end
  858.  
  859. table.insert(Variables, {
  860. Variable = "Target",
  861. Value = FrostHook.ScriptGeneration:transform_value(remote);
  862. })
  863.  
  864. for _,data in next, Variables do
  865. Code = Code.."local "..data.Variable.." = "..data.Value..";\n";
  866. end
  867.  
  868. Code = Code.."Target:"..string_func.."("
  869.  
  870. local ArrayVars = {};
  871.  
  872. for _,data in pairs(Variables) do
  873. if data.Variable ~= "Target" then
  874. table.insert(ArrayVars, data.Variable)
  875. end
  876. end
  877.  
  878. Code = Code..table.concat(ArrayVars, ", ")
  879. Code = Code..");";
  880. Code = Code..FrostHook.ScriptGeneration.AppendEnding;
  881. FrostHook.TextEditor:SetCode(Code);
  882. end)
  883.  
  884. this_dropdown.Visible = true;
  885. this_dropdown.Parent = Spy;
  886. end
  887.  
  888. local function HTTPCallDropdown(reqtype, varargs)
  889. if Spy:FindFirstChild("CallDropdown") then
  890. Spy.CallDropdown:Destroy();
  891. end
  892. local this_dropdown = Templates.CallDropdown:Clone();
  893. this_dropdown.Position = UDim2.new(0,Mouse.X - 5,0,Mouse.Y - 5)
  894.  
  895. this_dropdown.MouseLeave:Connect(function()
  896. if HoveringCallData.object == remote or HoveringCallData.varargs == varargs then
  897. HoveringCallData.object = nil;
  898. HoveringCallData.varargs = nil;
  899. end
  900. this_dropdown:Destroy();
  901. end)
  902.  
  903. local Call = this_dropdown.CallAgain;
  904. local GenerateScript = this_dropdown.GenScript;
  905.  
  906. Call.MouseButton1Down:Connect(function()
  907. local func = game[reqtype];
  908. if func then
  909. pcall(function()
  910. func(remote, unpack(varargs));
  911. end);
  912. end
  913. end)
  914.  
  915. GenerateScript.MouseButton1Down:Connect(function()
  916. local Code = FrostHook.ScriptGeneration.AppendBeginning;
  917. local Variables,Cache = {},{table=0,number=0,userdata=0,string=0,boolean=0};
  918.  
  919. for i,v in pairs(varargs) do
  920. local var, new_Cache = FrostHook.ScriptGeneration:var_name(Cache, v);
  921. local RefValue = FrostHook.ScriptGeneration:transform_value(v)
  922. Cache = new_Cache;
  923.  
  924. table.insert(Variables, {
  925. Variable = var,
  926. Value = RefValue,
  927. })
  928. end
  929.  
  930. for _,data in next, Variables do
  931. Code = Code.."local "..data.Variable.." = "..data.Value..";\n";
  932. end
  933.  
  934. Code = Code.."game:"..reqtype.."("
  935.  
  936. local ArrayVars = {};
  937.  
  938. for _,data in pairs(Variables) do
  939. if data.Variable ~= "Target" then
  940. table.insert(ArrayVars, data.Variable)
  941. end
  942. end
  943.  
  944. Code = Code..table.concat(ArrayVars, ", ")
  945. Code = Code..");";
  946. Code = Code..FrostHook.ScriptGeneration.AppendEnding;
  947. FrostHook.TextEditor:SetCode(Code);
  948. end);
  949.  
  950. this_dropdown.Visible = true;
  951. this_dropdown.Parent = Spy;
  952. end
  953.  
  954. local function ViewCalls(Object)
  955. local ReadingNewCalls = true;
  956. local Data = self.HttpCache[Object] or self.Cache[Object];
  957.  
  958. if not(Data) then
  959. print("Denied")
  960. return;
  961. end
  962.  
  963. local this_callview = Templates.CallView:Clone();
  964. local main = this_callview.Main;
  965. local buttons = main.Topbar_shadow.TopbarButtons
  966. local CallFrame = main.Calls;
  967.  
  968. local Hook_FuncRef = self.RemoteFuncRef;
  969.  
  970. local _info = TweenInfo.new(0.2,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0)
  971.  
  972. local function PreviewCall(array)
  973. local this_Call = ExampleCall:Clone();
  974.  
  975. if #array <= 0 then
  976. this_Call.Expand.Visible = false;
  977. end
  978.  
  979. local ArgDataTypes = {}
  980. local StateImages = {
  981. [true] = "rbxassetid://4317834259",
  982. [false] = "rbxassetid://4317835953"
  983. }
  984. local Expanded = false;
  985. local _select = game:GetService("TweenService"):Create(this_Call, _info, {["BackgroundColor3"]=Color3.new(0.5,0.5,0.5)})
  986. local _unselect = game:GetService("TweenService"):Create(this_Call, _info, {["BackgroundColor3"]=Color3.new(0,0,0)})
  987.  
  988. for i,v in pairs(array) do
  989. if tostring(typeof(v)) == "nil" then
  990. array[i] = "nil";
  991. end
  992. end
  993.  
  994. for i=1,#array do
  995. local arg = array[i];
  996. table.insert(ArgDataTypes, typeof(arg))
  997. local add_Data = this_Call.Templates["AdditionalData"]:Clone();
  998. local data_color,formatted_data = self:DatatypeFormat(arg)
  999. add_Data.Data.Text = formatted_data;
  1000. add_Data.ImageLabel.ImageColor3 = data_color;
  1001. add_Data.Visible = true;
  1002. add_Data.Parent = this_Call.Additional;
  1003. end
  1004.  
  1005. this_Call.CallType.Text = tostring((type(Object)=="string" and Object or Hook_FuncRef[Object.ClassName]) ).."("..table.concat(ArgDataTypes, ", ")..")";
  1006.  
  1007. this_Call.MouseEnter:Connect(function()
  1008. HoveringCallData.object = Object;
  1009. HoveringCallData.varargs = array;
  1010. _select:Play();
  1011. end)
  1012.  
  1013. this_Call.MouseLeave:Connect(function()
  1014. _unselect:Play();
  1015. end)
  1016.  
  1017. this_Call.Expand.MouseButton1Down:Connect(function()
  1018. Expanded = not Expanded;
  1019. this_Call.Expand.Image = StateImages[Expanded];
  1020. if Expanded then
  1021. this_Call:TweenSize(UDim2.new(1,0,0,20 + 22*#array), "Out", "Quad", 0.2, true, function()
  1022. CallFrame.CanvasSize = UDim2.new(0,0,0,CallFrame.CanvasSize.Y.Offset+(#array*22));
  1023. end);
  1024. else
  1025. this_Call:TweenSize(UDim2.new(1,0,0,20), "Out", "Quad", 0.2, true, function()
  1026. CallFrame.CanvasSize = UDim2.new(0,0,0,CallFrame.CanvasSize.Y.Offset-(#array*22));
  1027. end);
  1028. end
  1029. end)
  1030.  
  1031. this_Call.Visible = true;
  1032. CallFrame.CanvasSize = UDim2.new(0,0,0,CallFrame.CanvasSize.Y.Offset+20);
  1033. this_Call.Parent = CallFrame;
  1034. end
  1035.  
  1036. for i=1,#Data.Logs do
  1037. PreviewCall(Data.Logs[i]);
  1038. end
  1039.  
  1040. self.CustomDrag:SetDragging(true, this_callview, main);
  1041.  
  1042. buttons.Close.MouseButton1Down:Connect(function()
  1043. self.CustomDrag:SetDragging(false, this_callview, main);
  1044. this_callview:Destroy();
  1045. end)
  1046.  
  1047. buttons.Export.MouseButton1Down:Connect(function()
  1048. self.env.to_clipboard(self.ScriptGeneration:dump_table(Data.Logs))
  1049. end)
  1050.  
  1051. if Data.Spying then
  1052. buttons.Play.Visible = false;
  1053. buttons.Stop.Visible = true;
  1054. else
  1055. buttons.Play.Visible = true;
  1056. buttons.Play.Visible = false;
  1057. end
  1058.  
  1059. buttons.Play.MouseButton1Down:Connect(function()
  1060. Data.Spying = true;
  1061. Data.Updated:Fire("SpyChange")
  1062. buttons.Stop.Visible = true;
  1063. buttons.Play.Visible = false;
  1064. end)
  1065.  
  1066. buttons.Stop.MouseButton1Down:Connect(function()
  1067. Data.Spying = false;
  1068. Data.Updated:Fire("SpyChange")
  1069. buttons.Stop.Visible = false;
  1070. buttons.Play.Visible = true;
  1071. end)
  1072.  
  1073. CallFrame.MouseLeave:Connect(function()
  1074. HoveringCallData.object = nil;
  1075. HoveringCallData.varargs = nil;
  1076. end)
  1077.  
  1078. Data.Updated.Event:Connect(function(Operation, varargs)
  1079. if Operation == "Add" then
  1080. PreviewCall(varargs);
  1081. elseif Operation == "Clear" then
  1082. for _,Object in pairs(CallFrame:GetChildren()) do
  1083. if Object.ClassName == "Frame" or Object.ClassName == "ScrollingFrame" then
  1084. Object:Destroy();
  1085. end
  1086. end
  1087. CallFrame.CanvasSize = UDim2.new(0,0,0,0);
  1088. end
  1089. end)
  1090.  
  1091. self:SetTooltip(buttons.Stop, "Stop")
  1092. self:SetTooltip(buttons.Play, "Start")
  1093. self:SetTooltip(buttons.Export, "Export Calls")
  1094. self:SetTooltip(buttons.Close, "Close window")
  1095.  
  1096. main.Topbar_shadow.Viewing.Text = tostring(Object);
  1097. this_callview.Visible = true;
  1098. this_callview.Parent = Spy;
  1099. end
  1100.  
  1101. local function Dropdown(Object)
  1102. if Spy:FindFirstChild("Dropdown") then
  1103. Spy.Dropdown:Destroy();
  1104. end
  1105. local this_dropdown = Templates.Dropdown:Clone();
  1106. this_dropdown.Position = UDim2.new(0,Mouse.X - 5,0,Mouse.Y - 5)
  1107. this_dropdown.Visible = true;
  1108. this_dropdown.Parent = Spy;
  1109.  
  1110. this_dropdown.MouseLeave:Connect(function()
  1111. this_dropdown:Destroy();
  1112. end)
  1113.  
  1114. local CallView = this_dropdown.Calls;
  1115. local GetPath = this_dropdown.GetPath;
  1116.  
  1117. GetPath.MouseButton1Down:Connect(function()
  1118. if type(Object) == "string" then
  1119. FrostHook.env.to_clipboard("game:"..Object.."()")
  1120. else
  1121. FrostHook.env.to_clipboard(FrostHook.ScriptGeneration:transform_path(Object:GetFullName()))
  1122. end
  1123. end)
  1124.  
  1125. CallView.MouseButton1Down:Connect(function()
  1126. ViewCalls(Object);
  1127. end)
  1128. end
  1129.  
  1130. local function ViewTab(tab_name)
  1131. for _,Tab in pairs(Tabs) do
  1132. if Tab.Name == tab_name then
  1133. Tab.BackgroundTransparency = 1;
  1134. else
  1135. Tab.BackgroundTransparency = 0.8;
  1136. end
  1137. end
  1138.  
  1139. SearchBar.Visible = (tab_name=="List")and true or false;
  1140. ExecuteButton.Visible = (tab_name=="Code")and true or false;
  1141.  
  1142. for PanName,Panel in pairs(Panels) do
  1143. if PanName == tab_name then
  1144. Panel.Visible = true;
  1145. else
  1146. Panel.Visible = false;
  1147. end
  1148. end
  1149. end
  1150.  
  1151. local function fixCanvas_View()
  1152. if FrostHook and not AddRemoveOverride then
  1153. Panels["View"].CanvasSize = UDim2.new(0,0,0,20*#(Panels["View"]:GetChildren())-1)
  1154. Panels["List"].CanvasSize = UDim2.new(0,0,0,20*#(Panels["List"]:GetChildren())-1)
  1155. end
  1156. end
  1157.  
  1158. for _,Directory in pairs(self.Search_Directories) do -- Populates the Cache full of every remote/bindable in the game.
  1159. for _,Obj in pairs(Directory:GetDescendants()) do
  1160. local Class = Obj.ClassName;
  1161. if Class == "RemoteEvent" or Class == "RemoteFunction" or Class == "BindableEvent" or Class == "BindableFunction" then
  1162. self:CacheData(Obj,nil,true);
  1163. end
  1164. end
  1165. end
  1166.  
  1167. for _,Obj in pairs(TabPanel:GetChildren()) do -- Populates the Tabs
  1168. if Obj:IsA("TextButton") or Obj.Name == "Space" then
  1169. Tabs[Obj.Name] = Obj;
  1170. if Obj:IsA("TextButton") then
  1171. Obj.MouseButton1Down:Connect(function()
  1172. ViewTab(Obj.Name);
  1173. end)
  1174. end
  1175. end
  1176. end
  1177.  
  1178. for _,Obj in pairs(MainPanel:GetChildren()) do -- Populates the Panels
  1179. if Obj:IsA("ScrollingFrame") then
  1180. Panels[Obj.Name] = Obj;
  1181. end
  1182. end
  1183.  
  1184. for _,Obj in pairs(Main.SidePanel:GetChildren()) do -- Populates the Sub-Categories.
  1185. if Obj:IsA("Frame") then
  1186. Categories[Obj.Name] = {["Object"] = Obj, ["ResetAllAmounts"] = false, ["SubOptions"] = false, ["_init"] = false};
  1187. end
  1188. end
  1189.  
  1190. local ForceUnset = Instance.new("BindableEvent");
  1191. ForceUnset.Name = "Force-Unset"
  1192. self.Internal_Ignored[ForceUnset] = true;
  1193.  
  1194. for CatName,CatObj in pairs(Categories) do
  1195. local Content = CatObj.Object.Content;
  1196. local expand = Content.expand;
  1197. local CatFireAmount = Content.amount;
  1198. local State = false;
  1199. local StateImages = {
  1200. [true] = "rbxassetid://4317834259",
  1201. [false] = "rbxassetid://4317835953"
  1202. }
  1203.  
  1204. local SubOptions = {_len=0};
  1205.  
  1206. self.FireCounts._updated.Event:Connect(function()
  1207. if CatName == "Remotes" then
  1208. local EventAmount = self.FireCounts["RemoteEvent"];
  1209. local FunctionAmount = self.FireCounts["RemoteFunction"];
  1210. CatFireAmount.Text = tostring(EventAmount + FunctionAmount)
  1211. elseif CatName == "Bindables" then
  1212. local EventAmount = self.FireCounts["BindableEvent"];
  1213. local FunctionAmount = self.FireCounts["BindableFunction"];
  1214. CatFireAmount.Text = tostring(EventAmount + FunctionAmount)
  1215. elseif CatName == "HTTP" then
  1216. local GetAmount = self.FireCounts["HttpGet"];
  1217. local PostAmount = self.FireCounts["HttpPost"];
  1218. local GetObjAmount = self.FireCounts["GetObjects"];
  1219. CatFireAmount.Text = tostring(GetAmount + PostAmount + GetObjAmount);
  1220. end
  1221. end)
  1222.  
  1223. for _,Obj in pairs(CatObj.Object:GetChildren()) do
  1224. if Obj:IsA("TextButton") then
  1225. SubOptions._len = SubOptions._len + 1;
  1226.  
  1227. local TypeRef = CatName=="HTTP" and (Obj.Name=="GetObjects" and "GetObjects" or "Http"..Obj.Name) or Obj:FindFirstChild("_type")
  1228. local FireAmount = Obj.amount;
  1229. local Selected = false;
  1230.  
  1231. self.FireCounts._updated.Event:Connect(function()
  1232. if TypeRef then
  1233. if CatName == "HTTP" then
  1234. local MyCount = self.FireCounts[(Obj.Name=="GetObjects" and "GetObjects" or "Http"..Obj.Name)];
  1235. FireAmount.Text = MyCount;
  1236. else
  1237. local MyCount = self.FireCounts[TypeRef.Value];
  1238. FireAmount.Text = MyCount;
  1239. end
  1240. end
  1241. end)
  1242.  
  1243. SubOptions[Obj.Name] = {["Object"] = Obj};
  1244.  
  1245. local _info = TweenInfo.new(0.2,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0)
  1246. local _select = game:GetService("TweenService"):Create(Obj, _info, {["BackgroundTransparency"]=0.9})
  1247. local _unselect = game:GetService("TweenService"):Create(Obj, _info, {["BackgroundTransparency"]=1})
  1248. local _setcat = game:GetService("TweenService"):Create(Obj, _info, {["BackgroundColor3"]=Color3.new(85/255, 170/255, 1)})
  1249. local _unsetcat = game:GetService("TweenService"):Create(Obj, _info, {["BackgroundColor3"]=Color3.new(120/255, 120/255, 120/255)})
  1250.  
  1251. Obj.MouseEnter:Connect(function()
  1252. if not(Selected) then
  1253. _select:Play();
  1254. end
  1255. end)
  1256.  
  1257. Obj.MouseLeave:Connect(function()
  1258. if not(Selected) then
  1259. _unselect:Play()
  1260. end
  1261. end)
  1262.  
  1263. ForceUnset.Event:Connect(function(selector)
  1264. if selector == Obj then
  1265. Selected = true;
  1266. return
  1267. end
  1268. Selected = false;
  1269. _unsetcat:Play();
  1270. _unselect:Play();
  1271. end)
  1272.  
  1273. Obj.MouseButton1Down:Connect(function()
  1274. if TypeRef and CatName ~= "HTTP" then
  1275. ForceUnset:Fire(Obj);
  1276. _select:Play();
  1277. _setcat:Play();
  1278. ViewingType = tostring(TypeRef.Value)
  1279. AddRemoveOverride = true;
  1280. PopulateObjects(TypeRef.Value);
  1281. PopulateListObjects(TypeRef.Value);
  1282. AddRemoveOverride = false;
  1283. else
  1284. ForceUnset:Fire(Obj);
  1285. _select:Play();
  1286. _setcat:Play();
  1287. ViewingType = tostring(TypeRef)
  1288. AddRemoveOverride = true;
  1289. PopulateHttpObjects(TypeRef);
  1290. PopulateHttpListObjects(TypeRef);
  1291. AddRemoveOverride = false;
  1292. end
  1293. end)
  1294. end
  1295. end
  1296.  
  1297. Categories[CatName].SubOptions = SubOptions;
  1298. Categories[CatName].ResetAllAmounts = CategoryResetAllAmounts;
  1299. Categories[CatName]._init = true;
  1300.  
  1301. expand.MouseButton1Down:Connect(function()
  1302. State = not State;
  1303. expand.Image = StateImages[State];
  1304. if State then
  1305. CatObj.Object:TweenSize(UDim2.new(1,0,0,20*(SubOptions._len+1)), "Out", "Quad", 0.25, true)
  1306. else
  1307. CatObj.Object:TweenSize(UDim2.new(1,0,0,20), "Out", "Quad", 0.25, true)
  1308. end
  1309. end)
  1310. end
  1311.  
  1312. self:RegisterConnection(self.FireCounts._latest.Event, function(remote)
  1313. if type(remote) == "string" then -- HTTP
  1314. if ViewingType == remote then
  1315. if not(Panels["View"]:FindFirstChild(remote)) then
  1316. PopulateHttpObject(remote, self.HttpCache[remote]);
  1317. elseif not(Panels["List"]:FindFirstChild(remote)) then
  1318. PopulateHttpObject2(remote, self.HttpCache[remote]);
  1319. end
  1320. end
  1321. else -- REMOTE
  1322. if ViewingType == tostring(remote.ClassName) then
  1323. if not(Panels["View"]:FindFirstChild(remote.Name)) then
  1324. PopulateObject(remote, self.Cache[remote])
  1325. elseif not(Panels["List"]:FindFirstChild(remote.Name)) then
  1326. PopulateObject2(remote, self.Cache[remote])
  1327. end
  1328. end
  1329. end
  1330. end)
  1331.  
  1332. self:RegisterConnection(Panels["View"].ChildAdded, fixCanvas_View)
  1333. self:RegisterConnection(Panels["View"].ChildRemoved, fixCanvas_View)
  1334.  
  1335. self:RegisterConnection(OpenButton.MouseButton1Down, function()
  1336. OpenButton.Parent.Visible = false;
  1337. topbar.Visible = true;
  1338. end)
  1339.  
  1340. self:RegisterConnection(CloseButton.MouseButton1Down, function()
  1341. OpenButton.Parent.Visible = true;
  1342. topbar.Visible = false;
  1343. end)
  1344.  
  1345. self:RegisterConnection(DestroyButton.MouseButton1Down, function()
  1346. self:Destroy();
  1347. end)
  1348.  
  1349. self:RegisterConnection(SearchBar.FocusLost, function()
  1350. if SearchBar.Text == "" then
  1351. SearchBar.Close.Visible = false;
  1352. end
  1353. end)
  1354.  
  1355. self:RegisterConnection(SearchBar.Close.MouseButton1Down, function()
  1356. SearchBar:ReleaseFocus(false);
  1357. SearchBar.Text = "";
  1358. SearchBar.Close.Visible = false;
  1359. fixCanvas_View();
  1360. for _,Object in pairs(Panels["List"]:GetChildren()) do
  1361. if Object:IsA("Frame") then
  1362. Object.Visible = true;
  1363. end
  1364. end
  1365. end)
  1366.  
  1367. self:RegisterConnection(ExecuteButton.MouseButton1Down, function()
  1368. local CodeText = Panels["Code"].Main.Input.Text or "";
  1369. if self.TextEditor.Imported then
  1370. CodeText = self.TextEditor:RevertTabs(CodeText);
  1371. end
  1372.  
  1373. local success,error = pcall(function()
  1374. spawn(loadstring(CodeText)() or function()end)
  1375. end)
  1376.  
  1377. local OldColor = ExecuteButton.BackgroundColor3;
  1378.  
  1379. if success then
  1380. print("Execute Error: ", error);
  1381. end
  1382. end)
  1383.  
  1384. self:RegisterConnection(self.Services.UserInputService.InputBegan, function(inputObject)
  1385. local InputType = inputObject.UserInputType;
  1386. if InputType == Enum.UserInputType.MouseButton2 then
  1387. if HoveringObject then
  1388. Dropdown(HoveringObject)
  1389. end
  1390. if HoveringCallData.object and HoveringCallData.varargs then
  1391. if type(HoveringCallData.object) == "string" then
  1392. HTTPCallDropdown(HoveringCallData.object, HoveringCallData.varargs);
  1393. else
  1394. CallDropdown(HoveringCallData.object, self.RemoteFuncRef[HoveringCallData.object.ClassName], HoveringCallData.varargs);
  1395. end
  1396. end
  1397. end
  1398. end)
  1399.  
  1400. self.CustomDrag:SetDragging(true, topbar, Main);
  1401. self.CustomDrag:SetResizing(true, topbar, Main, drag);
  1402. ViewTab(CurrentTab);
  1403.  
  1404. self:RegisterConnection(self.Services.RunService.RenderStepped, function()
  1405. if SearchBar.Text ~= "" and SearchBar.Close.Visible == false then
  1406. SearchBar.Close.Visible = true
  1407. end
  1408.  
  1409. if SearchBar.Text ~= "" then
  1410. for _,Object in pairs(Panels["List"]:GetChildren()) do
  1411. local Visible_Objects = 0;
  1412. if Object:IsA("Frame") then
  1413. if Object.Name:lower():find(SearchBar.Text:lower()) then
  1414. Visible_Objects = Visible_Objects + 1;
  1415. Object.Visible = true;
  1416. else
  1417. Object.Visible = false;
  1418. end
  1419. end
  1420. Panels["List"].CanvasSize = UDim2.new(0,0,0,20*Visible_Objects)
  1421. end
  1422. end
  1423.  
  1424. if tooltip.Visible then
  1425. tooltip.Position = UDim2.new(0,Mouse.X + 5,0,Mouse.Y - tooltip.AbsoluteSize.Y)
  1426. end
  1427. end)
  1428.  
  1429. do -- Lines
  1430. local function CreateFadedLineH(holder)
  1431. local globtrans = 0
  1432. holder.BackgroundTransparency = 1;
  1433. for i=holder.AbsoluteSize.X/2,holder.AbsoluteSize.X,1 do
  1434. globtrans = globtrans + (1/(holder.AbsoluteSize.X/2))
  1435. local p = Instance.new("Frame", holder)
  1436. p.Size = UDim2.new(0,1,1,0)
  1437. p.BorderSizePixel = 0;
  1438. p.Parent = holder
  1439. p.BackgroundColor3 = holder.BackgroundColor3
  1440. p.Position = UDim2.new(0,i,0,0)
  1441. p.BackgroundTransparency = globtrans
  1442. end
  1443. globtrans = 1
  1444. for i=0,holder.AbsoluteSize.X/2,1 do
  1445. globtrans = globtrans - (1/(holder.AbsoluteSize.X/2))
  1446. local p = Instance.new("Frame", holder)
  1447. p.Size = UDim2.new(0,1,1,0)
  1448. p.BorderSizePixel = 0;
  1449. p.Parent = holder
  1450. p.BackgroundColor3 = holder.BackgroundColor3
  1451. p.Position = UDim2.new(0,i,0,0)
  1452. p.BackgroundTransparency = globtrans
  1453. end
  1454. end
  1455.  
  1456. local function CreateFadedLineV(holder)
  1457. local globtrans = 0
  1458. holder.BackgroundTransparency = 1;
  1459. for i=holder.AbsoluteSize.Y/2,holder.AbsoluteSize.Y,1 do
  1460. globtrans = globtrans + (1/(holder.AbsoluteSize.Y/2))
  1461. local p = Instance.new("Frame", holder)
  1462. p.Size = UDim2.new(1,0,0,1)
  1463. p.BorderSizePixel = 0;
  1464. p.Parent = holder
  1465. p.BackgroundColor3 = holder.BackgroundColor3
  1466. p.Position = UDim2.new(0,0,0,i)
  1467. p.BackgroundTransparency = globtrans
  1468. end
  1469. globtrans = 1
  1470. for i=0,holder.AbsoluteSize.Y/2,1 do
  1471. globtrans = globtrans - (1/(holder.AbsoluteSize.Y/2))
  1472. local p = Instance.new("Frame", holder)
  1473. p.Size = UDim2.new(1,0,0,1)
  1474. p.BorderSizePixel = 0;
  1475. p.Parent = holder
  1476. p.BackgroundColor3 = holder.BackgroundColor3
  1477. p.Position = UDim2.new(0,0,0,i)
  1478. p.BackgroundTransparency = globtrans
  1479. end
  1480. end
  1481.  
  1482. for _, obj in next, Spy:GetDescendants() do
  1483. if obj.Name == "HorizontalLine" then
  1484. CreateFadedLineH(obj);
  1485. end
  1486. end
  1487. for _, obj in next, Spy:GetDescendants() do
  1488. if obj.Name == "VerticalLine" then
  1489. CreateFadedLineV(obj);
  1490. end
  1491. end
  1492. end
  1493. end
  1494.  
  1495. self.TextEditor();
  1496. self.TextEditor:SetCode("");
  1497. self.CustomDrag();
  1498.  
  1499. self:TrackRemotes(); -- Start tracking all remotes
  1500. self:TrackHttp(); -- Start tracking all http requests
  1501. end
  1502. setmetatable(FrostHook, metadata);
  1503. end
  1504.  
  1505. do -- Custom Dragging/Resizing object.
  1506. local metadata = {};
  1507. local Cached_ResizeConnections = {};
  1508. local Cached_DragConnections = {};
  1509. local methods = {
  1510. SetDragging = function(self, toggle, frame, main)
  1511. if toggle then
  1512. if Cached_DragConnections[frame] then
  1513. return;
  1514. end
  1515.  
  1516. self.DragActive[frame] = {
  1517. ["Main"] = main,
  1518. Dragging = false,
  1519. MouseOnTopBar = false,
  1520. startPosition = Vector2.new(),
  1521. TopbarPosition = Vector2.new(),
  1522. };
  1523.  
  1524. local mE = frame.MouseEnter:Connect(function()
  1525. self.DragActive[frame].MouseOnTopBar = true;
  1526. end)
  1527.  
  1528. local mL = frame.MouseLeave:Connect(function()
  1529. self.DragActive[frame].MouseOnTopBar = false;
  1530. end)
  1531.  
  1532. Cached_DragConnections[frame] = {mE,mL};
  1533. else
  1534. for obj,cons in pairs(Cached_DragConnections) do
  1535. if obj == frame then
  1536. for _,con in pairs(cons) do
  1537. con:Disconnect();
  1538. end
  1539. end
  1540. end
  1541. self.DragActive[frame] = nil;
  1542. end
  1543. end,
  1544. SetResizing = function(self, toggle, frame, main, dragbtn)
  1545. if toggle then
  1546. if self.ResizeActive[frame] then
  1547. return;
  1548. end
  1549. self.ResizeActive[frame] = {
  1550. ["Main"] = main,
  1551. Resizing = false,
  1552. startPosition = Vector2.new(),
  1553. MainStartPosition = UDim2.new(),
  1554. MainStartSize = UDim2.new(),
  1555. };
  1556.  
  1557. local dBD = dragbtn.MouseButton1Down:Connect(function()
  1558. self.ResizeActive[frame].startPosition = Vector2.new(Mouse.X, Mouse.Y)
  1559. self.ResizeActive[frame].MainStartSize = main.Size;
  1560. self.ResizeActive[frame].MainStartPosition = main.Position;
  1561. self.ResizeActive[frame].Resizing = true;
  1562. end)
  1563.  
  1564. Cached_ResizeConnections[frame] = dBD;
  1565. else
  1566. if Cached_ResizeConnections[frame] then
  1567. Cached_ResizeConnections[frame]:Disconnect();
  1568. end
  1569. self.ResizeActive[frame] = nil;
  1570. end
  1571. end,
  1572. };
  1573.  
  1574. metadata.__index = function(self, index)
  1575. if methods[index] then
  1576. return function(s, ...)
  1577. return methods[index](self, ...);
  1578. end
  1579. end
  1580. end
  1581.  
  1582. metadata.__call = function(self)
  1583. FrostHook:RegisterConnection(FrostHook.Services.UserInputService.InputBegan, function(inputObject)
  1584. local InputType = inputObject.UserInputType;
  1585. if InputType == Enum.UserInputType.MouseButton1 then
  1586. for topbar,data in pairs(self.DragActive) do
  1587. if data.MouseOnTopBar then
  1588. data.Dragging = true;
  1589. data.startPosition = Vector2.new(Mouse.X, Mouse.Y)
  1590. data.TopbarPosition = topbar.Position;
  1591. end
  1592. end
  1593. end
  1594. end)
  1595.  
  1596. FrostHook:RegisterConnection(FrostHook.Services.UserInputService.InputEnded, function(inputObject)
  1597. local InputType = inputObject.UserInputType;
  1598. if InputType == Enum.UserInputType.MouseButton1 then
  1599. for topbar,data in pairs(self.DragActive) do
  1600. data.Dragging = false;
  1601. end
  1602. for topbar,data in pairs(self.ResizeActive) do
  1603. data.Resizing = false;
  1604. end
  1605. end
  1606. end)
  1607.  
  1608. local function KeepInBounds(_p, _s)
  1609. local appropriated_p = _p
  1610. local AbsolutePos = Vector2.new(((_p.X.Scale*Mouse.ViewSizeX)+_p.X.Offset), ((_p.Y.Scale*Mouse.ViewSizeY)+_p.Y.Offset))
  1611.  
  1612. local S_O_X = _p.X.Scale * Mouse.ViewSizeX;
  1613. local S_O_Y = _p.Y.Scale * Mouse.ViewSizeY;
  1614.  
  1615. if AbsolutePos.X + _s.X >= Mouse.ViewSizeX then
  1616. appropriated_p = UDim2.new(
  1617. _p.X.Scale,
  1618. Mouse.ViewSizeX - S_O_X - _s.X,
  1619. appropriated_p.Y.Scale,
  1620. appropriated_p.Y.Offset
  1621. )
  1622. end
  1623.  
  1624. if AbsolutePos.X <= 0 then
  1625. appropriated_p = UDim2.new(
  1626. _p.X.Scale,
  1627. -S_O_X,
  1628. appropriated_p.Y.Scale,
  1629. appropriated_p.Y.Offset
  1630. )
  1631. end
  1632.  
  1633. if AbsolutePos.Y + _s.Y - 20 >= Mouse.ViewSizeY then
  1634. appropriated_p = UDim2.new(
  1635. appropriated_p.X.Scale,
  1636. appropriated_p.X.Offset,
  1637. _p.Y.Scale,
  1638. Mouse.ViewSizeY - S_O_Y - _s.Y + 20
  1639. )
  1640. end
  1641.  
  1642. if AbsolutePos.Y <= -20 then
  1643. appropriated_p = UDim2.new(
  1644. appropriated_p.X.Scale,
  1645. appropriated_p.X.Offset,
  1646. _p.Y.Scale,
  1647. -S_O_Y - 20
  1648. )
  1649. end
  1650.  
  1651. return appropriated_p;
  1652. end
  1653.  
  1654. local function ConstraintApply(_s)
  1655. local appropriated_s = _s;
  1656.  
  1657. if _s.X.Offset <= FrostHook.Constraints.Min.X.Offset then
  1658. appropriated_s = UDim2.new(0, FrostHook.Constraints.Min.X.Offset, 0, appropriated_s.Y.Offset)
  1659. elseif _s.X.Offset >= FrostHook.Constraints.Max.X.Offset then
  1660. appropriated_s = UDim2.new(0, FrostHook.Constraints.Max.X.Offset, 0, appropriated_s.Y.Offset)
  1661. end
  1662.  
  1663. if _s.Y.Offset <= FrostHook.Constraints.Min.Y.Offset then -- Fix X Offset
  1664. appropriated_s = UDim2.new(0, appropriated_s.X.Offset, 0, FrostHook.Constraints.Min.Y.Offset)
  1665. elseif _s.Y.Offset >= FrostHook.Constraints.Max.Y.Offset then
  1666. appropriated_s = UDim2.new(0, appropriated_s.X.Offset, 0, FrostHook.Constraints.Max.Y.Offset)
  1667. end
  1668.  
  1669. return appropriated_s;
  1670. end
  1671.  
  1672. FrostHook:RegisterConnection(FrostHook.Services.RunService.RenderStepped, function()
  1673. for Topbar, Data in pairs(self.DragActive) do
  1674. local Main = Data.Main;
  1675.  
  1676. if Data.startPosition and Data.Dragging then
  1677. local AbsolutePixelChange = Vector2.new(Mouse.X,Mouse.Y) - Data.startPosition;
  1678. local AbsolutePixelUDim2 = UDim2.new(0,AbsolutePixelChange.X,0,AbsolutePixelChange.Y)
  1679. Topbar.Position = KeepInBounds(
  1680. (UDim2.new(
  1681. 0.5, Data.TopbarPosition.X.Offset,
  1682. 0.5, Data.TopbarPosition.Y.Offset)
  1683. + AbsolutePixelUDim2
  1684. ),
  1685. Main.AbsoluteSize
  1686. );
  1687. end
  1688. end
  1689.  
  1690. for Topbar, Data in pairs(self.ResizeActive) do
  1691. local Main = Data.Main;
  1692.  
  1693. if Data.startPosition and Data.Resizing then
  1694. local AbsolutePixelChange = Vector2.new(Mouse.X,Mouse.Y) - Data.startPosition;
  1695. local AbsolutePixelUDim2 = UDim2.new(0,AbsolutePixelChange.X,0,AbsolutePixelChange.Y)
  1696. Main.Size = ConstraintApply(Data.MainStartSize + AbsolutePixelUDim2)
  1697. Topbar.Size = UDim2.new(0,Main.Size.X.Offset,Topbar.Size.Y.Scale,Topbar.Size.Y.Offset)
  1698. Main.Position = Data.MainStartPosition;
  1699. end
  1700. end
  1701. end)
  1702. end
  1703.  
  1704. setmetatable(FrostHook.CustomDrag, metadata);
  1705. end
  1706.  
  1707. do -- Script Generation (WIP)
  1708. local metadata = {}
  1709. local methods = {
  1710. var_name = function(self, Cache, value)
  1711. local ttype = type(value)
  1712. if ttype == "table" then
  1713. Cache["table"] = Cache["table"] + 1;
  1714. value = "table_"..tostring(Cache["table"])
  1715. elseif ttype == "userdata" then
  1716. Cache["userdata"] = Cache["userdata"] + 1;
  1717. value = "userdata_"..tostring(Cache["userdata"]);
  1718. elseif ttype == "string" then
  1719. Cache["string"] = Cache["string"] + 1;
  1720. value = "string_"..tostring(Cache["string"]);
  1721. elseif ttype == "number" then
  1722. Cache["number"] = Cache["number"] + 1;
  1723. value = "number_"..tostring(Cache["number"])
  1724. elseif ttype == "boolean" then
  1725. Cache["boolean"] = Cache["boolean"] + 1;
  1726. value = "bool_"..tostring(Cache["boolean"])
  1727. end
  1728. return value, Cache
  1729. end,
  1730. transform_path = function(self, path) -- Pulled from Hydroxide @Modified
  1731. local split = path:split('.')
  1732. local result = ""
  1733. local name = FrostHook.Services.Players.LocalPlayer.Name;
  1734.  
  1735. if #split == 1 and not game:FindFirstChild(split[1]) then
  1736. return split[1] .. " --[[ Parent is \"nil\" or object is destroyed ]]"
  1737. end
  1738.  
  1739. if pcall(game.GetService, game, split[1]) then
  1740. split[1] = "GetService(\"" .. split[1] .. "\")"
  1741. end
  1742.  
  1743. for i,v in next, split do
  1744. if (v:sub(1, 1):match("%A") or v:find("%W")) and not v:find("GetService") then
  1745. result = result:sub(1, result:len())
  1746. v = "[\"" .. v .. "\"]"
  1747. elseif v:find("GetService") then
  1748. v = ':' .. v
  1749. else
  1750. v = '.' .. v
  1751. end
  1752.  
  1753. result = result .. v
  1754. end
  1755.  
  1756. result = result:gsub("GetService(\"Players\")." .. name, "GetService(\"Players\").LocalPlayer")
  1757. result = result:gsub("GetService(\"Players\")[\"" .. name .. "\"]", "GetService(\"Players\").LocalPlayer")
  1758.  
  1759. return "game" .. result
  1760. end,
  1761. transform_value = function(self, value) -- Pulled from Hydroxide @Modified
  1762. local result = ""
  1763. local ttype = typeof(value)
  1764.  
  1765. if ttype == "table" then
  1766. result = result .. self:dump_table(value)
  1767. elseif ttype == "string" then
  1768. result = result .. '"' .. value .. '"'
  1769. elseif ttype == "Instance" then
  1770. result = result .. self:transform_path(value:GetFullName())
  1771. elseif ttype == "Vector3" then
  1772. result = result .. "Vector3.new(" .. tostring(value) .. ")"
  1773. elseif ttype == "CFrame" then
  1774. result = result .. "CFrame.new(" .. tostring(value) .. ")"
  1775. elseif ttype == "Color3" then
  1776. result = result .. "Color3.new(" .. tostring(value) .. ")"
  1777. elseif ttype == "Ray" then
  1778. local split = tostring(value):split('}, ')
  1779. local origin = split[1]:gsub('{', "Vector3.new("):gsub('}', ')')
  1780. local direction = split[2]:gsub('{', "Vector3.new("):gsub('}', ')')
  1781. result = result .. "Ray.new(" .. origin .. "), " .. direction .. ')'
  1782. elseif ttype == "ColorSequence" then
  1783. result = result .. "ColorSequence.new(" .. self:dump_table(v.Keypoints) .. ')'
  1784. elseif ttype == "ColorSequenceKeypoint" then
  1785. result = result .. "ColorSequenceKeypoint.new(" .. value.Time .. ", Color3.new(" .. tostring(value.Value) .. "))"
  1786. else
  1787. if type(value) == "userdata" then
  1788. print(ttype)
  1789. end
  1790.  
  1791. result = result .. tostring(value)
  1792. end
  1793.  
  1794. return result
  1795. end,
  1796. dump_table = function(self, node, tree, indentation) -- Pulled from StackOverflow @ Alundaio // kris2k; @Modified
  1797. local cache, stack, output = {},{},{}
  1798. local depth = 1
  1799.  
  1800. if type(node) ~= "table" then
  1801. return "only table type is supported, got " .. type(node)
  1802. end
  1803.  
  1804. if nil == indentation then indentation = 1 end
  1805.  
  1806. local NEW_LINE = "\n"
  1807. local TAB_CHAR = "\t"
  1808.  
  1809. if nil == tree then
  1810. NEW_LINE = "\n"
  1811. elseif not tree then
  1812. NEW_LINE = ""
  1813. TAB_CHAR = ""
  1814. end
  1815.  
  1816. local output_str = "{" .. NEW_LINE
  1817.  
  1818. while true do
  1819. local size = 0
  1820. for k,v in pairs(node) do
  1821. size = size + 1
  1822. end
  1823.  
  1824. local cur_index = 1
  1825. for k,v in pairs(node) do
  1826. if (cache[node] == nil) or (cur_index >= cache[node]) then
  1827. if (string.find(output_str,"}",output_str:len())) then
  1828. output_str = output_str .. "," .. NEW_LINE
  1829. elseif not (string.find(output_str,NEW_LINE,output_str:len())) then
  1830. output_str = output_str .. NEW_LINE
  1831. end
  1832. table.insert(output,output_str)
  1833. output_str = ""
  1834.  
  1835. local key
  1836. if (type(k) == "number" or type(k) == "boolean") then
  1837. key = "["..tostring(k).."]"
  1838. else
  1839. key = '["'..tostring(k)..'"]'
  1840. end
  1841. if (type(v) == "number" or type(v) == "boolean") then
  1842. output_str = output_str .. string.rep(TAB_CHAR,depth*indentation) .. key .. " = "..tostring(v)
  1843. elseif (type(v) == "table") then
  1844. output_str = output_str .. string.rep(TAB_CHAR,depth*indentation) .. key .. " = {" .. NEW_LINE
  1845. table.insert(stack,node)
  1846. table.insert(stack,v)
  1847. cache[node] = cur_index+1
  1848. break
  1849. else
  1850. output_str = output_str .. string.rep(TAB_CHAR,depth*indentation) .. key .. " = '"..tostring(v).."'"
  1851. end
  1852.  
  1853. if (cur_index == size) then
  1854. output_str = output_str .. NEW_LINE .. string.rep(TAB_CHAR,(depth-1)*indentation) .. "}"
  1855. else
  1856. output_str = output_str .. ","
  1857. end
  1858. else
  1859. if (cur_index == size) then
  1860. output_str = output_str .. NEW_LINE .. string.rep(TAB_CHAR,(depth-1)*indentation) .. "}"
  1861. end
  1862. end
  1863. cur_index = cur_index + 1
  1864. end
  1865.  
  1866. if (size == 0) then
  1867. output_str = output_str .. NEW_LINE .. string.rep(TAB_CHAR,(depth-1)*indentation) .. "}"
  1868. end
  1869.  
  1870. if (#stack > 0) then
  1871. node = stack[#stack]
  1872. stack[#stack] = nil
  1873. depth = cache[node] == nil and depth + 1 or depth - 1
  1874. else
  1875. break
  1876. end
  1877. end
  1878. table.insert(output,output_str)
  1879. return table.concat(output)
  1880. end,
  1881. }
  1882.  
  1883. metadata.__index = function(self, index)
  1884. if methods[index] then
  1885. return function(s, ...)
  1886. return methods[index](self, ...);
  1887. end
  1888. end
  1889. end
  1890.  
  1891. setmetatable(FrostHook.ScriptGeneration, metadata);
  1892. end
  1893.  
  1894. do -- Text Editor
  1895. local metadata = {};
  1896. local methods = {
  1897. CorrectTabs = function(self, code)
  1898. return string.gsub(code, "\t", (string.rep("\t", self.TabSize+1)))
  1899. end,
  1900. RevertTabs = function(self, code)
  1901. return code:gsub(string.rep("\t", self.TabSize+1), "\t")
  1902. end,
  1903. GetTextSize = function(self, text)
  1904. text = (text~=nil)and text or "";
  1905. return game:GetService("TextService"):GetTextSize(text, self.FontSize, self.Font, Vector2.new(math.huge, math.huge));
  1906. end,
  1907. SetCode = function(self, code)
  1908. self.Imported = true;
  1909. FrostHook.Interface.Topbar.Main.MainPanel.Code.Main.Input.Text = self:CorrectTabs(code);
  1910. end,
  1911. ExportCode = function(self, code)
  1912. return self:RevertTabs(code);
  1913. end,
  1914. GetEndOfLine = function(self, code, start)
  1915. local pos = start;
  1916. while true do
  1917. local char = string.sub(code, pos, pos)
  1918. if string.byte(char) == 10 or string.byte(char) == 13 then
  1919. break;
  1920. elseif pos > string.len(code) then
  1921. break;
  1922. else
  1923. pos = pos + 1;
  1924. end
  1925. end
  1926. return pos - 1;
  1927. end,
  1928. GetStartOfLine = function(self, code, start)
  1929. local pos = start;
  1930. while true do
  1931. local char = string.sub(code, pos, pos)
  1932. if string.byte(char) == 10 or string.byte(char) == 13 then
  1933. break;
  1934. elseif pos <= 0 then
  1935. pos = 0;
  1936. break;
  1937. else
  1938. pos = pos - 1;
  1939. end
  1940. end
  1941. return pos + 1;
  1942. end,
  1943. GetLineText = function(self, code, start)
  1944. local LineText = "";
  1945. local first = self:GetStartOfLine(code, start);
  1946. local second = self:GetEndOfLine(code, start);
  1947. if first and second then
  1948. LineText = string.sub(code, first, second);
  1949. end
  1950. return LineText;
  1951. end,
  1952. ClearHighlights = function(self)
  1953. for d,p in pairs(self.Cache) do
  1954. if p.Object then
  1955. p.Object:Destroy();
  1956. end
  1957. self.Cache[d] = nil;
  1958. end
  1959. end,
  1960. };
  1961.  
  1962. metadata.__index = function(self, index)
  1963. if methods[index] then
  1964. return function(s, ...)
  1965. return methods[index](self, ...);
  1966. end
  1967. end
  1968. end
  1969.  
  1970. metadata.__call = function(self)
  1971. local Spy = FrostHook.Interface;
  1972. local Templates = Spy.Templates;
  1973. local Editor = Spy.Topbar.Main.MainPanel.Code;
  1974. local Main = Editor.Main;
  1975. local Highlights = Main.Highlights;
  1976. local LineNumbers = Editor.Lines;
  1977. local InputBox = Main.Input;
  1978.  
  1979. FrostHook:RegisterConnection(InputBox:GetPropertyChangedSignal("Text"), function()
  1980.  
  1981. local Lines = self:GetTextSize(InputBox.Text).Y/14
  1982.  
  1983. if self.LineCache._len > Lines then
  1984. for i=Lines,self.LineCache._len,1 do
  1985. local Line = self.LineCache[i]
  1986. if Line then
  1987. Line:Destroy();
  1988. self.LineCache[i] = nil;
  1989. end
  1990. end
  1991. end
  1992.  
  1993. self.LineCache._len = Lines;
  1994.  
  1995. for i=1,Lines do
  1996. local Line = self.LineCache[i]
  1997. if not Line then
  1998. Line = Templates.Line:Clone();
  1999. Line.Visible = true;
  2000. Line.Parent = LineNumbers;
  2001. self.LineCache[i] = Line;
  2002. end
  2003. Line.Text = i;
  2004. Line.Name = i;
  2005. Line.LayoutOrder = i;
  2006. end
  2007.  
  2008. Main.CanvasSize = UDim2.new(0,0,0,LineNumbers.Layout.AbsoluteContentSize.Y)
  2009.  
  2010. if math.abs(InputBox.CursorPosition - string.len(InputBox.Text)) <= 5 then
  2011. Main.CanvasPosition = Vector2.new(0,LineNumbers.Layout.AbsoluteContentSize.Y)
  2012. end
  2013.  
  2014. self:ClearHighlights();
  2015.  
  2016. if InputBox.Text ~= "" then
  2017. for keyword,data in pairs(FrostHook.Keywords) do
  2018. local lastPosition = 0;
  2019. local cachedPosition = -1;
  2020. local StackOverflow = false;
  2021. local patternA = data[2]
  2022. local patternB = data[3]
  2023. while true do
  2024. if lastPosition == cachedPosition then
  2025. warn("Highlighting had a stack overflow!")
  2026. break;
  2027. end
  2028. cachedPosition = lastPosition;
  2029. local a,b = string.find(InputBox.Text, patternA..keyword..patternB, lastPosition, false)
  2030. if a and b then
  2031. local word = string.sub(InputBox.Text, a, b)
  2032. local iterations = 0;
  2033. repeat
  2034. iterations = iterations + 1;
  2035. if iterations >= 5 then
  2036. StackOverflow = true;
  2037. break;
  2038. end
  2039. local first = word:sub(1,1);
  2040. if first:find("%p") or first:find("%s") then
  2041. a = a + 1;
  2042. word = string.sub(InputBox.Text, a, b);
  2043. end
  2044. local last = word:sub(#word,#word)
  2045. if last:find("%p") or last:find("%s") then
  2046. b = b - 1;
  2047. word = string.sub(InputBox.Text, a, b);
  2048. end
  2049. until word == keyword or StackOverflow;
  2050.  
  2051. if not StackOverflow then
  2052. local LineStart = self:GetStartOfLine(InputBox.Text, a);
  2053. local LineText = InputBox.Text:sub(LineStart, a-1);
  2054.  
  2055. self.Cache[tostring(a..":"..b)] = {
  2056. ["Word"] = word,
  2057. ["LineText"] = LineText,
  2058. ["Object"] = nil,
  2059. }
  2060. lastPosition = b;
  2061. else
  2062. warn("Highlighting had a stack overflow!")
  2063. end;
  2064. else
  2065. break;
  2066. end
  2067. end
  2068. end
  2069.  
  2070. for PositionData,Data in pairs(self.Cache) do
  2071. if Data and Data.Word and Data.LineText then
  2072. local Word = Data.Word
  2073. local LineText = Data.LineText;
  2074. local KeywordData = FrostHook.Keywords[tostring(Word)]
  2075. if KeywordData then
  2076. local ColorData = KeywordData[1]
  2077. local a,b = unpack(string.split(PositionData, ":"));
  2078.  
  2079. local LineHeight = InputBox.LineHeight;
  2080. local Relative_Y = self:GetTextSize(string.sub(InputBox.Text, 1, b)).Y
  2081. Relative_Y = Relative_Y * LineHeight - (LineHeight*3)
  2082. local Relative_X = self:GetTextSize(Data.LineText).X
  2083. local keywordSize = self:GetTextSize(Word)
  2084.  
  2085. local newLabel = Templates.Highlight:Clone();
  2086. newLabel.Position = UDim2.new(0,Relative_X,0,Relative_Y)
  2087. newLabel.Size = UDim2.new(0,keywordSize.X,0,keywordSize.Y)
  2088. newLabel.Text = Word;
  2089. newLabel.Name = a..":"..b;
  2090. newLabel.TextColor3 = ColorData;
  2091. newLabel.TextStrokeColor3 = Color3.new(ColorData.r-0.4,ColorData.g-0.4,ColorData.b-0.4)
  2092. newLabel.Parent = Highlights;
  2093. self.Cache[PositionData].Object = newLabel;
  2094. end
  2095. end
  2096. end
  2097. elseif Text == "" then
  2098. self.Imported = false;
  2099. end
  2100. end)
  2101.  
  2102. FrostHook:RegisterConnection(FrostHook.Services.UserInputService.InputBegan, function(inputObject)
  2103. local KeyCode = inputObject.KeyCode;
  2104. local CursorPos = InputBox.CursorPosition
  2105. local current_char = string.sub(InputBox.Text, CursorPos, CursorPos)
  2106. local prev_char = string.sub(InputBox.Text, CursorPos-1,CursorPos-1)
  2107. local next_char = string.sub(InputBox.Text, CursorPos+1,CursorPos+1)
  2108.  
  2109. local CtrlDown = FrostHook.Services.UserInputService:IsKeyDown(Enum.KeyCode.LeftControl)
  2110.  
  2111. if KeyCode == Enum.KeyCode.C and CtrlDown then
  2112. local Code = self.Imported and self:ExportCode(InputBox.Text) or InputBox.Text;
  2113. FrostHook.env.to_clipboard(Code);
  2114. elseif KeyCode == Enum.KeyCode.V and CtrlDown then
  2115. self.Imported = false;
  2116. elseif CtrlDown then
  2117. return;
  2118. end
  2119.  
  2120. if InputBox:IsFocused() and InputBox.Text ~= "" then
  2121. if KeyCode == Enum.KeyCode.Tab then -- working
  2122. local all_before = string.sub(InputBox.Text, 1, CursorPos-1);
  2123. local all_after = string.sub(InputBox.Text, CursorPos, string.len(InputBox.Text))
  2124. InputBox.Text = all_before..string.rep("\t", self.TabSize)..all_after;
  2125. InputBox.CursorPosition = CursorPos + self.TabSize;
  2126. elseif KeyCode == Enum.KeyCode.Backspace then
  2127. if prev_char == "\t" then
  2128. local all_before = string.sub(InputBox.Text, 1, CursorPos-self.TabSize-1);
  2129. local all_after = string.sub(InputBox.Text, CursorPos, string.len(InputBox.Text))
  2130. InputBox.Text = all_before..all_after;
  2131. InputBox.CursorPosition = CursorPos - self.TabSize;
  2132. end
  2133. elseif KeyCode == Enum.KeyCode.Left then
  2134. if current_char == "\t" then
  2135. CursorPos = CursorPos - self.TabSize;
  2136. InputBox.CursorPosition = CursorPos;
  2137. end
  2138. elseif KeyCode == Enum.KeyCode.Right then
  2139. if current_char == "\t" then
  2140. CursorPos = CursorPos + self.TabSize;
  2141. InputBox.CursorPosition = CursorPos;
  2142. end
  2143. elseif KeyCode == Enum.KeyCode.Up then
  2144. if current_char == "\n" then
  2145. CursorPos = CursorPos - 1;
  2146. end
  2147. local startLine = self:GetStartOfLine(InputBox.Text, CursorPos);
  2148. InputBox.CursorPosition = startLine - 1;
  2149. elseif KeyCode == Enum.KeyCode.Down then
  2150. local endLine = self:GetEndOfLine(InputBox.Text, CursorPos);
  2151. endLine = self:GetEndOfLine(InputBox.Text, endLine) + 2;
  2152. endLine = self:GetEndOfLine(InputBox.Text, endLine)
  2153. InputBox.CursorPosition = endLine + 1;
  2154. end
  2155. end
  2156. end)
  2157. end
  2158.  
  2159. setmetatable(FrostHook.TextEditor, metadata);
  2160. end
  2161.  
  2162. FrostHook(); -- Initialize FrostHook Spy.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement