mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
29
lua/e_protect/modules/sv_detectionlogger.lua
Normal file
29
lua/e_protect/modules/sv_detectionlogger.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local punished = {}
|
||||
|
||||
eProtect.logDetectionHandeler = function(ply, reason, info, type, additional_info)
|
||||
if eProtect.data.general["bypassgroup"][ply:GetUserGroup()] or eProtect.config["disabledModules"]["detection_log"] then return end
|
||||
local sid, sid64 = ply:SteamID(), ply:SteamID64()
|
||||
|
||||
if eProtect.data.general["bypass_sids"][sid] or eProtect.data.general["bypass_sids"][sid64] then return end
|
||||
|
||||
if punished[sid] and CurTime() < punished[sid] then return end
|
||||
punished[sid] = CurTime() + eProtect.data.general.timeout + 1
|
||||
|
||||
local name, sid64 = ply:Nick(), ply:SteamID64()
|
||||
|
||||
eProtect.logDetection(name, sid64, reason, info, type, additional_info)
|
||||
end
|
||||
|
||||
if eProtect.queueNetworking then
|
||||
eProtect.queueNetworking(nil, "punishmentLogging")
|
||||
end
|
||||
50
lua/e_protect/modules/sv_exploitpatcher.lua
Normal file
50
lua/e_protect/modules/sv_exploitpatcher.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
eProtect = eProtect or {}
|
||||
eProtect.data = eProtect.data or {}
|
||||
eProtect.data.exploitPatcher = eProtect.data.exploitPatcher or {}
|
||||
|
||||
eProtect.patcher = eProtect.patcher or {}
|
||||
|
||||
local function addExploitPatch(str, func)
|
||||
eProtect.patcher[str] = func
|
||||
eProtect.data.exploitPatcher[str] = true
|
||||
end
|
||||
|
||||
addExploitPatch("start_wd_emp", function(ply)
|
||||
if IsValid(ply) and ply:IsPlayer() then
|
||||
local wep = ply:GetActiveWeapon()
|
||||
if !IsValid(wep) or wep:GetClass() ~= "weapon_hack_phone" then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
addExploitPatch("gPrinters.removePrinter", function(ply)
|
||||
if IsValid(ply) and ply:IsPlayer() then
|
||||
return ply:IsSuperAdmin()
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("eP:PreNetworking", "eP:ExploitPatches", function(ply, netstring, len)
|
||||
if eProtect.patcher[netstring] and isfunction(eProtect.patcher[netstring]) and !eProtect.config["disabledModules"]["exploit_patcher"] then
|
||||
local result = eProtect.patcher[netstring](ply)
|
||||
|
||||
if result == false then
|
||||
eProtect.logDetectionHandeler(ply, "patched-exploit", netstring, 2)
|
||||
eProtect.punish(ply, 2, slib.getLang("eprotect", eProtect.config["language"], "banned-exploit-attempt"))
|
||||
return false end
|
||||
end
|
||||
end)
|
||||
|
||||
if eProtect.queueNetworking then
|
||||
eProtect.queueNetworking(nil, "exploitPatcher")
|
||||
end
|
||||
60
lua/e_protect/modules/sv_fakenets.lua
Normal file
60
lua/e_protect/modules/sv_fakenets.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
eProtect = eProtect or {}
|
||||
eProtect.data = eProtect.data or {}
|
||||
eProtect.data.fakeNets = eProtect.data.fakeNets or {}
|
||||
|
||||
local generatedOnes = {}
|
||||
|
||||
eProtect.getRandUniqueNum = function()
|
||||
local rand = math.random(1, 999999)
|
||||
if generatedOnes[rand] then return eProtect.getRandUniqueNum() end
|
||||
generatedOnes[rand] = true
|
||||
|
||||
return rand
|
||||
end
|
||||
|
||||
eProtect.createFakeNets = function()
|
||||
if eProtect.config["disabledModules"]["fake_exploits"] then return end
|
||||
|
||||
local createdNets = 0
|
||||
local maxFakeNets = 3
|
||||
|
||||
local mixedTbl = {}
|
||||
|
||||
for k,v in pairs(eProtect.data.badNets) do
|
||||
mixedTbl[eProtect.getRandUniqueNum()] = k
|
||||
end
|
||||
|
||||
for k, netstring in pairs(mixedTbl) do
|
||||
local validateNet = tobool(util.NetworkStringToID(netstring))
|
||||
if validateNet then continue end
|
||||
createdNets = createdNets + 1
|
||||
|
||||
eProtect.data.fakeNets[netstring] = eProtect.data.fakeNets[netstring] or eProtect.data.badNets[netstring]
|
||||
eProtect.data.fakeNets[netstring].enabled = true
|
||||
util.AddNetworkString(netstring)
|
||||
|
||||
net.Receive(netstring, function(_, ply)
|
||||
eProtect.logDetectionHandeler(ply, "fake-exploit", netstring, 2)
|
||||
eProtect.punish(ply, 2, slib.getLang("eprotect", eProtect.config["language"], "banned-net-exploitation"))
|
||||
end)
|
||||
|
||||
if maxFakeNets > 0 and (createdNets >= maxFakeNets) then break end
|
||||
end
|
||||
|
||||
if eProtect.queueNetworking then
|
||||
eProtect.queueNetworking(nil, "fakeNets")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
eProtect.createFakeNets()
|
||||
13
lua/e_protect/modules/sv_httplogger.lua
Normal file
13
lua/e_protect/modules/sv_httplogger.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
hook.Add("eP:PostHTTP", "eP:HTTPLoggingHandeler", function(url, type)
|
||||
eProtect.logHTTP(url, type)
|
||||
end)
|
||||
31
lua/e_protect/modules/sv_iplogger.lua
Normal file
31
lua/e_protect/modules/sv_iplogger.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local function handleIPLoggin(ply, ip)
|
||||
local sid64 = ply:SteamID64()
|
||||
http.Fetch("http://ip-api.com/json/"..ip, function(json)
|
||||
json = util.JSONToTable(json)
|
||||
local result = json["countryCode"]
|
||||
|
||||
if !result then result = "N/A" end
|
||||
|
||||
eProtect.registerIP(sid64, ip, result)
|
||||
end, function()
|
||||
eProtect.registerIP(sid64, ip, "N/A")
|
||||
end)
|
||||
end
|
||||
|
||||
hook.Add("PlayerInitialSpawn", "eP:IPLogging", function(ply)
|
||||
if ply:IsBot() or eProtect.config["disabledModules"]["identifier"] then return end
|
||||
local plyIP = ply:IPAddress()
|
||||
local ip = string.sub(plyIP, 1, string.find(plyIP, ":") - 1)
|
||||
|
||||
handleIPLoggin(ply, ip)
|
||||
end)
|
||||
78
lua/e_protect/modules/sv_netlimiter.lua
Normal file
78
lua/e_protect/modules/sv_netlimiter.lua
Normal file
@@ -0,0 +1,78 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
eProtect = eProtect or {}
|
||||
eProtect.data = eProtect.data or {}
|
||||
eProtect.data.netLimitation = eProtect.data.netLimitation or {}
|
||||
|
||||
for i = 1, 2048 do
|
||||
local netstring = util.NetworkIDToString(i)
|
||||
if !netstring then continue end
|
||||
if netstring and isstring(netstring) and eProtect.data.netLimitation[netstring] == nil and !eProtect.data.fakeNets[netstring] then
|
||||
local func = net.Receivers[string.lower(netstring)]
|
||||
if func then eProtect.data.netLimitation[netstring] = 0 end
|
||||
end
|
||||
end
|
||||
|
||||
if eProtect.queueNetworking then
|
||||
eProtect.queueNetworking(nil, "netLimitation")
|
||||
end
|
||||
|
||||
local generalCounter = {}
|
||||
local specificCounter = {}
|
||||
local timeout = {}
|
||||
|
||||
hook.Add("eP:PreNetworking", "eP:NetLimiter", function(ply, netstring, len)
|
||||
if !eProtect.data or !eProtect.data.general or eProtect.data.netLimitation[netstring] == -1 or eProtect.config["disabledModules"]["net_limiter"] then return end
|
||||
|
||||
if !eProtect.data.netLimitation[netstring] then
|
||||
local func = net.Receivers[string.lower(netstring)]
|
||||
if func then eProtect.data.netLimitation[netstring] = 0 end
|
||||
|
||||
eProtect.queueNetworking(nil, "netLimitation")
|
||||
end
|
||||
|
||||
local sid, sid64 = ply:SteamID(), ply:SteamID64()
|
||||
local specific = eProtect.data.netLimitation[netstring] ~= nil and eProtect.data.netLimitation[netstring] > 0 or false
|
||||
|
||||
specificCounter[sid] = specificCounter[sid] or {}
|
||||
|
||||
if !timeout[sid] then timeout[sid] = CurTime() end
|
||||
|
||||
if timeout[sid] and ((CurTime() - timeout[sid]) >= eProtect.data.general.timeout) then
|
||||
specificCounter[sid] = {}
|
||||
generalCounter[sid] = 0
|
||||
timeout[sid] = nil
|
||||
end
|
||||
|
||||
if specific then
|
||||
specificCounter[sid][netstring] = specificCounter[sid][netstring] or 0
|
||||
specificCounter[sid][netstring] = specificCounter[sid][netstring] + 1
|
||||
else
|
||||
generalCounter[sid] = generalCounter[sid] or 0
|
||||
generalCounter[sid] = generalCounter[sid] + 1
|
||||
end
|
||||
|
||||
local counter = specific and specificCounter[sid][netstring] or generalCounter[sid]
|
||||
local limit = specific and eProtect.data.netLimitation[netstring] or eProtect.data.general.ratelimit
|
||||
if limit > -1 and counter > limit and eProtect.data.general.overflowpunishment > 0 and !eProtect.data.general["bypassgroup"][ply:GetUserGroup()] and !eProtect.data.general["bypass_sids"][sid] and !eProtect.data.general["bypass_sids"][sid64] then
|
||||
if eProtect.data.general["whitelistergroup"][ply:GetUserGroup()] then
|
||||
eProtect.data.netLimitation[netstring] = -1
|
||||
eProtect.queueNetworking(nil, "netLimitation")
|
||||
return end
|
||||
|
||||
eProtect.logDetectionHandeler(ply, "net-overflow", netstring, eProtect.data.general.overflowpunishment)
|
||||
if eProtect.data.general.overflowpunishment <= 2 then
|
||||
eProtect.punish(ply, eProtect.data.general.overflowpunishment, slib.getLang("eprotect", eProtect.config["language"], eProtect.data.general.overflowpunishment == 1 and "kick-net-overflow" or "banned-net-overflow"))
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
end)
|
||||
31
lua/e_protect/modules/sv_netlogger.lua
Normal file
31
lua/e_protect/modules/sv_netlogger.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
eProtect = eProtect or {}
|
||||
eProtect.data = eProtect.data or {}
|
||||
eProtect.data.netLogging = eProtect.data.netLogging or {}
|
||||
|
||||
hook.Add("eP:PostNetworking", "eP:LogNetworking", function(ply, net, len)
|
||||
if !net or len == nil or eProtect.config["disabledModules"]["net_logger"] then return end
|
||||
eProtect.data.netLogging[net] = eProtect.data.netLogging[net] or {called = 0, len = 0, playercalls = {}}
|
||||
|
||||
eProtect.data.netLogging[net].called = eProtect.data.netLogging[net].called + 1
|
||||
eProtect.data.netLogging[net].len = eProtect.data.netLogging[net].len + len
|
||||
|
||||
if IsValid(ply) and ply:IsPlayer() then
|
||||
local sid = ply:SteamID()
|
||||
eProtect.data.netLogging[net].playercalls[sid] = eProtect.data.netLogging[net].playercalls[sid] or 0
|
||||
eProtect.data.netLogging[net].playercalls[sid] = eProtect.data.netLogging[net].playercalls[sid] + 1
|
||||
end
|
||||
|
||||
if eProtect.queueNetworking then
|
||||
eProtect.queueNetworking(nil, "netLogging")
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user