Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- termutils = {}
- termutils.clear = function()
- term.clear()
- term.setCursorPos(1, 1)
- end
- termutils.clearColor = function()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- end
- function input()
- term.setTextColor(colors.blue)
- local dir = shell.dir().."/"..">"
- write(dir)
- termutils.clearColor()
- return io.read()
- end
- function checkProtection(command)
- -- Define paths that are protected
- local protectedPaths = {
- "/disk/boot/",
- "/disk/os/",
- "/disk/bootloader/",
- "startup",
- "no-os",
- "/disk/users/"
- }
- -- Check if the command contains any of the protected paths
- for _, path in ipairs(protectedPaths) do
- if string.find(command, path) then
- print("Doggy OS file system protection: This command may modify critical files. Proceed? (Y/N)")
- local choice = io.read()
- if choice:lower() == "y" then
- return true
- else
- return false
- end
- end
- end
- return true -- No protected paths found, proceed with the command
- end
- termutils.clear()
- print("Doggy OS Terminal (13.0)")
- while true do
- local command = input()
- if checkProtection(command) then
- shell.run(command)
- else
- print("Command aborted by user.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement