Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- os.loadAPI("StringUtils")
- print("Secure login. Please enter your username and password")
- write("Username: ")
- uName = read()
- print(uName)
- write("Password: ")
- uPwR = read("*")
- if fs.exists("pw.lgn") == true then
- hRPW = fs.open("pw.lgn", "r")
- test = hRPW.readLine()
- test2 = hRPW.readLine()
- test3 = hRPW.readLine()
- test4 = hRPW.readLine()
- uPwRS = uPwR..test2
- uPwRSH = StringUtils.SHA1(uPwRS)
- print(uName)
- print(test)
- print(test2)
- print(uPwR)
- print(uPwRS)
- print(uPwRSH)
- print(" ")
- print(test3)
- print(test4)
- print(" ")
- print("Entered before enc: ", uPwRS)
- print("Correct before enc: ", test4)
- if test == uName then
- if test3 == uPwRSH then
- print("correct password. Welcome to your PC.")
- else
- print("Your username or password is incorrect")
- print(uPwRSH)
- end
- else
- print("Username or password incorrect.")
- end
- else
- print("You do not have a password file. Creating one.")
- fs.delete("pw.lgn")
- hMkPw = fs.open("pw.lgn", "w")
- write("Enter new username: ")
- NUname = read()
- write("Enter new password: ")
- NUpw = read("*")
- sl1 = math.random(1, 99999)
- NUpwF = NUpw..sl1
- NUpwFS = StringUtils.SHA1(NUpwF)
- hMkPw.writeLine(NUname)
- hMkPw.writeLine(sl1)
- print("Unique ID to prevent hacking: ", sl1)
- hMkPw.writeLine(NUpwFS)
- hMkPw.writeLine(NUpwF)
- print("Your unencrypted password: ", NUpw)
- print("Your encrypted password: ", NUpwFS)
- hMkPw.close()
- print("Finished creation.")
- sleep(10)
- os.reboot()
- end
- hRPW.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement