SHARE
TWEET

nuke

a guest Nov 22nd, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. local id
  16. local g
  17. if component.isAvailable("gpu") then
  18.   g = component.gpu
  19. end
  20.  
  21. function wipe()
  22.   event.cancel(id)
  23.   component.computer.beep(100,3)
  24.   local w, h = g.getResolution()
  25.   g.setBackground(0x0000FF)
  26.   term.clear()
  27.   g.set(w/2-("Should've been quicker."):len()/2,h/2,"Should've been quicker.")
  28.   fs.remove("/boot")
  29.   fs.remove("/home")
  30.   component.eeprom.set("")
  31.   fs.remove("/bin")
  32.   fs.remove("/autorun.exe")
  33.   os.exit()
  34. end
  35.  
  36. if component.isAvailable("gpu") then
  37.   term.clearLine()
  38.   local g = component.gpu
  39.   g.setForeground(0xFF0000)
  40.   local wd = shell.getWorkingDirectory()
  41.   local x, y = term.getCursor()
  42.   print(wd.." # ")
  43.   g.setForeground(0xFFFFFF)
  44.   term.setCursor(wd:len() + 4, y)
  45.   local input = io.read()
  46.   if input == "cancel" then  
  47.     g.setForeground(0xFF0000)
  48.     id = event.timer(5, wipe)
  49.     print("Data will be wiped in 5 seconds or if an incorrect password is entered. Enter password now.\n")
  50.     local pass = io.read()
  51.     local file = io.open("/bin/password.txt","r")
  52.     local content = file:read("*a")
  53.     file:close()
  54.    
  55.     if pass == "s3cr3t" then
  56.       local succ = event.cancel(id)
  57.       g.setForeground(0x00FF00)
  58.       if succ then
  59.         print("Cancelled sucessfully.")
  60.       else
  61.         g.setForeground(0x00FF00)
  62.         print("Error cancelling timer. shutting down")
  63.         component.computer.stop()
  64.       end
  65.       os.sleep(3)
  66.       os.exit()
  67.     else
  68.       wipe()
  69.     end
  70.   else
  71.     id = event.timer(1, wipe)
  72.     wipe()
  73.   end
  74. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top