Advertisement
Guest User

door

a guest
Jun 17th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.64 KB | None | 0 0
  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. hResp = fs.open("disk/credentials", "r")
  12. sCont = hResp.readAll()
  13. hResp.close()
  14. if fs.exists("pw") == true then
  15.   hRPW = fs.open("pw", "r")
  16.   local test = hRPW.readLine()
  17.   local test2 = hRPW.readLine()
  18.   local test3 = hRPW.readLine()
  19.   local uPwRS = uPwR..test2
  20.   local uPwRSH = loginsha.sha256(uPwRS)
  21.     if test3 == uPwRSH then
  22.       print("Correct. Installing new credentials, please wait.")
  23.       sCred = logsalt.rand(150)
  24.       hWResp = fs.open("disk/credentials", "w")
  25.       hWResp.write(sCred)
  26.       hWResp.close()
  27.       hWCorr = fs.open("pw", "w")
  28.       hWCorr.writeLine("disk check file. why are you here?")
  29.       hWCorr.writeLine("
  30.      sleep(3)
  31.      term.setBackgroundColor( colors.black )
  32.      term.clear()
  33.      term.setCursorPos(1,1)
  34.      print("SecureLogin 1.4")
  35.      break
  36.    else
  37.      print("Username or password incorrect. Please try again.")
  38.      sleep(3)
  39.      end
  40.  else
  41.    print("Username or password incorrect. Please try again.")
  42.    sleep(3)
  43.    end
  44. else
  45.  print("You do not have a password file. Creating one.")
  46.  fs.delete("login/pw.lgn")
  47.  hMkPw = fs.open("login/pw.lgn", "w")
  48.  write("Enter new username: ")
  49.  NUname = read()
  50.  write("Enter new password: ")
  51.  NUpw = read("*")
  52.  sl1 = logsalt.rand(256)
  53.  NUpwF = NUpw..sl1
  54.  NUpwFS = loginsha.sha256(NUpwF)
  55.  hMkPw.writeLine(NUname)
  56.  hMkPw.writeLine(sl1)
  57.  hMkPw.writeLine(NUpwFS)
  58.  hMkPw.close()
  59.  print("Finished creation.")
  60.  sleep(5)
  61.  os.reboot()
  62.  end
  63. hRPW.close()
  64. end
  65. else
  66. print("Thanks for downloading SecureLogin 1.4. Downloading required graphics etc.")
  67. shell.run("mkdir login")
  68. shell.run("wget https://pastebin.com/raw/PJjAybwf login/img")
  69. shell.run("wget https://pastebin.com/raw/SuxqjP3s login/limg1")
  70. sleep(1)
  71. imgc = paintutils.loadImage("login/limg1")
  72. paintutils.drawImage(imgc, 1, 1)
  73. shell.run("wget https://pastebin.com/raw/WLvxP5Vn login/loginsha")
  74. sleep(1)
  75. shell.run("wget https://pastebin.com/raw/9YW1XWXN login/logsalt")
  76. sleep(2)
  77. term.clear()
  78. term.setCursorPos(1, 1)
  79. print("Initial download complete.")
  80. fs.copy(shell.getRunningProgram(), "login/login")
  81. print("Set login as startup program? (y/n)")
  82. write("Choice: ")
  83. if read() == "y" then
  84. fs.delete("startup")
  85. fs.copy("login/login", "startup")
  86. print("Set as start up file.")
  87. elseif read() == "Y" then
  88. fs.delete("startup")
  89. fs.copy("login/login", "startup")
  90. print("Set as startup file.")
  91. end
  92. os.reboot()
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement