Help us measure site usage?

With your permission, we use self-hosted analytics to understand page usage. It is optional and does not affect the Service. Learn more.

BashbeginnercliAI generated

Password Generator & Strength Checker

Build a Bash tool that creates strong random passwords and checks how strong an existing password is. It reads randomness from /dev/urandom, keeps only the characters you choose (lowercase, uppercase, digits and symbols) with tr, guarantees at least one of each chosen kind, and can copy the result to the clipboard. The checker estimates a password's strength in bits of entropy and labels it weak to very strong, warning about common patterns such as dictionary words or repeated characters. It's a good first shell scripting project: you'll learn options with getopts, pipes and tr, basic randomness and entropy math, detecting available commands, and handling input safely.

Estimate
~5.5h
Steps
5
Completed by
0
Proposed by
codeseed.app

/dev/urandom · tr · getopts

Project roadmap

  1. 01

    Generate random characters

    ~1h

    Write passgen.sh with set -euo pipefail that builds a password by reading from /dev/urandom through tr -dc with the allowed characters and taking the first N with head -c. Explain in a comment why /dev/urandom is suitable and $RANDOM is not. Done when: running the script prints a random 16-character password each time.

  2. 02

    Add options

    ~1h

    Use getopts for -l LENGTH (8 to 128, default 16), -n to exclude digits, -s to exclude symbols, -u to exclude uppercase, and -c COUNT to generate several. Validate the values and print usage for invalid ones. Make sure every chosen kind appears at least once (for example by regenerating until it does, and explaining why that's fine). Done when: every option works, and passwords always include each chosen kind.

  3. 03

    Check password strength

    ~1.5h

    Add a check mode (-k) that reads a password from standard input without showing it (read -rs) so it doesn't end up in the shell history, detects which kinds of characters it uses, and computes entropy as length × log2(pool size) using awk or bc. Label it weak, fair, strong or very strong, and warn about common patterns: all one kind of character, repeated characters, sequences like 1234 or abcd, and words from a small list of common passwords. Done when: known weak and strong passwords get sensible labels and warnings.

  4. 04

    Copy to the clipboard

    ~0.5h

    Add -x to copy the password to the clipboard using the first available tool (wl-copy, xclip or pbcopy, detected with command -v), printing a message when none is available. Offer to clear the clipboard after 30 seconds. Done when: -x copies the password on your system, and a clear message appears when no clipboard tool exists.

  5. 05

    Document and test

    ~1.5h

    Add --help with examples. Write tests with bats-core: lengths, excluded character kinds never appearing, every chosen kind present, invalid options, and the checker's labels for sample passwords. Run shellcheck. Done when: the tests pass, and shellcheck reports no warnings.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~5.5h · 5 steps

Tech stack

/dev/urandomtrgetopts