insufficient

trash python program #2

Oct 8th, 2021
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.46 KB | None | 0 0
  1. import os
  2. import time
  3. import base64
  4.  
  5. print("TERMINAL OS SETUP")
  6. print("[1]: Setup TerminalOS")
  7. print("[2]: Ive already done setup before")
  8. option = input("[?]: ")
  9. if option == "1":
  10.     # if[ option eq 1 ] --#
  11.     name = input("Enter Your Username: ")
  12.     passw = input("Enter your password: ")
  13.    
  14.     # ENCODE
  15.     name_bytes = name.encode('ascii')
  16.     b64nam_bytes = base64.b64encode(name_bytes)
  17.     name_converted_txt = b64nam_bytes.decode('ascii')
  18.     passw_bytes = passw.encode('ascii')
  19.     b64pas_bytes = base64.b64encode(passw_bytes)
  20.     passw_converted_txt = b64pas_bytes.decode('ascii')
  21.     with open('usr/username.txt', 'w') as f:
  22.         f.writelines([name_converted_txt,"_="])
  23.     with open('usr/password.txt', 'w') as f:
  24.         f.writelines([passw_converted_txt,"_="])
  25.     print("Setup Finished.")
  26.  
  27. if option == "2":
  28.     # if [ option eq 2 ] --#
  29.     # DECODE
  30.     loginname_raw = open('usr/username.txt').read()
  31.     loginname_bytes = loginname_raw.encode('ascii')
  32.     loginname_msg_bytes = base64.b64decode(loginname_bytes)
  33.     loginname = loginname_msg_bytes.decode('ascii')
  34.     loginpass_raw = open('usr/password.txt').read()
  35.     loginpass_bytes = loginpass_raw.encode('ascii')
  36.     loginpass_msg_bytes = base64.b64decode(loginpass_bytes)
  37.     loginpass = loginname_msg_bytes.decode('ascii')
  38.  
  39.     while True:
  40.         lp = input("Enter your password: ")
  41.         if lp == loginpass:
  42.             print("Log in successful")
  43.             break
Add Comment
Please, Sign In to add comment