Advertisement
LDDestroier

CC File Protection Test

Feb 23rd, 2015
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. local olddelete = fs.delete
  2. local oldopen = fs.open
  3. OVERRIDE = {}
  4. OVERRIDE.whitelist = {"whitelist table for files"}
  5. fs.delete = function(sFile)
  6.   for i,v in pairs(whitelist) do
  7.         if v == sFile then
  8.           error("Access denied",0)
  9.         end
  10.   end
  11.   olddelete(sFile)
  12. end
  13. fs.open = function(sFile, sMode)
  14.   for i,v in pairs(OVERRIDE.whitelist) do
  15.         if v == sFile then
  16.           if sMode == "w" or sMode == "a" or sMode == "wb" or sMode == "ab" then
  17.                 sMode = string.sub(sMode,#sMode,#sMode) == "b" and "rb" or "r"
  18.           end
  19.         end
  20.   end
  21.   oldopen(sFile,sMode)
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement