Guest User

QAC Quack anti-cheat 3/14/14

a guest
Mar 26th, 2014
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.49 KB | None | 0 0
  1. ---- CL_QAC
  2. ---- CH 3/14/14, original copy @ 9/13
  3. ---- ZTF
  4. ---- I don't care if you learn how to decrypt the lua cache and steal this, so stopping adding me about it
  5. ---- Tho pref dont redistribute ty
  6.  
  7. local nr = _G["net"]["Receive"]
  8. local ns = _G["net"]["Start"]
  9. local ns2s = _G["net"]["SendToServer"]
  10. local nws = _G["net"]["WriteString"]
  11. local nwi = _G["net"]["WriteInt"]
  12. local nwt = _G["net"]["WriteTable"]
  13. local nwb = _G["net"]["WriteBit"]
  14. local nrt = _G["net"]["ReadTable"]
  15. local cvarcb = cvars.AddChangeCallback
  16. local dbgg = debug.getinfo
  17. local up = unpack
  18. local gc = GetConVar
  19. local tc = timer.Create
  20. local ts = timer.Simple
  21.  
  22.  
  23. --Source Detection Things
  24. QAC = true
  25.  
  26. local scans = {}
  27.  
  28. local scanf = {
  29.  
  30.     {hook, "Add"},
  31.  
  32.     --{hook, "Call"}, -- cl deathnotice is retarded?  // needs to be fixed. -- esp
  33.  
  34.     --{hook, "Run"}, -- cl deathnotice is retarded?
  35.  
  36.     {timer, "Create"},
  37.  
  38.     {timer, "Simple"},
  39.  
  40.     --{_G, "CreateClientConVar"}, -- ULX IS GAY   // note to self, create detour
  41.  
  42.     {_G, "RunString"}, -- cl deathnotice is retarded?
  43.  
  44.     //{_G, "RunStringEx"},
  45.    
  46.     {file, "Read"},
  47.    
  48.     {concommand, "Add"},
  49.  
  50.     {_G, "RunConsoleCommand"}
  51.  
  52. }
  53.  
  54.  
  55. local function validate_src(src)
  56.  
  57.     ns("checksaum")
  58.  
  59.         nws(src)
  60.  
  61.     ns2s()
  62.  
  63. end
  64.  
  65. local function RFS()
  66.  
  67.     local CNum = net.ReadInt(10)
  68.    
  69.         ns("Debug1")
  70.        
  71.         nwi(CNum, 16)
  72.        
  73.         ns2s()
  74. end
  75.  
  76. nr("Debug2", RFS)
  77.  
  78. local function scan_func()
  79.  
  80.     local s = {}
  81.  
  82.    
  83.  
  84.     for i = 0, 1/0, 1 do
  85.  
  86.     local dbg = dbgg(i)
  87.        
  88.         if (dbg) then
  89.  
  90.             s[dbg.short_src] = true
  91.  
  92.         else
  93.  
  94.             break
  95.  
  96.         end
  97.  
  98.     end
  99.  
  100.    
  101.  
  102.     for src, _ in pairs(s) do
  103.  
  104.         if (src == "RunString" || src == "LuaCmd" || src == "[C]") then
  105.  
  106.             return
  107.  
  108.         elseif (!(scans[src])) then
  109.  
  110.             scans[src] = true
  111.  
  112.             validate_src(src)
  113.  
  114.         end
  115.  
  116.     end
  117.  
  118. end
  119.  
  120.  
  121.  
  122. ---Scan Functions
  123.  
  124. local function SCAN_G()
  125.  
  126.     for _, ft in pairs(scanf) do
  127.  
  128.         local ofunc = ft[1][ft[2]]
  129.  
  130.        
  131.  
  132.         ft[1][ft[2]] = (
  133.  
  134.             function(...)
  135.  
  136.                 local args = {...}
  137.  
  138.                 scan_func()
  139.  
  140.                 ofunc(up(args))
  141.  
  142.             end
  143.  
  144.         )
  145.  
  146.     end
  147.  
  148. end
  149.  
  150.  
  151.  
  152. hook.Add(
  153.  
  154.     "OnGamemodeLoaded",
  155.  
  156.     "___scan_g_init",
  157.  
  158.     function()
  159.  
  160.         SCAN_G()
  161.  
  162.         hook.Remove("OnGamemodeLoaded", "___scan_g_init")
  163.  
  164.     end
  165.  
  166. )
  167.  
  168.  
  169.  
  170.  
  171.  
  172. --ConVar Detection
  173.  
  174. local function validate_cvar(c, v)
  175.  
  176.     ns("control_vars")
  177.  
  178.         nwt({c = c, v = v})
  179.  
  180.     ns2s()
  181.  
  182. end
  183.  
  184.  
  185.  
  186.  
  187.  
  188. local function cvcc(cv, pval, nval)
  189.  
  190.     validate_cvar(cv, nval)
  191.  
  192. end
  193.  
  194.  
  195.  
  196. local ctd = {}
  197.  
  198.  
  199.  
  200. local function sned_req()
  201.  
  202.     ns("gcontrol_vars")
  203.  
  204.         nwb()
  205.  
  206.     ns2s()
  207.  
  208. end
  209.  
  210. ts(1, sned_req)
  211.  
  212.  
  213.  
  214.  
  215.  
  216. nr(
  217.  
  218.     "gcontrol_vars",
  219.  
  220.     function()
  221.  
  222.         local t = nrt()
  223.  
  224.        
  225.  
  226.         local c = gc(t.c)
  227.  
  228.         local v = (c != nil && c:GetString() || "0")
  229.  
  230.         ctd[c] = v
  231.  
  232.  
  233.         cvarcb(t.c, cvcc)
  234.  
  235.         if (v != t.v) then
  236.  
  237.             validate_cvar(t.c, v)
  238.  
  239.         end
  240.  
  241.     end
  242.  
  243. )
  244.  
  245.  
  246.  
  247. ---Timed Chec
  248.  
  249. local mintime = 010
  250.  
  251. local maxtime = 030
  252.  
  253.  
  254.  
  255. local function timecheck()
  256.  
  257.     for c, v in pairs(ctd) do
  258.  
  259.         local cv = c:GetString() || ""
  260.  
  261.         if (cv != v) then
  262.  
  263.             validate_cvar(c:GetName(), cv)
  264.  
  265.             ctd[c] = cv
  266.  
  267.         end
  268.  
  269.     end
  270.  
  271.     ts(math.random(mintime, maxtime), timecheck)
  272.  
  273. end
  274. --[[
  275.  
  276. local Debug1_bkup = net.Receivers["Debug1"]
  277. local Debug2_bkup = net.Receivers["Debug2"]
  278. local checksaum_bkup = net.Receivers["checksaum"]
  279. local gcontrol_vars_bkup = net.Receivers["gcontrol_vars"]
  280. local control_vars_bkup = net.Receivers["control_vars"]
  281. local net_msg_check_bkup = net.Receivers["net_msg_check"]
  282.     ]]--
  283.        
  284.  
  285.  
  286.  
  287.  
  288. -- file steal pls REMOVED.
  289. -- Not allowed. Sorry guys!
Advertisement
Add Comment
Please, Sign In to add comment