# 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.

[((221, 247), 'os.system', 'os.system', (['"""title PassGen"""'], {}), "('title PassGen')\n", (230, 247), False, 'import os\n'), ((249, 269), 'colorama.init', 'init', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (253, 269), False, 'from colorama import init\n'), ((1796, 1806), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1804, 1806), False, 'import sys\n'), ((1282, 1307), 'random.shuffle', 'random.shuffle', (['JoinChars'], {}), '(JoinChars)\n', (1296, 1307), False, 'import random\n'), ((1539, 1560), 'random.randint', 'random.randint', (['(5)', '(17)'], {}), '(5, 17)\n', (1553, 1560), False, 'import random\n'), ((1761, 1792), 'os.system', 'os.system', (['"""start Password.log"""'], {}), "('start Password.log')\n", (1770, 1792), False, 'import os\n'), ((353, 376), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (374, 376), False, 'import datetime\n'), ((498, 521), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (519, 521), False, 'import datetime\n'), ((644, 667), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (665, 667), False, 'import datetime\n'), ((814, 837), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (835, 837), False, 'import datetime\n')]