Advertisement
Vorakh

HackOs Disk per Computer o Turtle Computercraft

Mar 13th, 2013 (edited)
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. -- Programma che bypassa lo startup su un Computer o un Turtle di Minecraft
  2. -- e che simula visivamente l'hack del suddetto Computer o Turtle
  3.  
  4. -- Programma da copiare su un "disk" con il nome "startup"
  5.  
  6. -- Programma realizzato da Vorakh
  7.  
  8. -----------------------------------
  9. NOME_PROG = "Vorakh"
  10. NOME_OS = NOME_PROG.."OS"
  11. VERSIONE = "v2.5"
  12. SCRITTA_BYPASS = NOME_OS .. " Bypass " .. VERSIONE
  13.  
  14.  
  15. S1 = false
  16. S2 = false
  17. ------------------------------------
  18.  
  19. -- Funzione visiva del bypass dello startup
  20. function HackOS()
  21.     local progresso = 0
  22.     term.clear()
  23.     term.setCursorPos(1,1)
  24.     print("Rilevato uno o più file \"startup\" nel computer.")
  25.     print("")
  26.     sleep(0.5)
  27.     write("HackOS Disk avvio in corso")
  28.     for i = 1, 3 do
  29.         sleep(1)
  30.         write(".")
  31.     end
  32.     sleep(1.5)
  33.     term.setCursorPos(19, 4)
  34.     print("completato!")
  35.     sleep (2)
  36.     print("")
  37.     print("Sub-Routine HackOS "..VERSIONE)
  38.     print("")
  39.     sleep(1)
  40.     print("Esecuzione Routine Cracking dell'OS")
  41.     sleep(1)
  42.     print("Progresso: "..progresso.."%")
  43.     for i = 1, 3 do
  44.         progresso = progresso + 25
  45.         sleep(2)
  46.         term.setCursorPos(12,9)
  47.         print(progresso.."%")
  48.     end
  49.     sleep(3)
  50.     term.setCursorPos(12,9)
  51.     print("Completato!")
  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, #SCRITTA_BYPASS do
  61.         local char = SCRITTA_BYPASS: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(\""..SCRITTA_BYPASS.."\")")
  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 senza file \"startup\", avvio normale esecuzione...")
  83.     sleep(3)
  84.     os.reboot()
  85. end
  86.  
  87. -- Controllo della presenza del file "startup" sul Computer o Turtle
  88. -- su cui si esegue il programma
  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 Caso non ci sia il file "startup" viene notificato a schermo
  107.     -- per qualche secondo e poi il messaggio scompare
  108.     noStartup()
  109. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement