ClientOS/security.lua
2025-10-20 16:23:17 +02:00

89 lines
2.1 KiB
Lua

--Disable Shell
--multishell.setTitle = function()
-- error("Access Denied")
--end
--shell.execute = multishell.setTitle
--Disable Store, Cloud
http.request = function()
return false, "Network Access Denied"
end
--http.post = http.get
--Disable Lua
local originalWrite = _G.write
_G.write = function(text)
if text == "lua> " then
error("Befator Inc Security: Lua Interpreter Access Denied")
end
return originalWrite(text)
end
--Protect self and disable rom
local function shouldProtect(path)
return fs.getName(path) == "security.lua"
end
local originalOpen = fs.open
fs.open = function(path, mode)
if (shouldProtect(path) or path:find("^rom/programs") ~= nil) then
error("Befator Inc Security: Access Denied")
else
return originalOpen(path, mode)
end
end
local origininalDel = fs.delete
fs.delete = function(path)
if shouldProtect(path) then
error("Befator Inc Security: Access Denied")
else
return origininalDel(path)
end
end
local origininalMove = fs.move
fs.move = function(path, dest)
if shouldProtect(path) then
error("Befator Inc Security: Access Denied")
else
return origininalMove(path, dest)
end
end
local origininalCopy = fs.copy
fs.copy = function(path, dest)
if shouldProtect(path) then
error("Befator Inc Security: Access Denied")
else
return origininalCopy(path, dest)
end
end
local origininalExists = fs.exists
fs.exists = function(path)
if shouldProtect(path) then
return false
else
return origininalExists(path)
end
end
local origininalList = fs.list
fs.list = function(path)
local ls = origininalList(path)
for i=#ls,1,-1 do
if ls[i] == "security.lua" then
table.remove(ls, i)
end
end
return ls
end
--OS Config
fs.delete("/User/Desktop/Cloud.llnk")
fs.delete("/User/Desktop/Store.llnk")
fs.delete("/LevelOS/Global_Login.lua")
fs.delete("/LevelOS/data/changelog.lconf")
--Force Login Screen
local f = fs.open("/LevelOS/data/account.txt", "w")
f.write("Befator's Sklave")
f.close()
shell.execute("real_startup")