Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Identify Naughty Clients
- // mercior
- // June 2010
- local NAUGHTY_PLAYER = false
- local function DrawNaughty()
- if NAUGHTY_PLAYER then
- surface.SetDrawColor( 0, 0, 0, 255)
- surface.DrawRect(0 , 0, ScrW(), ScrH() )
- draw.DrawText("You appear to be cheating!\nYou have been automatically banned.\n", "HUDNumber5", ScrW() / 2, ScrH() / 2, Color(255, 0, 0, 255), 1)
- end
- end
- hook.Add("HUDPaint", "block_Kx34t8", DrawNaughty)
- require("wshl")
- require("sh2")
- require("hl2_shotmanip")
- local function CheckSE()
- // look for common bacon convars
- //if ConVarExists("Bacon_load") or ConVarExists("espmode") or ConVarExists("espweaponon") or ConVarExists("Bacon_Enemy_Compensation") then
- // NAUGHTY_PLAYER = true
- // Msg("\n\n Cheat -- ConVar 'Bacon_load' \n\n")
- // datastream.StreamToServer("GWCheatNotify_Kx34t8", { id="bb", reason="ConVar" })
- //end
- // look for SQL tables
- if sql.TableExists("Bacon_ESPEnts") then
- NAUGHTY_PLAYER = true
- Msg("\n\n Cheat -- SQL Table \n\n")
- datastream.StreamToServer("GWCheatNotify_Kx34t8", { id="bb", reason="SQL Table" })
- end
- // look for dll functions
- if hl2_shotmanip then
- NAUGHTY_PLAYER = true
- Msg("\n\n Cheat -- DLL \n\n")
- datastream.StreamToServer("GWCheatNotify_Kx34t8", { id="bb", reason="DLL" })
- end
- // look for naughty modules
- if sh2 || wshl then
- NAUGHTY_PLAYER = true
- Msg("\n\n Cheat -- DLL \n\n")
- datastream.StreamToServer("GWCheatNotify_Kx34t8", { id="sh", reason="DLL" })
- end
- end
- timer.Create( "GWNoCheatTimer_Kx34t8", 120, 0, CheckSE )
- CheckSE();
- /*
- // Anti- Tranquilitiy steamid spoofing
- require("gatekeeper")
- TranqUsers = {}
- TranqNextThink = CurTime()
- TranqEnabled = true // we assume we're connected to steam when we launch
- // how long to wait for an approval callback before kicking the client
- // 10 can be too short (it's proven too short on GMT, at least)
- // but in my experience most clients are approved within seconds of joining
- TranqTimeout = CreateConVar("at_timeout", "30", FCVAR_NOTIFY)
- local function KickUser(steam, reason)
- local tranqTable = TranqUsers[steam] // tranqTable should never be nil
- local userId = gatekeeper.GetUserByAddress(tranqTable.IP)
- if userId then
- gatekeeper.Drop(userId, "SteamID validation failed (" .. tostring( reason ) .. ")\n")
- end
- TranqUsers[steam] = nil
- end
- // this hook is called when the server (re)connects to steam
- hook.Add("GSSteamConnected", "AntiTranqConnected", function()
- TranqEnabled = true
- Msg("Connected to Steam! Anti-Tranquility enabled.\n")
- end)
- // this hook gets called when the server loses it's connection to steam
- hook.Add("GSSteamDisconnected", "AntiTranqDisconnected", function(reason)
- TranqEnabled = false
- TranqUsers = {}
- Msg("Disconnected from Steam: ", reason, ", Anti-Tranquility disabled.\n")
- end)
- // client is approved by the backend
- // this is called within a few seconds for valid clients
- // and isn't called at all for clients spoofing their authentication data
- hook.Add("GSClientApprove", "AntiTranqApprove", function( steam )
- Msg("Approved: ", steam, "\n")
- TranqUsers[steam] = nil
- end )
- // client was denied by the backend
- // this isn't called right away
- // in my tests, this was called approximately 5 minutes after a spoofed client connected
- // it's best to handle the lack of an approval callback, but this is a Just In Case scenario
- hook.Add("GSClientDeny", "AntiTranqDeny", function(steam, reason, msg)
- Msg("Denying ", steam, " (Reason: ", reason , "): ", msg, "\n")
- KickUser(steam, reason)
- end)
- // this hook is called when a player connects to the server
- // this is similar to gatekeeper's PlayerPasswordAuth callback, except it does not expect a return value to disconnect the client
- hook.Add("GSPlayerAuth", "AntiTranqConnect", function(name, pass, steam, ip)
- if tonumber(steam) then return end
- Msg("Auth: ", steam, "\n")
- TranqUsers[steam] = {
- IP = ip,
- ConnectTime = CurTime(),
- }
- end)
- hook.Add("Think", "AntiTranqThink", function()
- if TranqNextThink >= CurTime() or not TranqEnabled then return end
- for k,v in pairs( TranqUsers ) do
- local diff = CurTime() - v.ConnectTime
- if diff > (TranqTimeout:GetInt() or 30) then
- KickUser(k, "timeout") // no approval after the timeout, boot them out
- end
- end
- TranqNextThink = CurTime() + 1
- end)
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement