413 lines
13 KiB
Lua
413 lines
13 KiB
Lua
gluesteak.include("code_editor.lua")
|
|
|
|
surface.CreateFont( "cf", {
|
|
font = "Javanese Text",
|
|
extended = false,
|
|
size = 43,
|
|
weight = 500,
|
|
blursize = 0,
|
|
scanlines = 0,
|
|
antialias = true,
|
|
underline = false,
|
|
italic = false,
|
|
strikeout = false,
|
|
symbol = false,
|
|
rotary = false,
|
|
shadow = false,
|
|
additive = false,
|
|
outline = false,
|
|
} )
|
|
|
|
function DrawRainbowRectOutline(frequency, x, y, w, h )
|
|
for i = x, x + w - 1 do
|
|
surface.SetDrawColor( HSVToColor( i * frequency % 360, 1, 1 ) )
|
|
surface.DrawLine( i, y, i + 1, y )
|
|
surface.DrawLine( i, y + h - 1, i + 1, y + h )
|
|
end
|
|
for i = y, y + h - 1 do
|
|
surface.SetDrawColor( HSVToColor( i * frequency % 360, 1, 1 ) )
|
|
surface.DrawLine( x, i, x, i + 1 )
|
|
surface.DrawLine( x + w - 1, i, x + w, i + 1 )
|
|
end
|
|
end
|
|
|
|
function join(t, sep)
|
|
if (#t == 1) then return t[1] end
|
|
str1 = ""
|
|
for _, v in pairs(t) do
|
|
str1 = str1 .. v .. sep
|
|
end
|
|
return str1
|
|
end
|
|
|
|
|
|
|
|
local uploadPopup = {
|
|
|
|
getExploitsFile = function() return util.JSONToTable( file.Read( "exploits.txt", "DATA" ) ) end,
|
|
|
|
|
|
getJSONServersWithExploitsObjectByIP = function(self, ip)
|
|
serversWithExploits = self:getExploitsFile().serversWithExploits
|
|
for i=1, #serversWithExploits do
|
|
if (serversWithExploits[i].ipaddress == ip) then return serversWithExploits[i] end
|
|
end
|
|
return false
|
|
end,
|
|
|
|
uploadLocally = function(self, exploitInfo)
|
|
exploit_file = file.Read( "exploits.txt", "DATA" )
|
|
if (string.len(exploit_file) == 0) then
|
|
file.Write( "exploits.txt", "{}" )
|
|
end
|
|
json_file = util.JSONToTable( exploit_file )
|
|
exploitInfo.script = string.gsub(exploitInfo.script, "%\n", "neww")
|
|
exploitInfo.script = string.gsub(exploitInfo.script, "%\r", "")
|
|
|
|
if (not self:getJSONServersWithExploitsObjectByIP(game.GetIPAddress())) then
|
|
new_tbl = {name = exploitInfo.name, ipaddress = exploitInfo.ipaddress, netMessage = exploitInfo.netMessage}
|
|
print(new_tbl)
|
|
table.insert(json_file.serversWithExploits, new_tbl)
|
|
else
|
|
-- table.insert(exploit.file.serversWithExploits[])
|
|
end
|
|
|
|
table.insert(json_file.exploits, {netMessage = exploitInfo.netMessage, author = exploitInfo.author, script = exploitInfo.script, description = exploitInfo.description, tags = exploitInfo.tags})
|
|
file.Write( "exploits.txt", util.TableToJSON(json_file) )
|
|
|
|
end,
|
|
|
|
|
|
|
|
getAllTextEntryValues = function(self)
|
|
return {
|
|
author = LocalPlayer():Name(),
|
|
server_name = self.serverNameTextEntry:GetValue(),
|
|
description = self.descTextEntry:GetValue(),
|
|
tags = {self.tag1Entry:GetValue(), self.tag2Entry:GetValue(), self.tag3Entry:GetValue()},
|
|
script = self.scriptEntry.currentCode ,
|
|
netMessage = self.netMessage:GetValue(),
|
|
ipaddress = self.ipTextEntry:GetValue()
|
|
}
|
|
end,
|
|
|
|
setValuesForFields = function(self, exploit_table)
|
|
self.authorText:SetText("Author: " .. exploit_table.author)
|
|
self.serverNameTextEntry:SetValue(exploit_table.server_name)
|
|
self.descTextEntry:SetValue(exploit_table.description)
|
|
|
|
self.tag1Entry:SetValue(exploit_table.tags[1])
|
|
self.tag2Entry:SetValue(exploit_table.tags[2])
|
|
self.tag3Entry:SetValue(exploit_table.tags[3])
|
|
-- print(exploit_table.script)
|
|
self.scriptEntry:setText(exploit_table.script)
|
|
PrintTable(exploit_table)
|
|
self.netMessage:SetValue(exploit_table.netMessage)
|
|
self.ipTextEntry:SetValue(join(exploit_table.servers_effected, ", "))
|
|
end,
|
|
|
|
|
|
|
|
setMode = function(self, mode)
|
|
self.mode = mode
|
|
end,
|
|
|
|
Init = function(self)
|
|
self._local = true
|
|
self.mode = "upload"
|
|
|
|
inSingleplayer = game.SinglePlayer()
|
|
if (game.GetIPAddress() == "loopback") then inSingleplayer = true end
|
|
|
|
self:SetTitle("")
|
|
self:SetSize(350, 350)
|
|
self:Center()
|
|
self:MakePopup()
|
|
self:ShowCloseButton(false)
|
|
|
|
|
|
self.authorText = vgui.Create("DLabel", self)
|
|
self.authorText:SetFont("cf")
|
|
self.authorText:SetText("Author: " .. LocalPlayer():Name())
|
|
self.authorText:SetSize(370, 20)
|
|
self.authorText:SetPos(0, 20)
|
|
self.authorText:SetContentAlignment( 5 )
|
|
-- game.GetIPAddress()
|
|
|
|
local ipText = vgui.Create("DLabel", self)
|
|
ipText:SetText("server ip: ")
|
|
ipText:SetSize(120, 20)
|
|
ipText:SetPos(10, 50)
|
|
|
|
local serverText = vgui.Create("DLabel", self)
|
|
serverText:SetText("server name: ")
|
|
serverText:SetSize(120, 20)
|
|
serverText:SetPos(10, 75)
|
|
|
|
|
|
self.serverNameTextEntry = vgui.Create( "DTextEntry", self )
|
|
self.serverNameTextEntry:SetSize( 230, 20 )
|
|
self.serverNameTextEntry:SetPos( 80, 75 )
|
|
|
|
if (inSingleplayer) then
|
|
self.serverNameTextEntry:SetValue("You're in singleplayer")
|
|
self.serverNameTextEntry:SetDisabled(true)
|
|
else
|
|
|
|
self.serverNameTextEntry:SetValue(GetHostName())
|
|
end
|
|
|
|
|
|
self.ipTextEntry = vgui.Create( "DTextEntry", self )
|
|
self.ipTextEntry:SetSize( 230, 20 )
|
|
self.ipTextEntry:SetPos( 80, 50 )
|
|
self.ipTextEntry:SetMultiline(true)
|
|
if (inSingleplayer) then
|
|
print("true")
|
|
self.ipTextEntry:SetValue("You're in singleplayer")
|
|
self.ipTextEntry:SetDisabled(true)
|
|
else
|
|
print("false")
|
|
self.ipTextEntry:SetValue(game.GetIPAddress())
|
|
end
|
|
|
|
self.ipTextEntry:SetPlaceholderText( "1.1.1.1:27015")
|
|
|
|
local descText = vgui.Create("DLabel", self)
|
|
descText:SetText("Description: ")
|
|
descText:SetSize(120, 20)
|
|
descText:SetPos(10, 100)
|
|
|
|
self.descTextEntry = vgui.Create( "DTextEntry", self )
|
|
self.descTextEntry:SetSize( 230, 20 )
|
|
self.descTextEntry:SetPos( 80, 100 )
|
|
self.descTextEntry:SetMultiline(true)
|
|
self.descTextEntry:SetPlaceholderText( "Description about exploit" )
|
|
|
|
local tagText = vgui.Create("DLabel", self)
|
|
tagText:SetText("Tags: ")
|
|
tagText:SetSize(120, 20)
|
|
tagText:SetPos(10, 126)
|
|
|
|
self.tag1Entry = vgui.Create( "DTextEntry", self )
|
|
self.tag1Entry:SetSize( 76, 20 )
|
|
self.tag1Entry:SetPos( 80, 125 )
|
|
self.tag1Entry:SetMultiline(true)
|
|
self.tag1Entry:SetPlaceholderText( "money" )
|
|
|
|
self.tag2Entry = vgui.Create( "DTextEntry", self )
|
|
self.tag2Entry:SetSize( 76, 20 )
|
|
self.tag2Entry:SetPos( 156, 125 )
|
|
self.tag2Entry:SetMultiline(true)
|
|
self.tag2Entry:SetPlaceholderText( "hitman" )
|
|
|
|
self.tag3Entry = vgui.Create( "DTextEntry", self )
|
|
self.tag3Entry:SetSize( 76, 20 )
|
|
self.tag3Entry:SetPos( 232, 125 )
|
|
self.tag3Entry:SetMultiline(true)
|
|
self.tag3Entry:SetPlaceholderText( "health" )
|
|
-- TextEntry.OnEnter = function( self )
|
|
|
|
|
|
|
|
|
|
scriptText = vgui.Create("DLabel", self)
|
|
scriptText:SetText("Script: ")
|
|
scriptText:SetSize(120, 20)
|
|
scriptText:SetPos(10, 220)
|
|
|
|
|
|
self.scriptEntry = vgui.Create( "CodeEditor", self )
|
|
self.scriptEntry:showButton(false)
|
|
self.scriptEntry:SetSize( 230, 140 )
|
|
self.scriptEntry:SetPos( 80, 180 )
|
|
self.scriptEntry:SetMultiline(true)
|
|
-- self.scriptEntry:SetPlaceholderText(placeholder)
|
|
|
|
self.netMessage = vgui.Create( "DTextEntry", self )
|
|
self.netMessage:SetSize( 230, 20 )
|
|
self.netMessage:SetPos( 80, 150 )
|
|
self.netMessage:SetMultiline(true)
|
|
self.netMessage:SetPlaceholderText( "net message name, i.e net.Start(\"BuyHealth\")" )
|
|
|
|
|
|
local closeBtn = vgui.Create( "DButton", self )
|
|
closeBtn:SetText( "X" )
|
|
closeBtn:SetPos( 325, 5 )
|
|
closeBtn:SetSize( 20, 20 )
|
|
closeBtn:SetTextColor(Color(255,255,255))
|
|
closeBtn.DoClick = function() self:Close() end
|
|
closeBtn.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(170, 37, 37)) end
|
|
|
|
timer.Simple(0.1, function()
|
|
if (self.mode != "preview") then
|
|
local uploadBtn = vgui.Create( "DButton", self )
|
|
|
|
uploadBtn:SetPos( 80, 325 )
|
|
uploadBtn:SetSize( 230, 20 )
|
|
uploadBtn:SetTextColor(Color(255,255,255))
|
|
-- if (inSingleplayer) then uploadBtn:SetCursor("no") uploadBtn:SetDisabled(true) end
|
|
uploadBtn.DoClick = function() self:Close() end
|
|
uploadBtn.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(140, 70, 0)) end
|
|
|
|
if (self._local) then
|
|
uploadBtn:SetText( "Upload to local" )
|
|
uploadBtn.DoClick = function()
|
|
all_fields = self:getAllTextEntryValues()
|
|
self:uploadLocally(all_fields)
|
|
self:Close() end
|
|
end
|
|
else
|
|
|
|
|
|
|
|
local viewAllExploits = vgui.Create( "DButton", self )
|
|
|
|
viewAllExploits:SetPos( 80, 325 )
|
|
viewAllExploits:SetSize( 230, 20 )
|
|
viewAllExploits:SetTextColor(Color(0,0,0))
|
|
-- if (inSingleplayer) then uploadBtn:SetCursor("no") uploadBtn:SetDisabled(true) end
|
|
viewAllExploits.DoClick = function() self:Close() end
|
|
viewAllExploits.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(210, 210, 210)) end
|
|
|
|
if (self._local) then
|
|
viewAllExploits:SetText( "View all exploits (" .. "0" .. ")" )
|
|
viewAllExploits.DoClick = function()
|
|
all_fields = self:getAllTextEntryValues()
|
|
self:uploadLocally(all_fields)
|
|
self:Close() end
|
|
end
|
|
|
|
|
|
end
|
|
end)
|
|
|
|
|
|
self.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(39, 40, 34)) DrawRainbowRectOutline(1, 0,0, w-1,h-1, 2)end
|
|
end
|
|
}
|
|
|
|
local viewAllExploitsPopup = {
|
|
}
|
|
|
|
surface.CreateFont( "headerFont1", {
|
|
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
|
extended = false,
|
|
size = 25,
|
|
weight = 500,
|
|
blursize = 0,
|
|
scanlines = 0,
|
|
antialias = true,
|
|
underline = false,
|
|
italic = false,
|
|
strikeout = false,
|
|
symbol = false,
|
|
rotary = false,
|
|
shadow = false,
|
|
additive = false,
|
|
outline = false,
|
|
} )
|
|
|
|
|
|
surface.CreateFont( "infoFont", {
|
|
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
|
extended = false,
|
|
size = 15,
|
|
weight = 500,
|
|
blursize = 0,
|
|
scanlines = 0,
|
|
antialias = true,
|
|
underline = false,
|
|
italic = false,
|
|
strikeout = false,
|
|
symbol = false,
|
|
rotary = false,
|
|
shadow = false,
|
|
additive = false,
|
|
outline = false,
|
|
} )
|
|
|
|
|
|
local infoPopup = {
|
|
|
|
setInfoText = function(self, tab_name)
|
|
-- print(self.infopopupTexts[tab_name].header)
|
|
self.header:SetText(self.infopopupTexts[tab_name].header)
|
|
self.infoText:SetText(self.infopopupTexts[tab_name].infoText)
|
|
end,
|
|
|
|
Init = function(self)
|
|
|
|
self.infopopupTexts = {
|
|
-- Tab = {header = "", infoText = ""},
|
|
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"},
|
|
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"},
|
|
RepeaterTab = {header = "Repeater Tab", infoText = "Repeats the given net messages"},
|
|
interceptorTab = {header = "Intercepter Tab", infoText = "Repeats the given net messages"},
|
|
LuaViewerTab = {header = "Lua viewer Tab", infoText = "View all the server's client side files here"},
|
|
LuaEditorTab = {header = "Lua editor Tab", infoText = "Simple lua editor with a \"browser\" built in"}
|
|
},
|
|
|
|
|
|
self:SetTitle("")
|
|
self:SetSize(350, 350)
|
|
self:Center()
|
|
self:MakePopup()
|
|
self:ShowCloseButton(false)
|
|
|
|
|
|
local closeBtn = vgui.Create( "DButton", self )
|
|
closeBtn:SetText( "X" )
|
|
closeBtn:SetPos( 325, 5 )
|
|
closeBtn:SetSize( 20, 20 )
|
|
closeBtn:SetTextColor(Color(255,255,255))
|
|
closeBtn.DoClick = function() self:Close() end
|
|
closeBtn.Paint = function(self,w,h) draw.RoundedBox(0, 0, 0, w, h, Color(170, 37, 37)) end
|
|
|
|
self.header = vgui.Create("DLabel", self)
|
|
self.header:SetFont("headerFont1")
|
|
self.header:SetSize(150, 35)
|
|
-- self.header:SetText("Exploits tab")
|
|
self.header:Center()
|
|
self.header.posX, self.header.posY = self.header:GetPos()
|
|
self.header:SetPos(self.header.posX, 15)
|
|
|
|
|
|
self.infoText = vgui.Create("DLabel", self)
|
|
self.infoText:SetFont("infoFont")
|
|
self.infoText:SetSize(320, 200)
|
|
self.infoText:SetPos(30, 10)
|
|
|
|
-- 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")
|
|
self.infoText:SetWrap(true)
|
|
|
|
|
|
self.footerText = vgui.Create("DLabel", self)
|
|
self.footerText:SetFont("infoFont")
|
|
self.footerText:SetSize(100, 20)
|
|
self.footerText:Center()
|
|
self.footerText.posX, self.footerText.posY = self.footerText:GetPos()
|
|
self.footerText:SetPos(self.footerText.posX, 320)
|
|
|
|
self.footerText:SetText("Made by Riddle")
|
|
self.footerText:SetWrap(true)
|
|
|
|
self.Paint = function(self,w,h)
|
|
draw.RoundedBox(0, 0, 0, w, h, Color(39, 40, 34))
|
|
|
|
surface.SetDrawColor(Color(255,255,255))
|
|
startX = 0
|
|
endX = 350
|
|
startY = 65
|
|
endY = 65
|
|
surface.DrawLine( startX, startY, endX, endY )
|
|
DrawRainbowRectOutline(1, 0,0, w-1,h-1, 2)
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
vgui.Register("infoPopup", infoPopup, "DFrame")
|
|
-- vgui.Create("infoPopup")
|
|
vgui.Register("popup", uploadPopup, "DFrame") |