Advertisement
DOGGYWOOF

New SYSTEM SHELL

Aug 17th, 2024 (edited)
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. termutils = {}
  2.  
  3. termutils.clear = function()
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6. end
  7.  
  8. termutils.clearColor = function()
  9. term.setTextColor(colors.white)
  10. term.setBackgroundColor(colors.black)
  11. end
  12.  
  13. function input()
  14. term.setTextColor(colors.blue)
  15. local dir = shell.dir().."/"..">"
  16. write(dir)
  17. termutils.clearColor()
  18. return io.read()
  19. end
  20.  
  21. function checkProtection(command)
  22. -- Define paths that are protected
  23. local protectedPaths = {
  24. "/disk/boot/",
  25. "/disk/os/",
  26. "/disk/bootloader/",
  27. "startup",
  28. "no-os",
  29. "/disk/users/"
  30. }
  31.  
  32. -- Check if the command contains any of the protected paths
  33. for _, path in ipairs(protectedPaths) do
  34. if string.find(command, path) then
  35. print("Doggy OS file system protection: This command may modify critical files. Proceed? (Y/N)")
  36. local choice = io.read()
  37. if choice:lower() == "y" then
  38. return true
  39. else
  40. return false
  41. end
  42. end
  43. end
  44.  
  45. return true -- No protected paths found, proceed with the command
  46. end
  47.  
  48. termutils.clear()
  49. print("Doggy OS Terminal (13.0)")
  50.  
  51. while true do
  52. local command = input()
  53. if checkProtection(command) then
  54. shell.run(command)
  55. else
  56. print("Command aborted by user.")
  57. end
  58. end
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement