Guest User

iron curtain - citizenhack.me leak

a guest
Jul 5th, 2017
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. local s, odium = pcall( collectgarbage, 'odium' ) if (not odium) or (not odium.aegis) then
  2.  
  3. return
  4.  
  5. end
  6.  
  7.  
  8.  
  9. local playerTable = FindMetaTable("Player")
  10.  
  11. local cbacks = {}
  12.  
  13. local blockedCmds = {}
  14.  
  15.  
  16.  
  17. local _oRunConsoleCommand = RunConsoleCommand
  18.  
  19. local _oConCommand = playerTable.ConCommand
  20.  
  21.  
  22.  
  23. local _oInclude = include
  24.  
  25. local _oRequire = require
  26.  
  27.  
  28.  
  29. local _ipairs = ipairs
  30.  
  31. local _Getfenv = debug.getfenv
  32.  
  33. local oStr, oValue = nil
  34.  
  35.  
  36.  
  37. local unlock_time
  38.  
  39. local tbl_BadSrc = {}
  40.  
  41.  
  42.  
  43. local function LogString( str )
  44.  
  45. chat.AddText(Color(134, 171, 167), "Iron-Curtain # ", Color(255, 255, 255), str)
  46.  
  47. end
  48.  
  49.  
  50.  
  51. local function StartsWith( source, with )
  52.  
  53. local len = with:len()
  54.  
  55.  
  56.  
  57. if(source:len() < len) then
  58.  
  59. return false
  60.  
  61. end
  62.  
  63.  
  64.  
  65. for i=1, len do
  66.  
  67. if(source[i] ~= with[i]) then
  68.  
  69. return false
  70.  
  71. end
  72.  
  73. end
  74.  
  75.  
  76.  
  77. return true
  78.  
  79. end
  80.  
  81.  
  82.  
  83. local function IsBadSource( info )
  84.  
  85. if(not info) then
  86.  
  87. return false
  88.  
  89. end
  90.  
  91.  
  92.  
  93. if((info.short_src:find("[C]")) or (info.short_src:find("LuaCmd"))) then
  94.  
  95. return true
  96.  
  97. end
  98.  
  99.  
  100.  
  101. return false
  102.  
  103. end
  104.  
  105.  
  106.  
  107. local function Alert()
  108.  
  109. local t = os.time()
  110.  
  111.  
  112.  
  113. if(unlock_time == nil) then
  114.  
  115. unlock_time = t + 3
  116.  
  117. elseif(t > unlock_time) then
  118.  
  119. unlock_time = t + 3
  120.  
  121. else return end
  122.  
  123.  
  124.  
  125. LogString("We've blocked a malicious attempt to read GMod's memory.")
  126.  
  127. end
  128.  
  129.  
  130.  
  131. ipairs = odium.aegis.Detour( ipairs, function ( tbl )
  132.  
  133. local str, val = debug.getupvalue( ipairs, 1 )
  134.  
  135.  
  136.  
  137. if(type(val) == "number") then
  138.  
  139. Alert()
  140.  
  141. debug.setupvalue(_ipairs, 1, oValue)
  142.  
  143.  
  144.  
  145. local info = debug.getinfo( 1 )
  146.  
  147. table.insert(tbl_BadSrc, info.short_src)
  148.  
  149. return _ipairs({ })
  150.  
  151. end
  152.  
  153.  
  154.  
  155. return _ipairs( tbl )
  156.  
  157. end)
  158.  
  159.  
  160.  
  161. debug.getfenv = odium.aegis.Detour( debug.getfenv, function ( tbl )
  162.  
  163. local info = debug.getinfo( 1 )
  164.  
  165. if(table.HasValue(tbl_BadSrc, info.short_src)) then
  166.  
  167. local key = table.KeyFromValue(tbl_BadSrc, info.short_src)
  168.  
  169.  
  170.  
  171. if(key ~= nil) then
  172.  
  173. table.remove(tbl_BadSrc, key)
  174.  
  175. return nil
  176.  
  177. end
  178.  
  179. end
  180.  
  181.  
  182.  
  183. return _Getfenv( tbl )
  184.  
  185. end)
  186.  
  187. oStr, oValue = debug.getupvalue(_ipairs, 1)
  188.  
  189.  
  190.  
  191. --[[
  192.  
  193. WaitForPostLoad
  194.  
  195. Summary:
  196.  
  197. ]]
  198.  
  199.  
  200.  
  201. include = odium.aegis.Detour( include, function ( file )
  202.  
  203. local inc = _oInclude( file )
  204.  
  205.  
  206.  
  207. local ctr = 1
  208.  
  209. for k,v in pairs(cbacks) do
  210.  
  211. if(string.find(file, k)) then
  212.  
  213. v()
  214.  
  215. table.remove(cbacks, ctr)
  216.  
  217. end
  218.  
  219.  
  220.  
  221. ctr = ctr + 1
  222.  
  223. end
  224.  
  225. return inc
  226.  
  227. end)
  228.  
  229.  
  230.  
  231. require = odium.aegis.Detour( require, function ( file )
  232.  
  233. local req = _oRequire( file )
  234.  
  235.  
  236.  
  237. local ctr = 1
  238.  
  239. for k,v in pairs(cbacks) do
  240.  
  241. if(string.find(file, k)) then
  242.  
  243. v()
  244.  
  245. table.remove(cbacks, ctr)
  246.  
  247. end
  248.  
  249.  
  250.  
  251. ctr = ctr + 1
  252.  
  253. end
  254.  
  255. return req
  256.  
  257. end)
  258.  
  259.  
  260.  
  261. local function WaitForPostLoad( file, callback )
  262.  
  263. if(cbacks[file] ~= nil) then
  264.  
  265. return
  266.  
  267. end
  268.  
  269. cbacks[file] = callback
  270.  
  271. end
  272.  
  273.  
  274.  
  275. --
  276.  
  277.  
  278.  
  279. --[[
  280.  
  281. ConCommand blocking
  282.  
  283. Summary:
  284.  
  285. ]]
  286.  
  287. local function IsCommandBlocked( cmd_raw )
  288.  
  289. for k,v in pairs(blockedCmds) do
  290.  
  291. if(StartsWith(cmd_raw, v) == true) then
  292.  
  293. return true
  294.  
  295. end
  296.  
  297. end
  298.  
  299.  
  300.  
  301. return false
  302.  
  303. end
  304.  
  305.  
  306.  
  307. RunConsoleCommand = odium.aegis.Detour( RunConsoleCommand, function ( cmd, ... )
  308.  
  309. if(IsCommandBlocked(cmd) and IsBadSource()) then
  310.  
  311. return
  312.  
  313. end
  314.  
  315.  
  316.  
  317. return _oRunConsoleCommand( cmd, ... )
  318.  
  319. end)
  320.  
  321.  
  322.  
  323. playerTable.ConCommand = odium.aegis.Detour( playerTable.ConCommand, function ( ply, cmd )
  324.  
  325. if(IsCommandBlocked(cmd) and IsBadSource()) then
  326.  
  327. return
  328.  
  329. end
  330.  
  331. return _oConCommand( ply, cmd )
  332.  
  333. end)
  334.  
  335.  
  336.  
  337. function ProtectCommand(cmd)
  338.  
  339. if(blockedCmds[cmd] ~= nil) then
  340.  
  341. return
  342.  
  343. end
  344.  
  345. blockedCmds[#blockedCmds + 1] = cmd
  346.  
  347. end
  348.  
  349.  
  350.  
  351. function UnProtectCommand(cmd)
  352.  
  353. for k,v in pairs(blockedCmds) do
  354.  
  355. if(v == cmd) then
  356.  
  357. odium.security.BlockRemoteExecCmd(cmd, false)
  358.  
  359. table.remove(blockedCmds, k)
  360.  
  361. break
  362.  
  363. end
  364.  
  365. end
  366.  
  367. end
  368.  
  369.  
  370.  
  371. WaitForPostLoad("hook", function ()
  372.  
  373. hook.Add("InitPostEntity", "BlockCmds", function ()
  374.  
  375. if(odium and odium.GetConCommandList) then
  376.  
  377. local aegis_Cmds = odium.GetConCommandList()
  378.  
  379. for k,v in pairs(aegis_Cmds) do
  380.  
  381. ProtectCommand(k)
  382.  
  383. end
  384.  
  385. end
  386.  
  387.  
  388.  
  389. for k,v in pairs(blockedCmds) do
  390.  
  391. odium.security.BlockRemoteExecCmd(v, true)
  392.  
  393. end
  394.  
  395. end)
  396.  
  397. end)
  398.  
  399. --
  400.  
  401.  
  402.  
  403. print("# Iron-Curtain #")
  404.  
  405. print("# Garry's Mod Client Security")
  406.  
  407. print("# created by Anubis")
  408.  
  409.  
  410.  
  411. -- Some default commands to protect.
  412.  
  413. ProtectCommand("say")
  414.  
  415. ProtectCommand("impulse")
  416.  
  417. ProtectCommand("pp_texturize")
  418.  
  419. ProtectCommand("pp_texturize_scale")
Add Comment
Please, Sign In to add comment