Remove a few leftover lines
This commit is contained in:
parent
9f2c7c2b88
commit
0b22731076
15
keygen.py
15
keygen.py
@ -40,18 +40,14 @@ def decrypt_uploadkeys():
|
|||||||
proceed = ask_yn("Do you wish to proceed to clearing the uploadkeys file? [y/n] ")
|
proceed = ask_yn("Do you wish to proceed to clearing the uploadkeys file? [y/n] ")
|
||||||
|
|
||||||
if proceed:
|
if proceed:
|
||||||
print("Proceed1")
|
|
||||||
os.remove("uploadkeys")
|
os.remove("uploadkeys")
|
||||||
print("Removed uploadkeys file.")
|
print("Removed uploadkeys file.")
|
||||||
proceed2 = ask_yn("Would you like to continue and generate a new key? [y/n] ")
|
proceed2 = ask_yn("Would you like to continue and generate a new key? [y/n] ")
|
||||||
if not proceed2:
|
if not proceed2:
|
||||||
print("not proceed2")
|
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
print("proceed2")
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
print("not Proceed1")
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@ -98,21 +94,10 @@ if __name__ == "__main__":
|
|||||||
print("Please run this as the correct user with: sudo su [user] -s /bin/sh -c 'python3 keygen.py'")
|
print("Please run this as the correct user with: sudo su [user] -s /bin/sh -c 'python3 keygen.py'")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Decrypt the existing keyfile
|
|
||||||
secret = load_secret()
|
|
||||||
keyf = Fernet(secret)
|
|
||||||
|
|
||||||
genkey = True
|
|
||||||
uploadkeysp = Path("uploadkeys")
|
uploadkeysp = Path("uploadkeys")
|
||||||
if not uploadkeysp.is_file():
|
if not uploadkeysp.is_file():
|
||||||
uploadkeysp.touch()
|
uploadkeysp.touch()
|
||||||
else:
|
|
||||||
with open("uploadkeys", "rb") as ukf:
|
|
||||||
# read the encrypted data
|
|
||||||
encrypted_data = ukf.read()
|
|
||||||
|
|
||||||
|
|
||||||
if genkey:
|
|
||||||
if decrypt_uploadkeys(): # Decrypt the file
|
if decrypt_uploadkeys(): # Decrypt the file
|
||||||
N = 64 # Size of key
|
N = 64 # Size of key
|
||||||
key = ''.join(secrets.choice(string.ascii_letters + string.digits) for i in range(N))
|
key = ''.join(secrets.choice(string.ascii_letters + string.digits) for i in range(N))
|
||||||
|
Reference in New Issue
Block a user