SHOW:
|
|
- or go back to the newest paste.
| 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. Please enter your username and password")
|
| 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. Welcome to your PC.")
|
| 25 | + | print("Correct password.")
|
| 26 | redstone.setOutput("left", true)
| |
| 27 | sleep(2) | |
| 28 | redstone.setOutput("left", false)
| |
| 29 | - | print("Reinified academy SecurePC 2.0")
|
| 29 | + | |
| 30 | - | break |
| 30 | + | |
| 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(25) |
| 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 | - | imgc = paintutils.loadImage("login/img")
|
| 61 | + | |
| 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 | - | shell.run("wget https://pastebin.com/raw/PSyahsTY login/limg2")
|
| 66 | + | |
| 67 | - | shell.run("wget https://pastebin.com/raw/j9aWDcNQ login/limg3")
|
| 67 | + | |
| 68 | - | shell.run("wget https://pastebin.com/raw/9byDY6za login/limg4")
|
| 68 | + | |
| 69 | - | shell.run("wget https://pastebin.com/raw/qX5dWTH9 login/limg5")
|
| 69 | + | |
| 70 | term.clear() | |
| 71 | - | imgc = paintutils.loadImage("login/limg2")
|
| 71 | + | |
| 72 | print("Initial download complete.")
| |
| 73 | fs.copy(shell.getRunningProgram(), "login/login") | |
| 74 | print("Set login as startup program? (y/n)")
| |
| 75 | - | imgc = paintutils.loadImage("login/limg3")
|
| 75 | + | |
| 76 | if read() == "y" then | |
| 77 | fs.delete("startup")
| |
| 78 | fs.copy("login/login", "startup")
| |
| 79 | - | imgc = paintutils.loadImage("login/limg4")
|
| 79 | + | |
| 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 |