# PassGen
# These imports will be used for this project.
from colorama import Fore, Style
from colorama import init
import datetime
import string
import random
import sys
import os

# Initilaze File organizer.
os.system('title PassGen')
init(autoreset = True)

# Create Log Functions.
class LOG:
	def INFO_LOG(message):
		CurrentTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
		print(f"{CurrentTime} - INFO: {message}")

	def STATUS_LOG(message):
		CurrentTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
		print(f"{CurrentTime} - STATUS: {message}")

	def ERROR_LOG(message):
		CurrentTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
		print(Fore.RED + Style.BRIGHT + f"{CurrentTime} - ERROR: {message}")

	def WARN_LOG(message):
		CurrentTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
		print(Fore.YELLOW + Style.BRIGHT + f"{CurrentTime} - WARNING: {message}")

# This will Generate a Strong Password for the User!
def Generate(PassLen):
	JoinChars = [] # Create an Empty List.

	# Split the List of these String Operations, and Join them to JoinChars List.
	JoinChars.extend(list(string.ascii_letters))
	JoinChars.extend(list(string.digits))
	JoinChars.extend(list(string.punctuation))
	random.shuffle(JoinChars) # Shuffle the List.

	# Get the random passoword.
	return "".join(JoinChars[0:PassLen])

# Code Logic here.
LOG.WARN_LOG("Initialized PassGen!")
LOG.STATUS_LOG("Generating a Random Password for You.")

Password = Generate(random.randint(5, 17))
LOG.INFO_LOG(f"Your Password is: {Password}")
with open("Password.log", "a") as File: File.write(f"{Password}\n")
if (len(sys.argv) == 1) or (len(sys.argv) > 1 and sys.argv[1].lower() != "-o"):
	os.system("start Password.log")

sys.exit() # Exiting the program successfully.

[((12, 0, 12, 26), 'os.system', 'os.system', ({(12, 10, 12, 25): '"""title PassGen"""'}, {}), "('title PassGen')", False, 'import os\n'), ((13, 0, 13, 22), 'colorama.init', 'init', (), '', False, 'from colorama import init\n'), ((56, 0, 56, 10), 'sys.exit', 'sys.exit', ({}, {}), '()', False, 'import sys\n'), ((41, 1, 41, 26), 'random.shuffle', 'random.shuffle', ({(41, 16, 41, 25): 'JoinChars'}, {}), '(JoinChars)', False, 'import random\n'), ((50, 20, 50, 41), 'random.randint', 'random.randint', ({(50, 35, 50, 36): '5', (50, 38, 50, 40): '17'}, {}), '(5, 17)', False, 'import random\n'), ((54, 1, 54, 32), 'os.system', 'os.system', ({(54, 11, 54, 31): '"""start Password.log"""'}, {}), "('start Password.log')", False, 'import os\n'), ((18, 16, 18, 39), 'datetime.datetime.now', 'datetime.datetime.now', ({}, {}), '()', False, 'import datetime\n'), ((22, 16, 22, 39), 'datetime.datetime.now', 'datetime.datetime.now', ({}, {}), '()', False, 'import datetime\n'), ((26, 16, 26, 39), 'datetime.datetime.now', 'datetime.datetime.now', ({}, {}), '()', False, 'import datetime\n'), ((30, 16, 30, 39), 'datetime.datetime.now', 'datetime.datetime.now', ({}, {}), '()', False, 'import datetime\n')]