Skip to content

Commit

Permalink
Merge pull request #6 from aarikpokras/codespace-aarikpokras-opulent-…
Browse files Browse the repository at this point in the history
…space-telegram-wj7pj75g7r639556

Codespace aarikpokras opulent space telegram wj7pj75g7r639556
  • Loading branch information
aarikpokras authored Dec 17, 2022
2 parents d785499 + 1a3f4cf commit d51536d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
Binary file added home/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions home/specs/pw
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$2b$12$Nnx.air.Tgpt8w.zRtgd/uW22ZXsYh7XxMQlkZKFca5GX/.RqZed2
1 change: 0 additions & 1 deletion home/testuser/pw

This file was deleted.

49 changes: 37 additions & 12 deletions start.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import os
import maskpass
import bcrypt
from version import ver
# def checkpw(pw: str) -> str:
# with open(f"home/{signInUn}/pw", "r") as f:
# return bcrypt.checkpw(pw.encode(), f.read().encode())
# vers=version.ver
print("Welcome to spectacleOS! This is version "+ver+" command line.")
name=input('Enter desired hostname. ==> ')
Expand All @@ -12,28 +16,49 @@
os.chdir('home')
os.mkdir(newUserNameUn)
os.chdir(newUserNameUn)
pwF = open("pw", "w")
#
#
pwF = open("pw", "wb")
pwText=newUserPw
pwF.write(pwText)
print("Returning Password.")
pwF = open("pw", "r")
pwRead=pwF.read()
print(pwRead)
bytes=newUserPw.encode('utf-8')
salt=bcrypt.gensalt()
hash=bcrypt.hashpw(bytes, salt)
pwF.write(hash)
#
#
print("Account successfully created. Please sign in. Exiting.")
exit()
if user == "s":
signInUn=input("Username> ")
os.system('sudo chmod +rw home/'+signInUn+'/pw')
#os.chdir('home/'+signInUn)
pwReadS = open("home/"+signInUn+"/pw", "r")
#
#
pwReadS = open("home/"+signInUn+"/pw", "rb")
pwFullRead=pwReadS.read()
signInPw=maskpass.askpass(prompt='Enter Password: ', mask='*')
if pwReadS.read() == signInPw:
salt=bcrypt.gensalt()
bytes=signInPw.encode('utf-8')
# hashnew=bcrypt.hashpw(bytes, salt)
bcrypt.checkpw(bytes, pwFullRead)
if bcrypt.checkpw(bytes, pwFullRead):
os.chdir("home/"+signInUn)
print("Sign-in ok. Welcome to spectacleOS, "+signInUn+"! Remember, you are responsible for doing `chmod -rw` on your password file!")
import cmd
if pwReadS.read() != signInPw:
print("Sign-in failed.")
print("Sign-in ok. Welcome to spectacleOS, "+signInUn+"!")
if bcrypt.checkpw(bytes, pwFullRead) == False:
print("Username or password incorrect. Exiting.")
exit()
# if pwReadS.read() != hashnew:
# print('no.')
# elif pwReadS.read() == hashnew:
# os.chdir("home/"+signInUn)
# print ("Sign-in ok. Welcome to spectacleOS, "+signInUn+"!")
# if checkpw == signInPw:
# os.chdir("home/"+signInUn)
# print("Sign-in ok. Welcome to spectacleOS, "+signInUn+"! Remember, you are responsible for doing `chmod -rw` on your password file!")
import cmd
# if pwReadS.read() != signInPw:
# print("Sign-in failed.")
# exit()


# Make continous imports of py files to make full command line file - import variables with import <filename>, then to import variables, <new-var-name>=<filename>.<old-var-name>

0 comments on commit d51536d

Please sign in to comment.