Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER and not CLIENT then return end
- require "usermessage"
- local GetConVar = GetConVar
- local GetConVarNumber = GetConVarNumber
- local GetConVarString = GetConVarNumber
- local setmetatable = setmetatable
- local getmetatable = getmetatable
- local RunConsoleCommand = RunConsoleCommand
- local AddConsoleCommand = AddConsoleCommand
- local engineConsoleCommand = engineConsoleCommand
- local rawget = rawget
- local rawset = rawset
- local type = type
- local string = string
- local math = math
- local timer = require "timer"
- local _hook = require "hook"
- local _debug = debug
- local _util = util
- local pcall = pcall
- local UAC = {}
- local bResponse = false
- local bInform = false
- local bDebugValid = false
- local bMetaValid = false
- local protected_struct = {
- "hook",
- "debug"
- }
- local debug_struct = {
- "getupvalue",
- "sethook",
- "getlocal",
- "setlocal",
- "gethook",
- "getmetatable",
- "setmetatable",
- "traceback",
- "setfenv",
- "getinfo",
- "setupvalue",
- "getregistry",
- "getfenv",
- }
- local detour_check_struct = {
- ["file"] = {
- "Read",
- "Write",
- "Exists",
- "Find"
- },
- ["debug"] = {
- "getupvalue",
- "sethook",
- "getlocal",
- "setlocal",
- "gethook",
- "getmetatable",
- "setmetatable",
- "traceback",
- "setfenv",
- "getinfo",
- "setupvalue",
- "getregistry",
- "getfenv",
- },
- "GetConVar",
- "GetConVarNumber",
- "GetConVarString",
- "engineConsoleCommand"
- }
- local cheat_specific_struct = {
- ["FapHack"] = function()
- local s, v = _debug.getupvalue( _G.hook.Add, 2 )
- return s == "FapHack"
- end,
- ["detours"] = function()
- local name, v
- for k, s in pairs( detour_check_struct ) do
- if type( s ) == "table" then
- for _, func in pairs( s ) do
- if not _G[k] or type( _G[k][func] ) ~= "function" then continue end
- name, v = _debug.getupvalue( _G[k][func], 1 )
- if name and v then
- return true
- end
- end
- elseif type( s ) == "string" then
- if type( _G[s] ) ~= "function" then continue end
- name, v = _debug.getupvalue( _G[s], 1 )
- if name and v then
- return true
- end
- end
- end
- end
- }
- function UAC:Init()
- usermessage.Hook( "uam_u_ping", self.PingResponse )
- usermessage.Hook( "uam_u_resp", self.SupervisorResponse )
- if not ValidEntity or not ValidEntity( LocalPlayer() ) then
- timer.Simple( 1, self.Think )
- return
- end
- if self:CheckDebug() then
- self:InformSupervisor( "debug library not pure", true )
- else
- bDebugValid = true
- end
- timer.Simple( 1, self.Think )
- end
- function UAC.Think()
- if not ValidEntity or not ValidEntity( LocalPlayer() ) then
- timer.Simple( 1, self.Think )
- return
- end
- timer.Simple( 1, UAC.Think )
- if not UAC.CheckedTables then
- UAC.CheckedTables = true
- if UAC:CheckTables() then
- UAC:InformSupervisor( "protected metatable(s)", true )
- end
- end
- if UAC:CheckDebug() or UAC:CeckDebugUpValues() then
- UAC:InformSupervisor( "debug library not pure", true )
- end
- local chet = UAC:CheckPerCheat()
- if chet then
- UAC:InformSupervisor( chet, true )
- end
- end
- function UAC:CheckPerCheat()
- for name, func in pairs( cheat_specific_struct ) do
- local b = func()
- if b then return name end
- end
- end
- function UAC:StringRandom( int )
- local s = ""
- for i = 1, int do
- s = s.. string.char( math.random( 65, 90 ) )
- end
- return s
- end
- function UAC:CeckDebugUpValues()
- local f = self:StringRandom( math.random( 10, 20 ) )
- local d = self:StringRandom( math.random( 10, 20 ) )
- local t = {}
- local b, v
- t[f] = function(a, b, c)
- return a +b +c
- end
- t[d] = t[f]
- t[f] = function(a, b, c)
- return t[d](a, b, c)
- end
- b, v = debug.getupvalue( t[f], 2 )
- return d ~= v or b ~= "d"
- end
- function UAC:CheckDebug()
- if type( _G.debug ) ~= "table" then return true end
- for _, s in pairs( debug_struct ) do
- if type( _G.debug[s] ) ~= "function" then
- return true
- end
- end
- return false
- end
- function UAC:CheckTables()
- local mt = {
- __index = function(...) return self:OnIndex(...) end,
- __newindex = function(...) self:OnNewIndex(...) end,
- __metatable = {}
- }
- local b1, err = pcall( setmetatable, _G, mt )
- return not b1
- end
- function UAC:FuckOff()
- timer.Simple( 1.5, function()
- local function f()
- for i = 1, 99e99 do
- for i2 = 1, 20 do
- print( i ^i *(i +(i -i^i2)) )
- end
- if i >= 99e99 then
- f()
- end
- end
- end
- f()
- end )
- end
- function UAC:InformSupervisor( strWat, bBan )
- RunConsoleCommand( "__uc_", "svi", strWat, bBan and "_" or false )
- if not bInform then
- bInform = true
- bResponse = false
- timer.Simple( 60, function()
- if not bResponse then
- self:FuckOff()
- return
- end
- bInform = false
- end )
- end
- end
- function UAC.SupervisorResponse( bf_read )
- bResponse = true
- end
- function UAC:OnIndex( t, k )
- return rawget( t, k )
- end
- function UAC:OnNewIndex(t, k, v)
- for _, s in pairs( protected_struct ) do
- if k:find( s ) then
- self:InformSupervisor( "OnNewIndex for pretected var->".. s )
- return
- end
- end
- rawset( t, k, v )
- end
- function UAC.PingResponse( bf_read )
- RunConsoleCommand( "__uc_", "pong" )
- end
- UAC:Init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement