90 Snippets: Yet another day of Shell Scripting โšก๏ธ๐ŸŽ‰

90 Snippets: Yet another day of Shell Scripting โšก๏ธ๐ŸŽ‰

90 Projects towards mastery - Day 03 โœจ


3 min read

Hey, fellow tech enthusiasts! Astro here, and I've got something cool to share with you - passgen v1.0, the ultimate password generator! ๐Ÿ”๐Ÿ”ฅ

Link to repo: passgen

Unraveling the Magic: Captivating Code Snippets! ๐Ÿ”๐ŸŽฉ

The Colorful Welcome Message: A Glimpse of Enchantment! ๐ŸŒˆโœจ

code# Colors
# ... Other color codes ...

# Welcome message
... Welcome message content ...

# Display welcome message
function DISPLAY_MESSAGE() {
    echo -e "${GREEN}${WELCOME_MESSAGE}${RESET}"

The Welcome Message casts a spell on users with its vibrant colors and enchanting ASCII art! ๐Ÿ’ซ The color codes are defined at the beginning of the script, adding a touch of magic to the text. The DISPLAY_MESSAGE() function displays the mesmerizing welcome message and sets the stage for the password generation journey! ๐ŸŒŒ

Command Line Interface (CLI): Embrace Your Inner Wizard! ๐Ÿง™โ€โ™‚๏ธ๐Ÿ”ฎ

code# User input
# ... Other variable declarations ...

# The CLI loop
function CLI() {
    while true; do
        shopt -s nocasematch
        if [[ "${INPUT}" == "GEN" ]]; then
        elif [[ "${INPUT}" == "SHOW" ]]; then
        elif [[ "${INPUT}" == "SAVE" ]]; then
        elif [[ "${INPUT}" == "HELP" ]]; then
        elif [[ "${INPUT}" == "EXIT" ]]; then

Behold the CLI, where you take on the role of a tech wizard! ๐Ÿง™โ€โ™‚๏ธ The CLI() function powers the interactive experience, constantly awaiting your command. Upon entering a command, the script uses pattern matching (nocasematch) to identify the user's intent and calls the respective functions. The CLI loop keeps the magic alive, allowing you to execute commands seamlessly and take full control! ๐Ÿง™โ€โ™‚๏ธ๐Ÿ”ฎ

Unleashing the Power of Strong Passwords: The "GEN" Function! ๐Ÿ—๏ธ๐Ÿ”’

code# generate a new strong password (at least 16 chars, contains at least: 1 uppercase, 1 lowercase, 1 number, 1 special char)
function GEN() {
    PASS=$(openssl rand -base64 48 | cut -c1-16)
    echo -e "\tPassword generated successfully! ๐ŸŽ‰"

The "GEN" function is the heart of passgen v1.0! It casts a spell to generate strong and secure passwords, consisting of at least 16 characters with a mix of uppercase, lowercase, numbers, and special characters. The openssl command brings the magic to life, creating virtually unbreakable passwords! ๐ŸŒŸ๐Ÿ”

๐Ÿช„๐Ÿš€ Unleash the Tech Wizard Within! ๐Ÿš€๐Ÿช„

With these captivating code snippets, you now hold the key to unlock the secrets of passgen v1.0! Embrace your inner tech wizard and embark on a journey of password mastery. Let your spells of strong passwords protect your digital realm, making it impervious to any threat. By Thor, By Odin, you are now ready to wield the power of passgen v1.0 and safeguard your digital kingdom! ๐Ÿ—๏ธ๐Ÿ’ปโœจ

Unleash Your Inner Tech Wizard with passgen v1.0! ๐ŸŒŸโœจ

The journey of passgen v1.0 has just begun, and it's time for you to take the reins! Channel your inner tech wizard and dive into the world of secure passwords. Be the guardian of your digital fortress and unlock the secrets of passgen v1.0! Together, we'll make the digital realm a safer place! ๐Ÿฐ๐Ÿ›ก๏ธ

So, let's embark on this thrilling adventure of passgen v1.0, where you'll become a tech wizard like no other! ๐ŸŽ‡๐Ÿš€ May your passwords be strong, and your tech skills shine brightly! By Thor, By Odin, let's make our mark in the tech realm! ๐Ÿ’ป๐Ÿ”ฎ