SHARE
TWEET

login

a guest Jun 15th, 2017 124 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.pullEvent = os.pullEventRaw
  2. os.loadAPI("StringUtils")
  3. print("Secure login. Please enter your username and password")
  4. write("Username: ")
  5. uName = read()
  6. print(uName)
  7. write("Password: ")
  8. uPwR = read("*")
  9. if fs.exists("pw.lgn") == true then
  10.   hRPW = fs.open("pw.lgn", "r")
  11.   test = hRPW.readLine()
  12.   test2 = hRPW.readLine()
  13.   test3 = hRPW.readLine()
  14.   test4 = hRPW.readLine()
  15.   uPwRS = uPwR..test2
  16.   uPwRSH = StringUtils.SHA1(uPwRS)
  17.   print(uName)
  18.   print(test)
  19.   print(test2)
  20.   print(uPwR)
  21.   print(uPwRS)
  22.   print(uPwRSH)
  23.   print(" ")
  24.   print(test3)
  25.   print(test4)
  26.   print(" ")
  27.   print("Entered before enc: ", uPwRS)
  28.   print("Correct before enc: ", test4)
  29.   if test == uName then
  30.     if test3 == uPwRSH then
  31.       print("correct password. Welcome to your PC.")
  32.     else
  33.       print("Your username or password is incorrect")
  34.       print(uPwRSH)
  35.       end
  36.   else
  37.     print("Username or password incorrect.")
  38.     end
  39. else
  40.   print("You do not have a password file. Creating one.")
  41.   fs.delete("pw.lgn")
  42.   hMkPw = fs.open("pw.lgn", "w")
  43.   write("Enter new username: ")
  44.   NUname = read()
  45.   write("Enter new password: ")
  46.   NUpw = read("*")
  47.   sl1 = math.random(1, 99999)
  48.   NUpwF = NUpw..sl1
  49.   NUpwFS = StringUtils.SHA1(NUpwF)
  50.   hMkPw.writeLine(NUname)
  51.   hMkPw.writeLine(sl1)
  52.   print("Unique ID to prevent hacking: ", sl1)
  53.   hMkPw.writeLine(NUpwFS)
  54.   hMkPw.writeLine(NUpwF)
  55.   print("Your unencrypted password: ", NUpw)
  56.   print("Your encrypted password: ", NUpwFS)
  57.   hMkPw.close()
  58.   print("Finished creation.")
  59.   sleep(10)
  60.   os.reboot()
  61.   end
  62. hRPW.close()
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