main #1

Merged
p7mj merged 6 commits from SpyDrone/Sierra-Security:main into main 2026-02-01 10:04:21 -05:00
Showing only changes of commit 31d06c5abf - Show all commits

View File

@@ -1,95 +1,95 @@
# ____ _ ____ _ _ # ____ _ ____ _ _
# / ___|(_) ___ _ __ _ __ __ _ / ___| ___ ___ _ _ _ __(_) |_ _ _ # / ___|(_) ___ _ __ _ __ __ _ / ___| ___ ___ _ _ _ __(_) |_ _ _
# \___ \| |/ _ \ '__| '__/ _` | \___ \ / _ \/ __| | | | '__| | __| | | | # \___ \| |/ _ \ '__| '__/ _` | \___ \ / _ \/ __| | | | '__| | __| | | |
# ___) | | __/ | | | | (_| | ___) | __/ (__| |_| | | | | |_| |_| | # ___) | | __/ | | | | (_| | ___) | __/ (__| |_| | | | | |_| |_| |
# |____/|_|\___|_| |_| \__,_| |____/ \___|\___|\__,_|_| |_|\__|\__, | P7MJ # |____/|_|\___|_| |_| \__,_| |____/ \___|\___|\__,_|_| |_|\__|\__, | P7MJ
# Generation V. A-1 |___/ 20260128 # Generation V. A-1 |___/ 20260128
# Required imports: # Required imports:
import datetime, hashlib, uuid, sys import datetime, hashlib, uuid, sys
# To use, call sierra(). If verification is successful, user will be able to proceed, if not the entire program will terminate. # To use, call sierra(). If verification is successful, user will be able to proceed, if not the entire program will terminate.
sierra_verification_chances = 3 sierra_verification_chances = 3
def sierra_get_key(): # Get a key def sierra_get_key(): # Get a key
while True: while True:
try: try:
key = int(input("Enter a key (0-999) > ")) key = int(input("Enter a key (0-999) > "))
if 0 <= key <= 999: if 0 <= key <= 999:
return f"{key:03d}" # Format as 3-digit with leading zeros return f"{key:03d}" # Format as 3-digit with leading zeros
else: else:
print("Key must be between 0 and 999. Please try again.") print("Key must be between 0 and 999. Please try again.")
except ValueError: except ValueError:
print("Invalid input. Enter a number between 0 and 999.") print("Invalid input. Enter a number between 0 and 999.")
def sierra_create_time_code(): # Get the 12-digit time code def sierra_create_time_code(): # Get the 12-digit time code
now = datetime.datetime.now() now = datetime.datetime.now()
minutes = (now.minute // 15) * 15 # Quarter Hours minutes = (now.minute // 15) * 15 # Quarter Hours
rounded_time = now.replace(minute=minutes, second=0, microsecond=0) rounded_time = now.replace(minute=minutes, second=0, microsecond=0)
return rounded_time.strftime("%Y%m%d%H%M") #YYYYMMDDHHMM return rounded_time.strftime("%Y%m%d%H%M") #YYYYMMDDHHMM
def sierra_create_key(key, time_code): # Combine key and time code def sierra_create_key(key, time_code): # Combine key and time code
combined = f"{key}{time_code}" combined = f"{key}{time_code}"
hash_obj = hashlib.sha256(combined.encode()) hash_obj = hashlib.sha256(combined.encode())
hash_hex = hash_obj.hexdigest() hash_hex = hash_obj.hexdigest()
namespace = uuid.NAMESPACE_DNS namespace = uuid.NAMESPACE_DNS
name = combined.encode() name = combined.encode()
deterministic_uuid = uuid.uuid5(namespace, combined) deterministic_uuid = uuid.uuid5(namespace, combined)
return str(deterministic_uuid) return str(deterministic_uuid)
def sierra_verify(): def sierra_verify():
global sierra_verification_chances global sierra_verification_chances
key = sierra_get_key() key = sierra_get_key()
time_code = sierra_create_time_code() time_code = sierra_create_time_code()
correct_uuid = sierra_create_key(key, time_code) correct_uuid = sierra_create_key(key, time_code)
user_uuid = input("Enter UUID > ").strip() user_uuid = input("Enter UUID > ").strip()
# Compare # Compare
if user_uuid == correct_uuid: if user_uuid == correct_uuid:
print("Verification Successful.") print("Verification Successful.")
return True return True
else: else:
sierra_verification_chances -= 1 sierra_verification_chances -= 1
print(f"Verification Failed. {sierra_verification_chances} chances left.") print(f"Verification Failed. {sierra_verification_chances} chances left.")
def sierra_create_uuid(): def sierra_create_uuid():
key = sierra_get_key() key = sierra_get_key()
time_code = sierra_create_time_code() time_code = sierra_create_time_code()
generated_uuid = sierra_create_key(key, time_code) generated_uuid = sierra_create_key(key, time_code)
print(f""" print(f"""
Generated Key and UUID: Generated Key and UUID:
Key: {key} Key: {key}
UUID: {generated_uuid} UUID: {generated_uuid}
""") """)
def sierra(): def sierra():
global sierra_verification_chances global sierra_verification_chances
print("=" * 80) print("=" * 80)
print("Sierra Security Generation Version A-1") print("Sierra Security Generation Version A-1")
print("-" * 80) print("-" * 80)
try: try:
while True and sierra_verification_chances > 0: while True and sierra_verification_chances > 0:
print("""Select a mode: print("""Select a mode:
[1] Generate a UUID [1] Generate a UUID
[2] Exit [2] Exit
""") """)
choice = input("Enter your choice > ").strip() choice = input("Enter your choice > ").strip()
if choice == "1": if choice == "1":
sierra_create_uuid() sierra_create_uuid()
elif choice == "2": elif choice == "2":
print("Exiting.") print("Exiting.")
sys.exit(0) sys.exit(0)
else: else:
print("Error: Invalid choice.") print("Error: Invalid choice.")
sys.exit(0) sys.exit(0)
except KeyboardInterrupt: except KeyboardInterrupt:
print("\nUser Terminated (Ctrl + C.)") print("\nUser Terminated (Ctrl + C.)")
if __name__ == "__main__": if __name__ == "__main__":
sierra() sierra()
# ========================================================================================================== # ==========================================================================================================