Advertisement
YourMCInformer

Advanced Password Utility setup

Sep 4th, 2015
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.91 KB | None | 0 0
  1. local isColour = term.isColour()
  2.  
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. term.setBackgroundColour(colours.blue)
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. term.setTextColour(colours.white)
  9. if isColour == true then
  10.   term.write("ADVANCED PASSWORD UTILITY SETUP")
  11.   term.setCursorPos(1,3)
  12.   term.write("This setup will install Advanced Password Utility")
  13.   term.setCursorPos(1,4)
  14.   term.write("onto your computer. By continuing through this")
  15.   term.setCursorPos(1,5)
  16.   term.write("setup, you agree to never redistribute the utility")
  17.   term.setCursorPos(1,6)
  18.   term.write("nor the setup. You will also agree to never alter")
  19.   term.setCursorPos(1,7)
  20.   term.write("and share the setup utility in any way, shape or")
  21.   term.setCursorPos(1,8)
  22.   term.write("form, be that electronically or physically.")
  23.   term.setCursorPos(1,9)
  24.   term.setTextColour(colours.yellow)
  25.   term.write("To begin installation, press Enter/Return")
  26.   term.setCursorPos(1,10)
  27.   term.write("To exit the installation, press F1")
  28.   term.setTextColour(colours.grey)
  29.   term.setCursorPos(1,18)
  30.   term.write("Version 1.2")
  31. else
  32.   shell.run("pastebin get tvYEAjbq")
  33.   print("Enter desired passcode: ")
  34.   local passcode = read("*")
  35.   print("Confirm passcode: ")
  36.   local passcode2 = read("*")
  37.   if passcode == passcode2 then
  38.     print("Setup complete. Restarting")
  39.     sleep(1)
  40.     os.reboot()
  41.   else
  42.     print("Password is incorrect. Please try setup again")
  43.   end
  44. end
  45.  
  46. function setup()
  47.   term.clear()
  48.   term.setCursorPos(1,1)
  49.   term.setTextColour(colours.white)
  50.   shell.run("pastebin get tvYEAjbq startup")
  51.   term.write("ADVANCED PASSWORD UTILITY SETUP")
  52.   term.setCursorPos(1,3)
  53.   term.write("Please enter your password, then press Enter")
  54.   local pwFileExist = fs.exists("password")
  55.   if pwFileExist == true then
  56.     term.setCursorPos(1,10)
  57.     term.setTextColour(colours.red)
  58.     term.write("WARNING! Password file already exists,")
  59.     term.setCursorPos(1,11)
  60.     term.write("overwriting it!")
  61.   end
  62.   local filename = 'password'
  63.   local userfile = fs.open(filename, 'a')
  64.   term.setCursorPos(1,4)
  65.   term.setBackgroundColour(colours.black)
  66.   term.write("                                                  ")
  67.   term.setCursorPos(1,4)
  68.   input = read("*")
  69.   --aesInput = encryption.encrypt("password",input.."1qAzT53G")
  70.   term.setCursorPos(1,5)
  71.   term.setBackgroundColour(colours.blue)
  72.   userfile.writeLine(input)
  73.   userfile.close()
  74.   term.setCursorPos(1,6)
  75.   term.write("Setup is complete. Rebooting in 2 seconds")
  76.   sleep(2)
  77.   os.reboot()
  78. end
  79.  
  80. local sEvent, param = os.pullEvent("key")
  81. if sEvent == "key" then
  82.   if param == 28 then
  83.     setup()
  84.   elseif param == 59 then
  85.     shell.run("rm startup")
  86.     term.setBackgroundColour(colours.black)
  87.     term.clear()
  88.     term.setCursorPos(1,1)
  89.     term.write("Advanced Password Utility setup was cancelled")
  90.     term.setCursorPos(1,2)
  91.     sleep(0.5)
  92.     shell.run("rom/programs/shell")
  93.   end
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement