Advertisement
Vorakh

HackOs Disk per Computer o Turtle Computercraft (EN)

May 14th, 2013 (edited)
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Program that bypasses the startup on a Computer or a Turtle Minecraft
  2. --
  3. -- and that visually simulates the hack of that computer or Turtle
  4. --
  5. -- Program to be copied on a "disk" with the name "startup"
  6. --
  7. -- Program created by Vorakh
  8. -----------------------------------
  9. NAME_PROG = "Vorakh"
  10. NAME_OS = NAME_PROG.."OS"
  11. VERSION = "v2.5"
  12. BYPASS_TEXT = NAME_OS .. " Bypass " .. VERSION
  13.  
  14.  
  15. S1 = false
  16. S2 = false
  17. ------------------------------------
  18.  
  19. -- Visual function of the bypass startup
  20. function HackOS()
  21.     local progress = 0
  22.     term.clear()
  23.     term.setCursorPos(1,1)
  24.     print("Detected file \"startup\" on this computer.")
  25.     print("")
  26.     sleep(0.5)
  27.     write("HackOS Disk boot in progress")
  28.     for i = 1, 3 do
  29.         sleep(1)
  30.         write(".")
  31.     end
  32.     sleep(1.5)
  33.     term.setCursorPos(19, 4)
  34.     print("completed!     ")
  35.     sleep (2)
  36.     print("")
  37.     print("Sub-Routine HackOS "..VERSION)
  38.     print("")
  39.     sleep(1)
  40.     print("Performing Routine Cracking OS")
  41.     sleep(1)
  42.     print("Progress: "..progress.."%")
  43.     for i = 1, 3 do
  44.         progress = progress + 25
  45.         sleep(2)
  46.         term.setCursorPos(12,9)
  47.         print(progress.."%")
  48.     end
  49.     sleep(3)
  50.     term.setCursorPos(12,9)
  51.     print("Completed!")
  52.     print("")
  53.     for i = 1, 3, 1 do
  54.         sleep(1)
  55.         write(".")
  56.     end
  57.     sleep(1)
  58.     shell.run("clear")
  59.  
  60.     for i = 1, #BYPASS_TEXT do
  61.         local char = BYPASS_TEXT:sub(i, i)
  62.         write(char)
  63.         sleep(0.1)
  64.     end
  65.     print("")
  66. end
  67.  
  68. local function creaStartup(nome)
  69.     local s = fs.open(nome, "w")
  70. s.write("shell.run(\"clear\")")
  71. s.write("\nprint(\""..BYPASS_TEXT.."\")")
  72. s.close()
  73. end
  74.  
  75. local function archiviaStartup(nome)
  76.     local archiviato = "old-" .. nome
  77.     shell.run("mv", nome, archiviato)
  78. end
  79.  
  80. local function noStartup()
  81.     shell.run("clear")
  82.     print("Computer without file \"startup\", start OS without modification...")
  83.     sleep(3)
  84.     os.reboot()
  85. end
  86.  
  87. -- Checking the existence of the file "startup" on the Computer or Turtle
  88. -- on which you run the program
  89.  
  90. if fs.exists("/startup") then
  91.     S1 = true
  92.     local nome = "startup"
  93.     archiviaStartup(nome)
  94.     creaStartup(nome)
  95. end
  96. if fs.exists("/startup.lua") then
  97.     S2 = true
  98.     local nome = "startup.lua"
  99.     archiviaStartup(nome)
  100.     creaStartup(nome)
  101. end
  102.  
  103. if S1 or S2 then
  104.     HackOS()
  105. else
  106.     -- In case there is no file "startup" is notified screen
  107.     -- for a few seconds and then the message disappears
  108.     noStartup()
  109. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement