forked from HexaneNetworks/Gmod.NetLibraryDebug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhexanenetlibrarydebug.lua
More file actions
118 lines (83 loc) · 4.75 KB
/
hexanenetlibrarydebug.lua
File metadata and controls
118 lines (83 loc) · 4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
-- Gmod Net Library Debug
-- https://github.com/HexaneNetworks/gmod-netlibrary-debug
-- v2.3
-- October 2020
hexanenetlibrarydebug = hexanenetlibrarydebug or {}
hexanenetlibrarydebug.antiNetSpam = {}
hexanenetlibrarydebug.flaggedNetPlayers = {}
hexanenetlibrarydebug.antiConSpam = {}
hexanenetlibrarydebug.flaggedConPlayers = {}
hexanenetlibrarydebug.threshold = 20
hexanenetlibrarydebug.net = {
"UKT_MOMOS", "Sandbox_ArmDupe", "Fix_Keypads", "memeDoor",
"Remove_Exploiters", "noclipcloakaesp_chat_text", "fellosnake", "NoNerks",
"BackDoor", "kek", "OdiumBackDoor", "cucked", "ULogs_Info", "Ulib_Message",
"m9k_addons", "Sbox_itemstore", "rcivluz", "Sbox_darkrp", "_Defqon", "something",
"random", "strip0", "killserver", "DefqonBackdoor", "fuckserver", "cvaraccess",
"rconadmin", "_CAC_ReadMemory", "nostrip", "DarkRP_AdminWeapons",
"enablevac", "SessionBackdoor", "LickMeOut", "MoonMan", "Im_SOCool", "fix",
"idk", "ULXQUERY2", "ULX_QUERY2", "jesuslebg", "zilnix", "Þà ?D)◘",
"disablebackdoor", "oldNetReadData", "SENDTEST", "Sandbox_GayParty",
"nocheat", "_clientcvars", "_main", "ZimbaBackDoor", "stream", "waoz", "DarkRP_UTF8",
"bdsm", "ZernaxBackdoor", "anticrash", "audisquad_lua", "dontforget", "noprop", "thereaper",
"0x13"
}
timer.Create("hexanenetlibrarydebug.CleanSpam", 1,0, function()
hexanenetlibrarydebug.antiNetSpam = {}
hexanenetlibrarydebug.flaggedNetPlayers = {}
hexanenetlibrarydebug.antiConSpam = {}
hexanenetlibrarydebug.flaggedConPlayers = {}
end)
function net.Incoming(len, client)
local i = net.ReadHeader()
local name = util.NetworkIDToString(i)
if not name then
return
end
local plySteamid = IsValid(client) and client:SteamID() or "UNKNOWN STEAMID"
local plyNick = IsValid(client) and client:Nick() or "UNKNOWN PLAYER NAME"
local plyIP = IsValid(client) and client:IPAddress() or "UNKNOWN IP"
local antiNetSpam = hexanenetlibrarydebug.antiNetSpam
local flaggedNetPlayers = hexanenetlibrarydebug.flaggedNetPlayers
antiNetSpam[plySteamid] = antiNetSpam[plySteamid] or {}
antiNetSpam[plySteamid][name] = (antiNetSpam[plySteamid][name] or 0) + 1
if antiNetSpam[plySteamid][name] > hexanenetlibrarydebug.threshold then
if not flaggedNetPlayers[plySteamid] then
ServerLog(string.format("Net spam attempted on Net Message: %s Client: %s (STEAMID: %s) (IP: %s) \n", name, plyNick, plySteamid, plyIP))
end
flaggedNetPlayers[plySteamid] = true
end
local func = net.Receivers[name:lower()]
if not func then
ServerLog(string.format("No receiving function for '%s' (net msg #%d) Client: %s (STEAMID: %s) (IP: %s) \n", name, i, plyNick, plySteamid, plyIP))
return
end
len = len - 16
local curString = !table.HasValue(hexanenetlibrarydebug.net, name) and "Net message '%s' (%d) received (%.2fkb (%db)) Client: %s (STEAMID: %s) (IP: %s) \n" or "Net message '%s' (%d) received (%.2fkb (%db)) Client: %s (STEAMID: %s) (IP: %s) [ Exploitable String ] \n"
ServerLog(string.format(curString, name, i, len/8/1024, len/8, plyNick, plySteamid, plyIP))
local status, error = pcall( function() func(len, client) end )
if not status then
ServerLog(string.format("Error during net message (%s). Reasoning: %s \n", name, error))
end
end
hexanenetlibrarydebug.crun = hexanenetlibrarydebug.crun or concommand.Run
function concommand.Run(ply, cmd, args, argStr)
if !IsValid(ply) then return hexanenetlibrarydebug.crun(ply,cmd,args,argStr) end
if !cmd then return hexanenetlibrarydebug.crun(ply,cmd,args,argStr) end
local plySteamid = IsValid(ply) and ply:SteamID() or "UNKNOWN STEAMID"
local plyNick = IsValid(ply) and ply:Nick() or "UNKNOWN PLAYER NAME"
local plyIP = IsValid(ply) and ply:IPAddress() or "UNKNOWN IP"
local antiConSpam = hexanenetlibrarydebug.antiConSpam
local flaggedConPlayers = hexanenetlibrarydebug.flaggedConPlayers
antiConSpam[plySteamid] = antiConSpam[plySteamid] or {}
antiConSpam[plySteamid][cmd] = (antiConSpam[plySteamid][cmd] or 0) + 1
local temp = (args and args ~= "" and #args != 0) and " "..table.concat(args, " ") or "None"
if antiConSpam[plySteamid][cmd] > 10 then
if not flaggedConPlayers[plySteamid] then
ServerLog("Player " .. "'"..plyNick.."'" .. " ("..plySteamid.. ") " .. "("..plyIP..")" .. " has attempted to concommand spam with command: " .. cmd .. " args: " .. temp .. ". \n")
end
flaggedConPlayers[plySteamid] = true
end
ServerLog("Player " .. "'"..plyNick.."'" .. " ("..plySteamid.. ") " .. "("..plyIP..")" .. " has executed this command: " .. cmd .. " args: " .. temp .. ". \n")
return hexanenetlibrarydebug.crun(ply, cmd, args,argStr)
end