daily pastebin goal
9%
SHARE
TWEET

logDOOR

Reinified Jun 18th, 2017 (edited) 117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.pullEvent = os.pullEventRaw
  2. if fs.exists("login/img") then
  3. img = paintutils.loadImage("login/img")
  4. paintutils.drawImage(img, 1, 1)
  5. sleep(4)
  6. os.loadAPI("login/loginsha")
  7. os.loadAPI("login/logsalt")
  8. while true do
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. print("Secure login. Enter credentials.")
  12. write("Username: ")
  13. uName = read()
  14. write("Password: ")
  15. uPwR = read("*")
  16. if fs.exists("login/pw.lgn") == true then
  17.   hRPW = fs.open("login/pw.lgn", "r")
  18.   test = hRPW.readLine()
  19.   test2 = hRPW.readLine()
  20.   test3 = hRPW.readLine()
  21.   uPwRS = uPwR..test2
  22.   uPwRSH = loginsha.sha256(uPwRS)
  23.   if test == uName then
  24.     if test3 == uPwRSH then
  25.       print("Correct password.")
  26.       redstone.setOutput("left", true)
  27.       sleep(2)
  28.       redstone.setOutput("left", false)
  29.       term.clear()
  30.       term.setCursorPos(1,1)
  31.     else
  32.       print("Username or password incorrect. Please try again.")
  33.       sleep(3)
  34.       end
  35.   else
  36.     print("Username or password incorrect. Please try again.")
  37.     sleep(3)
  38.     end
  39. else
  40.   print("You do not have a password file. Creating one.")
  41.   fs.delete("login/pw.lgn")
  42.   hMkPw = fs.open("login/pw.lgn", "w")
  43.   write("Enter new username: ")
  44.   NUname = read()
  45.   write("Enter new password: ")
  46.   NUpw = read("*")
  47.   sl1 = logsalt.rand(150)
  48.   NUpwF = NUpw..sl1
  49.   NUpwFS = loginsha.sha256(NUpwF)
  50.   hMkPw.writeLine(NUname)
  51.   hMkPw.writeLine(sl1)
  52.   hMkPw.writeLine(NUpwFS)
  53.   hMkPw.close()
  54.   print("Finished creation.")
  55.   sleep(5)
  56.   os.reboot()
  57.   end
  58. hRPW.close()
  59. end
  60. else
  61. shell.run("mkdir login")
  62. shell.run("wget https://pastebin.com/raw/PJjAybwf login/img")
  63. shell.run("wget https://pastebin.com/raw/SuxqjP3s login/limg1")
  64. imgc = paintutils.loadImage("login/limg1")
  65. paintutils.drawImage(imgc, 1, 1)
  66. sleep(1)
  67. shell.run("wget https://pastebin.com/raw/WLvxP5Vn login/loginsha")
  68. shell.run("wget https://pastebin.com/raw/9YW1XWXN login/logsalt")
  69. sleep(2)
  70. term.clear()
  71. term.setCursorPos(1, 1)
  72. print("Initial download complete.")
  73. fs.copy(shell.getRunningProgram(), "login/login")
  74. print("Set login as startup program? (y/n)")
  75. write("Choice: ")
  76. if read() == "y" then
  77. fs.delete("startup")
  78. fs.copy("login/login", "startup")
  79. print("Set as start up file.")
  80. elseif read() == "Y" then
  81. fs.delete("startup")
  82. fs.copy("login/login", "startup")
  83. print("Set as startup file.")
  84. end
  85. os.reboot()
  86. 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