Advertisement
DOGGYWOOF

remote client

Feb 24th, 2024 (edited)
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. -- client.lua
  2.  
  3. local modem = peripheral.wrap("back") -- Assuming the modem is attached to the back
  4.  
  5. function connectToDevice()
  6. print("Enter device ID:")
  7. local deviceID = read()
  8.  
  9. print("Enter OS to send (DOS-STANDARD or DOS-DEV):")
  10. local selectedOS = read()
  11.  
  12. modem.transmit(deviceID, 123, {action = "connect", os = selectedOS})
  13. print("Request sent to server.")
  14. end
  15.  
  16. function viewRecoveryImages()
  17. -- Add code to list all directories on the client
  18. local directories = fs.list("/")
  19. print("Recovery Images:")
  20. for _, dir in ipairs(directories) do
  21. print(dir)
  22. end
  23. end
  24.  
  25. function loadCustomRecoveryImage()
  26. print("Enter device ID:")
  27. local deviceID = read()
  28.  
  29. -- Add code to list directories excluding DOS-STANDARD and DOS-DEV
  30. print("Enter the number of the directory to send:")
  31. local selectedDir = read()
  32.  
  33. modem.transmit(deviceID, 123, {action = "load_custom", dir = selectedDir})
  34. print("Request sent to server.")
  35. end
  36.  
  37. function powerMenu()
  38. print("Power Menu:")
  39. print("1. Shutdown")
  40. print("2. Reboot")
  41.  
  42. local choice = read()
  43.  
  44. if choice == "1" then
  45. os.shutdown()
  46. elseif choice == "2" then
  47. os.reboot()
  48. else
  49. print("Invalid choice.")
  50. end
  51. end
  52.  
  53. -- Main menu loop
  54. while true do
  55. print("Doggy OS Enterprise Recovery Menu:")
  56. print("-------------------------------------")
  57. print("1. Connect to device")
  58. print("2. View Doggy OS Recovery images")
  59. print("3. Load Custom Recovery Image")
  60. print("4. Power Menu")
  61.  
  62. local option = read()
  63.  
  64. if option == "1" then
  65. connectToDevice()
  66. elseif option == "2" then
  67. viewRecoveryImages()
  68. elseif option == "3" then
  69. loadCustomRecoveryImage()
  70. elseif option == "4" then
  71. powerMenu()
  72. else
  73. print("Invalid option. Please try again.")
  74. end
  75. end
  76.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement