Guest User

gmod net logger

a guest
Feb 14th, 2019
3,085
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.39 KB | None | 0 0
  1. -- by https://steamcommunity.com/id/Pastebin/
  2. -- https://www.mpgh.net/forum/showthread.php?t=1432417
  3.  
  4.  
  5. netCodes = netCodes or {
  6. ["SendToServer"] = net.SendToServer,
  7. ["Start"] = net.Start,
  8. ["WriteAngle"] = net.WriteAngle,
  9. ["WriteBit"] = net.WriteBit,
  10. ["WriteBool"] = net.WriteBool,
  11. ["WriteColor"] = net.WriteColor,
  12. ["WriteData"] = net.WriteData,
  13. ["WriteDouble"] = net.WriteDouble,
  14. ["WriteEntity"] = net.WriteEntity,
  15. ["WriteFloat"] = net.WriteFloat,
  16. ["WriteInt"] = net.WriteInt,
  17. ["WriteMatrix"] = net.WriteMatrix,
  18. ["WriteNormal"] = net.WriteNormal,
  19. ["WriteString"] = net.WriteString,
  20. ["WriteTable"] = net.WriteTable,
  21. ["WriteUInt"] = net.WriteUInt,
  22. ["WriteVector"] = net.WriteVector
  23. }
  24.  
  25. function tableToString(t)
  26. if type(o) == 'table' then
  27. local s = '{ '
  28. for k,v in pairs(o) do
  29. if type(k) ~= 'number' then k = '"'..k..'"' end
  30. s = s .. '['..k..'] = ' .. dump(v) .. ','
  31. end
  32. return s .. '} '
  33. else
  34. return tostring(o)
  35. end
  36. end
  37.  
  38.  
  39. local buffer = ""
  40.  
  41. local function construct_net_block(t, netName)
  42. makeString = "net." ..netName .. "("
  43. for i=1, #t do
  44. indexValue = t[i]
  45. if (type(indexValue) == "number") then
  46. if (i == #t) then makeString = makeString .. indexValue else makeString = makeString .. indexValue .. ", " end
  47. elseif (type(indexValue) == "boolean") then
  48. makeString = makeString .. tostring(indexValue)
  49. elseif (type(indexValue) == "string") then
  50. if (i == #t) then makeString = makeString .. "\"" .. indexValue .. "\"" else makeString = makeString .. "\"" .. indexValue .. "\", " end
  51. elseif (type(indexValue) == "Player" || type(indexValue) == "Entity" || type(indexValue) == "NPC") then
  52. makeString = makeString .. "Entity(" .. tostring(indexValue:EntIndex()) .. ")"
  53. elseif (type(indexValue) == "Vector") then
  54. makeString = makeString .. "Vector(" .. string.gsub(tostring(indexValue), "%s+", ", ") .. ")"
  55. elseif (type(indexValue) == "table") then
  56. print("INDEXVALUE IS TABLE")
  57. print("indevalue", table.ToString(indexValue))
  58. makeString = makeString .. table.ToString(indexValue)
  59. else
  60. ErrorNoHalt("[netlogthing] !!! UNHANDLED !!! " .. "type(index): " .. "[" .. type(indexValue) .. "]" .. " index: " .. "[" .. tostring(indexValue) .. "]")
  61. end
  62. end
  63.  
  64. buffer = buffer .. makeString .. ")" .. "\n"
  65. if (string.match(buffer, "SendToServer")) then
  66. hook.Run( "RecvNetMsg", buffer )
  67. buffer = ""
  68. end
  69. end
  70.  
  71.  
  72.  
  73. -- net request sent
  74. -- net requests go through our
  75.  
  76.  
  77.  
  78. function handle_net_message(netName)
  79. return function (...) -- just doing this so I can give access to netName in construct_net_block function
  80. construct_net_block({...}, netName)
  81. hook.Add( "RecvNetMsg", "netlogger", function(netmsg)
  82. detour_net_functions(false)
  83. RunString(netmsg)
  84. detour_net_functions(true)
  85. end)
  86.  
  87. -- netCodes[netName](...)
  88. end
  89. end
  90.  
  91.  
  92. function detour_net_functions(bool) -- WriteTable calls a bunch of other net functions internally, so got to turn it off
  93. if (bool) then
  94. for k, v in pairs(netCodes) do
  95. net[k] = handle_net_message(k)
  96. end
  97. else
  98. for k, v in pairs(netCodes) do
  99. net[k] = v
  100. end
  101. end
  102.  
  103. end
  104.  
  105.  
  106. if (!detoured_net_functions) then
  107. detoured_net_functions = true
  108. detour_net_functions(true)
  109. else
  110. print("\n\n\nAlready detoured net functions\n\n\n")
  111. end
  112.  
  113.  
  114.  
  115.  
  116. surface.CreateFont( "customFont2", {
  117. font = "Verdana", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  118. extended = false,
  119. size = 15,
  120. weight = 100,
  121. blursize = 0,
  122. scanlines = 0,
  123. antialias = true,
  124. underline = false,
  125. italic = false,
  126. strikeout = false,
  127. symbol = false,
  128. rotary = false,
  129. shadow = false,
  130. additive = false,
  131. outline = false,
  132. } )
  133.  
  134. function mysplit(inputstr, sep)
  135. if sep == nil then
  136. sep = "%s"
  137. end
  138. local t={} ; i=1
  139. for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  140. t[i] = str
  141. i = i + 1
  142. end
  143. return t
  144. end
  145.  
  146. local net_message_box = {
  147. setTextAndCount = function(self, text, count)
  148. newLineCount = #mysplit(text, "\n")
  149. self:SetTitle(" #" .. tostring(count))
  150. self.netmsgBox:SetText(text)
  151. W, H = self.netmsgBox:GetSize()
  152. W, H = self.netmsgBox:GetSize()
  153. self:SetSize(W, H + 200)
  154. self:SizeToContents()
  155.  
  156. end,
  157. Init = function(self)
  158. outer_self = self
  159. self:ShowCloseButton( false )
  160. self:SetSize(150, 400)
  161. self.W, self.H = self:GetSize()
  162. self.netmsgBox = vgui.Create( "DTextEntry", self)
  163. self.netmsgBox:SetPos( 40, 50 )
  164. self.netmsgBox:Dock(FILL)
  165. self.netmsgBox:SetMultiline(true);
  166. self.netmsgBox.Paint = function(self,w,h)
  167. draw.RoundedBox(0, 0, 0, w, h, Color(48,10,36, 255))
  168. self:DrawTextEntryText(Color(255, 255, 255), Color(30, 130, 255), Color(255, 255, 255))
  169. end
  170.  
  171. local closeBtn = vgui.Create( "Button", self)
  172. closeBtn:SetSize( 14,14 )
  173. closeBtn:SetPos(5,6)
  174. closeBtn:SetVisible( true )
  175. closeBtn:SetText( "" )
  176. closeBtn.Paint = function(self,w,h)
  177. draw.RoundedBox(5, 0, 0, w, h, Color(225,81,32, 255))
  178. -- surface.DrawCircle( 100, 100, 50, Color(255,255,255,255) )
  179. draw.DrawText( "x", "customFont2", w/2, -1, Color( 255,255,255, 255 ), TEXT_ALIGN_CENTER )
  180. end
  181. print("outer_self", outer_self)
  182. function closeBtn:OnMousePressed()
  183. outer_self:SetVisible(false)
  184. outer_self:Remove()
  185. end
  186.  
  187. end,
  188.  
  189. Paint = function(self, w, h)
  190. draw.RoundedBox(0, 0, 0, w, h, Color(48,10,36, 255))
  191. surface.SetDrawColor( Color( 200, 200, 200, 255 ) )
  192. surface.DrawOutlinedRect(0,0, w-1,h-1)
  193. surface.DrawOutlinedRect(0,0, w-1,25)
  194. end,
  195. Think = function(self, w, h)
  196. if (self:IsHovered()) then
  197.  
  198. end
  199. end
  200. }
  201.  
  202. vgui.Register("netmessagebox", net_message_box, "DFrame")
  203. -- net_message_box = vgui.Create("netmessagebox")
  204. -- net_message_box:setTextAndCount("net.Start('test')\nnet.SendToServer()")
  205.  
  206.  
  207.  
  208.  
  209. browser = {
  210. Init = function(self)
  211. self.W, self.H = self:GetSize()
  212. self:SetSize(self.W * 15, 555)
  213. self:ShowCloseButton(false)
  214. self:SetDraggable(true)
  215. self.gmodwiki = vgui.Create("DHTML", self)
  216. self.gmodwiki:OpenURL("http://wiki.garrysmod.com/page/Main_Page")
  217. self.gmodwiki.zoom = 100
  218. self.gmodwiki:Dock(FILL)
  219. self:SetTitle("")
  220. -- self:MakePopup()
  221.  
  222. local addressBar = vgui.Create( "DTextEntry", self ) -- create the form as a child of frame
  223. addressBar:SetPos( 60, 2 )
  224. addressBar:SetSize( 400, 25 )
  225. addressBar:SetText("http://wiki.garrysmod.com/page/Main_Page")
  226. addressBar.OnEnter = function( self1 )
  227. self.gmodwiki:OpenURL( self1:GetValue() ) -- print the form's text as server text
  228. end
  229.  
  230. local backBtn = vgui.Create( "DButton", self ) -- create the form as a child of frame
  231. backBtn:SetPos( 5, 2 )
  232. backBtn:SetSize( 25, 25 )
  233. backBtn:SetText("<")
  234. backBtn:SetTextColor(Color(255,255,255))
  235. backBtn.DoClick = function()
  236. self.gmodwiki:RunJavascript([[window.history.go(-1)]])
  237. end
  238.  
  239. backBtn.Paint = function(self, w, h)
  240. draw.RoundedBox(0, 0, 0, w, h, Color(57, 58, 49))
  241. end
  242.  
  243. local forwardBtn = vgui.Create( "DButton", self ) -- create the form as a child of frame
  244. forwardBtn:SetPos( 35, 2 )
  245. forwardBtn:SetSize( 25, 25 )
  246. forwardBtn:SetText(">")
  247. forwardBtn:SetTextColor(Color(255,255,255))
  248. forwardBtn.DoClick = function()
  249. self.gmodwiki:RunJavascript([[window.history.go(1)]])
  250. end
  251. forwardBtn.Paint = function(self, w, h)
  252. draw.RoundedBox(0, 0, 0, w, h, Color(57, 58, 49))
  253. end
  254.  
  255.  
  256. self.gmodwiki:RunJavascript([[
  257. String.prototype.startsWith = function(char){
  258. return this[0] == char;
  259. }
  260. ]]) -- pls update gmod's javascript engine
  261.  
  262.  
  263.  
  264. local zoomInBtn = vgui.Create( "DButton", self ) -- create the form as a child of frame
  265. zoomInBtn:SetPos( 465, 2 )
  266. zoomInBtn:SetSize( 45, 25 )
  267. zoomInBtn:SetText("Zoom in")
  268. zoomInBtn:SetTextColor(Color(255,255,255))
  269. zoomInBtn.DoClick = function()
  270. self.gmodwiki.zoom = self.gmodwiki.zoom + 10
  271. self.gmodwiki:RunJavascript("document.body.style.zoom = \"" .. tostring(self.gmodwiki.zoom) .. "%\";")
  272. end
  273. zoomInBtn.Paint = function(self, w, h)
  274. draw.RoundedBox(0, 0, 0, w, h, Color(57, 58, 49))
  275. end
  276.  
  277. local zoomOutBtn = vgui.Create( "DButton", self ) -- create the form as a child of frame
  278. zoomOutBtn:SetPos( 515, 2 )
  279. zoomOutBtn:SetSize( 45, 25 )
  280. zoomOutBtn:SetText("Zoom out")
  281. zoomOutBtn:SetTextColor(Color(255,255,255))
  282. zoomOutBtn.DoClick = function()
  283. self.gmodwiki.zoom = self.gmodwiki.zoom - 10
  284. self.gmodwiki:RunJavascript("document.body.style.zoom = \"" .. tostring(self.gmodwiki.zoom) .. "%\";")
  285. end
  286. zoomOutBtn.Paint = function(self, w, h)
  287. draw.RoundedBox(0, 0, 0, w, h, Color(57, 58, 49))
  288. end
  289.  
  290.  
  291. -- local closeBtn = vgui.Create( "DButton", self )
  292. -- closeBtn:SetText( "X" )
  293. -- closeBtn:SetPos( 575, 5 )
  294. -- closeBtn:SetSize( 20, 20 )
  295. -- closeBtn:SetTextColor(Color(255,255,255))
  296. -- closeBtn.DoClick = function()
  297. -- self.gmodwiki:RunJavascript([[document.getElementsByTagName("body")[0].style.zoom = "200%"]])
  298. -- timer.Simple(5, function()
  299. -- self:Close()
  300. -- end)
  301. -- end
  302. -- closeBtn.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(170, 37, 37)) end
  303.  
  304. self.Paint = function(self, w,h)
  305. draw.RoundedBox(0, 0, 0, w, h, Color(47, 48, 42, 255))
  306. end
  307. self.Think = function(self)
  308.  
  309. end
  310. end,
  311. }
  312. vgui.Register("browser", browser, "DFrame")
  313.  
  314. -- vgui.Create("browser")
  315.  
  316.  
  317.  
  318. local infoPopup = {
  319.  
  320. setInfoText = function(self, tab_name)
  321. -- print(self.infopopupTexts[tab_name].header)
  322. self.header:SetText(self.infopopupTexts[tab_name].header)
  323. self.infoText:SetText(self.infopopupTexts[tab_name].infoText)
  324. end,
  325.  
  326. Init = function(self)
  327.  
  328. self.infopopupTexts = {
  329. -- Tab = {header = "", infoText = ""},
  330. ExploitTab = {header = "Exploit Tab", infoText = "You can upload your exploits locally or to the web here. This tab is also responsible for finding every single net message name on the server you load this menu on and saves it locally so we can tell if other servers have common exploits"},
  331. NetLoggerTab = {header = "Net logger Tab", infoText = "Logs all the net messages that come through. Useful for things that you can easily interact with that sends net messages i.e NPCs"},
  332. RepeaterTab = {header = "Repeater Tab", infoText = "Repeats the given net messages"},
  333. interceptorTab = {header = "Intercepter Tab", infoText = "Repeats the given net messages"},
  334. LuaViewerTab = {header = "Lua viewer Tab", infoText = "View all the server's client side files here"},
  335. LuaEditorTab = {header = "Lua editor Tab", infoText = "Simple lua editor with a \"browser\" built in"}
  336. },
  337.  
  338.  
  339. self:SetTitle("")
  340. self:SetSize(350, 350)
  341. self:Center()
  342. self:MakePopup()
  343. self:ShowCloseButton(false)
  344.  
  345.  
  346. local closeBtn = vgui.Create( "DButton", self )
  347. closeBtn:SetText( "X" )
  348. closeBtn:SetPos( 325, 5 )
  349. closeBtn:SetSize( 20, 20 )
  350. closeBtn:SetTextColor(Color(255,255,255))
  351. closeBtn.DoClick = function() self:Close() end
  352. closeBtn.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(170, 37, 37)) end
  353.  
  354. self.header = vgui.Create("DLabel", self)
  355. self.header:SetFont("headerFont1")
  356. self.header:SetSize(150, 35)
  357. -- self.header:SetText("Exploits tab")
  358. self.header:Center()
  359. self.header.posX, self.header.posY = self.header:GetPos()
  360. self.header:SetPos(self.header.posX, 15)
  361.  
  362.  
  363. self.infoText = vgui.Create("DLabel", self)
  364. self.infoText:SetFont("infoFont")
  365. self.infoText:SetSize(320, 200)
  366. self.infoText:SetPos(30, 10)
  367.  
  368. -- self.infoText:SetText("You can upload your exploits locally or to the web here. This tab is also responsible for finding every single net message name on the server you load this menu on and saves it locally so we can tell if other servers have common exploits")
  369. self.infoText:SetWrap(true)
  370.  
  371.  
  372. self.footerText = vgui.Create("DLabel", self)
  373. self.footerText:SetFont("infoFont")
  374. self.footerText:SetSize(100, 20)
  375. self.footerText:Center()
  376. self.footerText.posX, self.footerText.posY = self.footerText:GetPos()
  377. self.footerText:SetPos(self.footerText.posX, 320)
  378.  
  379. self.footerText:SetText("Made by Riddle")
  380. self.footerText:SetWrap(true)
  381.  
  382. self.Paint = function(self,w,h)
  383. draw.RoundedBox(0, 0, 0, w, h, Color(39, 40, 34))
  384.  
  385. surface.SetDrawColor(Color(255,255,255))
  386. startX = 0
  387. endX = 350
  388. startY = 65
  389. endY = 65
  390. surface.DrawLine( startX, startY, endX, endY )
  391. DrawRainbowRectOutline(1, 0,0, w-1,h-1, 2)
  392. end
  393.  
  394. end,
  395.  
  396. }
  397.  
  398. vgui.Register("infoPopup", infoPopup, "DFrame")
  399.  
  400.  
  401. gmodWikiFrame = {
  402. Init = function(self)
  403. self:SetSize(700, 600)
  404.  
  405. self.gmodwiki = vgui.Create("DHTML", self)
  406. self.gmodwiki:Dock(FILL)
  407. self.gmodwiki:OpenURL("http://wiki.garrysmod.com/page/Main_Page")
  408.  
  409. end,
  410. }
  411.  
  412.  
  413. local CodeEditor = {
  414. setFill = function(self, b)
  415. if (b) then
  416. self:Dock(FILL)
  417. end
  418. end,
  419.  
  420. setText = function(self, text)
  421. self.html:RunJavascript("SetContent(" .. "'" .. text .. "')")
  422. end,
  423.  
  424. createButton = function(self)
  425.  
  426. self.runLuaBtn = vgui.Create("DButton", self.right)
  427. self.runLuaBtn:Dock(BOTTOM)
  428. self.runLuaBtn:SetTall(self.runLuaBtn:GetTall() * 1.5)
  429. self.runLuaBtn:SetText("Run lua")
  430. self.runLuaBtn.DoClick = function()
  431.  
  432. if (not self.currentCode) then
  433. print("[Warning] Nothing inside code editor")
  434. return
  435. end
  436. RunString(self.currentCode)
  437. end
  438. self.runLuaBtn:SetTextColor(Color(255,255,255))
  439. self.runLuaBtn.Paint = function(self, w, h)
  440. draw.RoundedBox(0, 0, 0, w, h, Color(57, 58, 49))
  441. end
  442.  
  443. end,
  444.  
  445. showButton = function(self, b)
  446. self.shouldHaveButton = b
  447. end,
  448.  
  449. Init = function(self)
  450. self.shouldHaveButton = true
  451. self:SetSize(250, 250)
  452.  
  453. -- self:SetPos(20, 30)
  454.  
  455.  
  456. self.right = vgui.Create("PANEL", self)
  457. self.right:Dock(FILL)
  458.  
  459. self.html = vgui.Create("DHTML", self.right)
  460. self.html:Dock(FILL)
  461. self.html:SetAllowLua(true)
  462. self.html:OpenURL("asset://garrysmod/lua/menu_plugins/luaviewer/index.html") --thx metastruct
  463. self.html:AddFunction("gmodinterface", "OnCode", function(code)
  464. self.currentCode = code
  465. end)
  466.  
  467. -- self.html:RunJavascript("SetContent(" .. "'" .. content .. "')")
  468.  
  469.  
  470.  
  471. self.html:AddFunction("gmodinterface", "DoLog", function(logstr) print("Log\t=\t", logstr) end)
  472. timer.Simple(0.1, function()
  473. if (self.shouldHaveButton) then
  474. self:createButton()
  475. else
  476. self.html:RunJavascript([[SetFontSize(10)]])
  477. end
  478. end)
  479. end
  480.  
  481. }
  482. vgui.Register("CodeEditor", CodeEditor, "DPanel")
  483.  
  484.  
  485. surface.CreateFont( "questionMarkFont", {
  486. font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  487. extended = false,
  488. size = 17,
  489. weight = 500,
  490. blursize = 0,
  491. scanlines = 0,
  492. antialias = true,
  493. underline = false,
  494. italic = false,
  495. strikeout = false,
  496. symbol = false,
  497. rotary = false,
  498. shadow = false,
  499. additive = false,
  500. outline = false,
  501. } )
  502.  
  503.  
  504. -- if (string.len(file.Read( "exploits.txt", "DATA" )) < 5) then
  505. -- default = {serversWithExploits = {}, exploits = {}, loggedServers = {}}
  506. -- file.Write( "exploits.txt", util.TableToJSON(default) )
  507. -- end
  508.  
  509. local net_message_table = {}
  510. local PANEL = {
  511. addToCatergory = function(self, netmsg, freq)
  512. local name = mysplit(netmsg, "\n")[1]
  513. if not net_message_table[name] then
  514. local Category = self.CategoryList:Add(name)
  515. Category:SetExpanded(false)
  516.  
  517. local countLabel = vgui.Create( "DLabel", Category )
  518. countLabel:SetFont("customFont2")
  519. countLabel:SetColor(Color(255,255,255))
  520. countLabel:SetPos( 280, 0 )
  521. countLabel:SetSize(200,16)
  522. countLabel:SetText("COUNT: 1")
  523.  
  524. net_message_box = vgui.Create("netmessagebox")
  525. net_message_box:Dock( TOP )
  526. net_message_box:setTextAndCount(netmsg, 1)
  527.  
  528.  
  529. DScrollPanel = vgui.Create( "DScrollPanel")
  530. Category:SetContents(DScrollPanel)
  531.  
  532. DScrollPanel:Add(net_message_box)
  533. DScrollPanel:Dock( FILL )
  534. -- 51.38.95.230:27015
  535.  
  536. net_message_table[name] = {panel = Category, count = 1, countLabel = countLabel, DScrollPanel = DScrollPanel}
  537. Category.Paint = function (s,w,h)
  538. draw.RoundedBox(0, 0, 0, w, h, Color(70,69,65))
  539. end
  540. else
  541. count = net_message_table[name].count + 1
  542. countLabel = net_message_table[name]["countLabel"]
  543. panel = net_message_table[name]["panel"]
  544. DScrollPanel = net_message_table[name]["DScrollPanel"]
  545.  
  546. net_message_table[name] = { panel = panel, count = count, countLabel = countLabel, DScrollPanel = DScrollPanel}
  547.  
  548. panel:SetLabel(name)
  549.  
  550. countLabel:SetFont("customFont2")
  551. countLabel:SetColor(Color(255,255,255))
  552. countLabel:SetPos( 280, 0 )
  553. countLabel:SetText("COUNT: " .. count)
  554.  
  555. net_message_box = vgui.Create("netmessagebox")
  556. net_message_box:setTextAndCount(netmsg, count)
  557. net_message_box:Dock( TOP )
  558. DScrollPanel:Add(net_message_box)
  559. DScrollPanel:Dock( FILL )
  560.  
  561. self.i = 0
  562.  
  563. end
  564. end,
  565.  
  566. DrawRainbowRectOutline = function(self, frequency, x, y, w, h )
  567. for i = x, x + w - 1 do
  568. surface.SetDrawColor( HSVToColor( i * frequency % 360, 1, 1 ) )
  569. surface.DrawLine( i, y, i + 1, y )
  570. surface.DrawLine( i, y + h - 1, i + 1, y + h )
  571. end
  572. for i = y, y + h - 1 do
  573. surface.SetDrawColor( HSVToColor( i * frequency % 360, 1, 1 ) )
  574. surface.DrawLine( x, i, x, i + 1 )
  575. surface.DrawLine( x + w - 1, i, x + w, i + 1 )
  576. end
  577. end,
  578.  
  579. Paint = function(self, w, h)
  580. draw.RoundedBox(0, 0, 0, w, h, Color(47, 48, 42, 255))
  581. self:DrawRainbowRectOutline(1,0,0, w-1,h-1, 2)
  582. end,
  583.  
  584. Think = function(self, w, h)
  585. self.W, self.H = self:GetSize()
  586. if (self.isFrameOpen) then
  587. self.openGmodWiki:SetVisible(true)
  588. else
  589. self.openGmodWiki:SetVisible(false)
  590. end
  591. self.W, self.H = w, h
  592. end
  593. }
  594.  
  595. function PANEL:IsOpen(b)
  596. self.isFrameOpen = b
  597. end
  598.  
  599.  
  600. function PANEL:Init()
  601. self.isFrameOpen = true
  602.  
  603. self.W, self.H = self:GetSize()
  604.  
  605. outside_self = self
  606. self:SetSize(400, 400)
  607. self:SetTitle("Riddle's menu")
  608. self:Center()
  609. self:SetVisible( true )
  610. self:SetDeleteOnClose(false)
  611. self.W, self.H = self:GetSize()
  612. self:ShowCloseButton(false)
  613.  
  614. self.currentTab = "ExploitTab"
  615.  
  616. local closeBtn = vgui.Create( "DButton", self )
  617. closeBtn:SetText( "X" )
  618. closeBtn:SetPos( self.W * 0.93, 5 )
  619. closeBtn:SetSize( 20, 20 )
  620. closeBtn:SetTextColor(Color(255,255,255))
  621. closeBtn.DoClick = function() self:Close() end
  622. closeBtn.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(170, 37, 37)) end
  623.  
  624. local infoBtn = vgui.Create( "DButton", self )
  625. infoBtn:SetText( "?" )
  626. infoBtn:SetFont("questionMarkFont")
  627. infoBtn:SetPos( self.W * 0.87, 5 )
  628. infoBtn:SetSize( 20, 20 )
  629. infoBtn:SetTextColor(Color(255,255,255))
  630. infoBtn.DoClick = function()
  631. infoPopup = vgui.Create("infoPopup")
  632. infoPopup:setInfoText(self.currentTab)
  633. end
  634. infoBtn.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(37, 37, 170)) end
  635.  
  636.  
  637.  
  638. sheet = vgui.Create( "DPropertySheet", self )
  639. sheet:SetPos(1, 20)
  640. sheet:SetSize(397, 376)
  641.  
  642. local exploitsPanel = vgui.Create( "DPanel", sheet )
  643. exploitsPanel:Dock(FILL)
  644.  
  645.  
  646. self.NetLoggerPanel = vgui.Create( "DPanel", sheet )
  647. self.NetLoggerPanel:Dock(FILL)
  648.  
  649. local repeaterPanel = vgui.Create( "DPanel", sheet )
  650. repeaterPanel:Dock(FILL)
  651.  
  652. -- local luaViewerPanel = vgui.Create( "DPanel", sheet )
  653. -- luaViewerPanel:Dock(FILL)
  654.  
  655. local luaEditorPanel = vgui.Create( "DPanel", sheet )
  656. luaEditorPanel:Dock(FILL)
  657.  
  658. -- ExploitsTab = sheet:AddSheet( "Exploits", exploitsPanel, "icon16/world.png" )
  659. NetLoggerTab = sheet:AddSheet( "Net Logger", self.NetLoggerPanel, "icon16/page_white_edit.png" )
  660. repeaterTab = sheet:AddSheet( "Repeater", repeaterPanel, "icon16/arrow_rotate_anticlockwise.png" )
  661. interceptorTab = sheet:AddSheet( "Intcepter", repeaterPanel, "icon16/lock_go.png" )
  662. --luaViewerTab = sheet:AddSheet( "Lua Viewer", luaViewerPanel, "icon16/folder.png", false, false, "See server's clientside files" )
  663. luaEditorTab = sheet:AddSheet( "Lua Editor", luaEditorPanel, "icon16/application_xp_terminal.png", false, false, "See server's clientside files" )
  664.  
  665.  
  666. self.NetLoggerPanel.Paint = function(s,w,h)
  667. draw.RoundedBox(0, 0, 0, w, h, Color(39, 40, 34))
  668. end
  669.  
  670. self.CategoryList = vgui.Create( "DCategoryList", self.NetLoggerPanel )
  671. self.CategoryList.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(39, 40, 34)) end
  672. self.CategoryList:Dock( FILL )
  673.  
  674. -- adding stuff to net_logger
  675. c = 0
  676. hook.Add( "RecvNetMsg", "netlogger2", function( netmsg )
  677. c = c + 1
  678. self:addToCatergory(netmsg, c)
  679. end )
  680.  
  681. -- creating the panels
  682. -- luaViewer = vgui.Create("luaviewer", luaViewerPanel)
  683. luaEditor = vgui.Create("CodeEditor", luaEditorPanel)
  684. luaEditor:setFill(true)
  685. --main_menu = vgui.Create("main_menu", exploitsPanel)
  686.  
  687. local browser = vgui.Create("browser", self)
  688. browser:SetPos(600,40)
  689. browser:SetVisible(false)
  690.  
  691. -- Detouring and resizeing the panels when you click on them
  692. -- DoClickExploitsTab = ExploitsTab.Tab.DoClick
  693. DoClickNetLoggerTab = NetLoggerTab.Tab.DoClick
  694. --DoClickrepeaterTab = luaViewerTab.Tab.DoClick
  695. DoClickLuaViewerTab = repeaterTab.Tab.DoClick
  696. DoClickluaEditorTab = luaEditorTab.Tab.DoClick
  697. DoClickincepterTab = interceptorTab.Tab.DoClick
  698.  
  699.  
  700. -- ExploitsTab.Tab.DoClick = function (...)
  701. -- -- outside_self:SizeTo(400, 600, 0.2, 0, 4)
  702. -- -- sheet:SetSize(397, 574)
  703. -- browser:SetVisible(false)
  704. -- outside_self:SizeTo(700, 600, 0.2, 0, 4)
  705. -- sheet:SetSize(697, 574)
  706.  
  707. -- timer.Create( "Center2", 0.1, 5, function() outside_self:Center() infoBtn:SetPos( self.W * 0.92, 5 ) closeBtn:SetPos(self.W * 0.96, 5) end )
  708. -- self.currentTab = "ExploitTab"
  709. -- DoClickExploitsTab(...)
  710. -- end
  711.  
  712.  
  713. NetLoggerTab.Tab.DoClick = function (...)
  714. outside_self:SizeTo(400, 400, 0.2, 0, 4)
  715. sheet:SetSize(397, 376)
  716.  
  717. -- closeBtn:SetPos(self.W * 0.95, 5)
  718.  
  719. timer.Create( "Center3", 0.1, 5, function() outside_self:Center() infoBtn:SetPos( self.W * 0.87, 2 ) closeBtn:SetPos(self.W * 0.93, 2) end )
  720. self.currentTab = "NetLoggerTab"
  721. DoClickNetLoggerTab(...)
  722. end
  723.  
  724. repeaterTab.Tab.DoClick = function (...)
  725. -- outside_self:SizeTo(400, 400, 0.2, 0, 4)
  726. -- sheet:SetSize(400, 379)
  727.  
  728. -- timer.Create( "Center2", 0.1, 5, function() outside_self:Center() infoBtn:SetPos( self.W * 0.87, 2 ) closeBtn:SetPos(self.W * 0.93, 2) end )
  729. -- self.currentTab = "RepeaterTab"
  730. -- DoClickrepeaterTab(...) -- stops the click from going through i.e wont switch when clicked
  731. end
  732.  
  733.  
  734. interceptorTab.Tab.DoClick = function (...)
  735. -- outside_self:SizeTo(400, 400, 0.2, 0, 4)
  736. -- sheet:SetSize(400, 379)
  737.  
  738. -- timer.Create( "Center2", 0.1, 5, function() outside_self:Center() infoBtn:SetPos( self.W * 0.87, 2 ) closeBtn:SetPos(self.W * 0.93, 2) end )
  739. -- self.currentTab = "interceptorTab"
  740. -- DoClickincepterTab(...) -- stops the click from going through i.e wont switch when clicked
  741. end
  742.  
  743. -- luaViewerTab.Tab.DoClick = function(...)
  744. -- outside_self:SizeTo(ScrW() * .95, ScrH() * .95, 0.2, 0, 4)
  745. -- sheet:SetSize(ScrW() * .95, ScrH() * .95)
  746. -- browser:SetVisible(false)
  747. -- timer.Create( "Center1", 0.1, 5, function() outside_self:Center() infoBtn:SetPos( self.W * 0.94, 5 ) closeBtn:SetPos(self.W * 0.97, 5) end )
  748.  
  749. -- self.currentTab = "LuaViewerTab"
  750. -- DoClickLuaViewerTab(...)
  751.  
  752. -- end
  753.  
  754.  
  755.  
  756. luaEditorTab.Tab.DoClick = function (...)
  757. outside_self:SizeTo(595, 600, 0.2, 0, 4)
  758. sheet:SetSize(592, 578)
  759.  
  760. -- outside_self:SizeTo(1200, 600, 0.2, 0, 4)
  761. -- sheet:SetSize(592, 578)
  762. browser:SetVisible(true)
  763. timer.Create( "Center4", 0.1, 5, function() outside_self:Center() infoBtn:SetPos( self.W * 0.90, 5 ) closeBtn:SetPos(self.W * 0.95, 5) end )
  764.  
  765. self.currentTab = "LuaEditorTab"
  766. DoClickluaEditorTab(...)
  767.  
  768. end
  769. self.OnClose = function() self:IsOpen(false) self.openGmodWiki:SetVisible(false) print("closing") gui.EnableScreenClicker(false) end
  770.  
  771.  
  772.  
  773.  
  774. self.openGmodWiki = vgui.Create("DButton", luaEditor)
  775. self.openGmodWiki:SetPos(575, 250)
  776. self.openGmodWiki:SetSize(15, 20)
  777. self.openGmodWiki:SetText(">")
  778. self.openGmodWiki:SetTextColor(Color(255,255,255))
  779. self.openGmodWiki.isOpen = false
  780. self.openGmodWiki.DoClick = function()
  781. self.openGmodWiki.isOpen = !self.openGmodWiki.isOpen
  782. if (self.openGmodWiki.isOpen) then
  783. outside_self:SizeTo(ScrW() * 0.99, 600, 0.2, 0, 4)
  784. self.openGmodWiki:SetText("<")
  785. else
  786. outside_self:SizeTo(595, 600, 0.2, 0, 4)
  787. self.openGmodWiki:SetText(">")
  788. end
  789.  
  790. sheet:SetSize(592, 578)
  791.  
  792.  
  793.  
  794. timer.Create( "Center4", 0.1, 20, function() outside_self:Center() end )
  795. end
  796.  
  797. self.openGmodWiki.Paint = function(self, w, h)
  798. -- 39 G: 40 B: 34
  799. draw.RoundedBox(0, 0, 0, w, h, Color(69, 70, 64))
  800. end
  801.  
  802.  
  803. self.Think = function()
  804. self.W, self.H = self:GetSize()
  805. -- print(self.W)
  806. end
  807.  
  808. end
  809.  
  810. vgui.Register("frame_handler", PANEL, "DFrame")
  811.  
  812. exploit_menu = vgui.Create("frame_handler")
  813. exploit_menu:MakePopup()
  814.  
  815. concommand.Add("_dbg", function()
  816. net.Start("test_message")
  817. net.SendToServer()
  818. end)
  819.  
  820. concommand.Add("_menu", function ()
  821. if (!exploit_menu) then
  822. exploit_menu = vgui.Create("frame_handler")
  823. end
  824. gui.EnableScreenClicker(true)
  825. exploit_menu:IsOpen(true)
  826. exploit_menu:MakePopup()
  827. exploit_menu:SetVisible( true )
  828. end)
Add Comment
Please, Sign In to add comment