SHARE
TWEET

autorun.lua

a guest Oct 22nd, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local event = require('event')
  2. local term = require('term')
  3. local gpu = require('component').gpu
  4. local W, H = gpu.getResolution()
  5. local color1, color2 = 0x00FF00, 0xFF0000
  6. local password = '42069' -- needed hash function, for most security
  7.  
  8. event.shouldInterrupt = function() return false end -- blocking Ctrl+Alt+C
  9. event.shouldSoftInterrupt = function() return false end -- blocking Ctrl+C
  10.  
  11. gpu.setForeground(color1)
  12. while true do
  13.   term.clear()
  14.   term.setCursor(W/2-10, H/2)
  15.   term.write('PASSWORD: ')
  16.   local input = term.read(_,_,_,'*'):sub(1, -2)
  17.   if input == password then
  18.     term.clear()
  19.     term.setCursor(1, 1)
  20.     gpu.setForeground(0xFFFFFF)
  21.     os.exit()
  22.   else
  23.     term.clear()
  24.     gpu.setForeground(color2)
  25.     term.setCursor(W/2-6, H/2)
  26.     term.write('ACCESS DENIED')
  27.     gpu.setForeground(color1)
  28.     os.sleep(3)
  29.   end
  30. 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