Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* It is actually illegal for the server to read your private files unless you agreed to it */
- // Lua file security by Anthr4x292
- // Feel free to troll anti cheats with file stealers or enter any server safely.
- local file = file
- local SLASH = "[\\/]+"
- local _file = {}
- _file.Read = file.Read
- _file.Find = file.Find
- _file.FindDir = file.FindDir
- _file.FindInLua = file.FindInLua
- _file.Exists = file.Exists
- _file.Delete = file.Delete
- local blacklist =
- {
- "lua" .. SLASH,
- "addons" .. SLASH,
- "cfg" .. SLASH
- }
- local whitelist =
- {
- "gmod_tool" .. SLASH,
- "wire" .. SLASH .. "gates",
- "wire" .. SLASH .. "uwsvn_load",
- "entities" .. SLASH .. "gmod_wire_egp",
- "entities" .. SLASH .. "gmod_emitter",
- "gamemode" .. SLASH .. "FAdmin",
- "ulib" .. SLASH .. "modules",
- "ulx" .. SLASH .. "modules",
- }
- local function RandomNum(t)
- if t then
- local _T = {}
- for i = 0, math.Round(math.random(1, 15)) do
- table.insert(_T, math.Round(math.random(10000000, 99999999)))
- end
- return _T
- else
- return math.Round(math.random(10000000, 99999999))
- end
- end
- local function IsWhiteListed(f)
- for k, v in pairs(whitelist) do
- if string.match(f, v) then
- return true
- end
- end
- end
- // Start detouring the functions
- function file.Read(f, use_base_folder)
- if use_base_folder then
- for k, v in pairs(blacklist) do
- if string.match(f, v) then
- if not IsWhiteListed(f) then
- MsgN("Lua File Security: Disallowed file read '" .. f .. "'!")
- return RandomNum(false)
- end
- end
- end
- end
- return _file.Read(f, use_base_folder)
- end
- function file.Find(f, use_base_folder)
- if use_base_folder then
- for k, v in pairs(blacklist) do
- if string.match(f, v) then
- if not IsWhiteListed(f) then
- MsgN("Lua File Security: Illegal file scan on folder '" .. f .. "'!")
- return RandomNum(true)
- end
- end
- end
- end
- return _file.Find(f, use_base_folder)
- end
- function file.FindDir(f, use_base_folder)
- if use_base_folder then
- for k, v in pairs(blacklist) do
- if string.match(f, v) then
- if not IsWhiteListed(f) then
- MsgN("Lua File Security: Illegal folder scan on folder '" .. f .. "'!")
- return RandomNum(true)
- end
- end
- end
- end
- return _file.FindDir(f, use_base_folder)
- end
- function file.FindInLua(f)
- if not IsWhiteListed(f) then
- MsgN("Lua File Security: Disallowed lua file scan on folder '" .. f .. "'!")
- return RandomNum(true)
- end
- return _file.FindInLua(f, use_base_folder)
- end
- function file.Exists(f, use_base_folder)
- if use_base_folder then
- for k, v in pairs(blacklist) do
- if string.match(f, v) then
- if not IsWhiteListed(f) then
- MsgN("Lua File Security: Disallowed file existance check '" .. f .. "'!")
- return false
- end
- end
- end
- end
- return _file.Exists(f, use_base_folder)
- end
Advertisement
Add Comment
Please, Sign In to add comment