EFTPMC

Frosthook

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