Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- if fs.exists("login/img") then
- img = paintutils.loadImage("login/img")
- paintutils.drawImage(img, 1, 1)
- sleep(4)
- os.loadAPI("login/loginsha")
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Secure login. Please enter your username and password")
- write("Username: ")
- uName = read()
- write("Password: ")
- uPwR = read("*")
- if fs.exists("login/pw.lgn") == true then
- hRPW = fs.open("login/pw.lgn", "r")
- test = hRPW.readLine()
- test2 = hRPW.readLine()
- test3 = hRPW.readLine()
- uPwRS = uPwR..test2
- uPwRSH = loginsha.sha256(uPwRS)
- if test == uName then
- if test3 == uPwRSH then
- print("correct password. Welcome to your PC.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- print("Reinified academy SecurePC 2.0")
- break
- else
- print("Username or password incorrect. Please try again.")
- sleep(3)
- end
- else
- print("Username or password incorrect. Please try again.")
- sleep(3)
- end
- else
- print("You do not have a password file. Creating one.")
- fs.delete("login/pw.lgn")
- hMkPw = fs.open("login/pw.lgn", "w")
- write("Enter new username: ")
- NUname = read()
- write("Enter new password: ")
- NUpw = read("*")
- sl1 = math.random(1, 99999)
- sl1l = sl1..".0"
- NUpwF = NUpw..sl1l
- NUpwFS = loginsha.sha256(NUpwF)
- hMkPw.writeLine(NUname)
- hMkPw.writeLine(sl1)
- hMkPw.writeLine(NUpwFS)
- hMkPw.close()
- print("Finished creation.")
- sleep(5)
- os.reboot()
- end
- hRPW.close()
- end
- else
- shell.run("mkdir login")
- shell.run("wget pastebin.com/raw/PJjAybwf login/img")
- shell.run("wget https://pastebin.com/raw/WLvxP5Vn login/loginsha")
- print("Initial download complete. Ready to run.")
- fs.copy(shell.getRunningProgram(), "login/login")
- print("Set login as startup program? (y/n)")
- write("Choice: ")
- if read() == "y" then
- fs.delete("startup")
- fs.copy("login/login", "startup")
- elseif read() == "Y"then
- fs.delete("startup")
- fs.copy("login/login", "startup")
- end
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement