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.

PythonbeginnercliAI generated

Password Strength Auditor

Build a Python command-line tool that checks how strong a password is and explains why. It gives a score from 0 to 100 and a rating (weak, medium or strong) based on the length, the kinds of characters used, patterns such as 1234 or aaaa, and whether the password appears in a list of commonly leaked passwords, and it suggests how to improve it. Passwords are typed in hidden with getpass so they don't appear on screen or in the shell history, and a batch mode checks a whole file. It's a good first Python project: you'll learn regular expressions, sets for fast lookups, reading files, designing a scoring system, command-line arguments with argparse, and unit testing with pytest.

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

re · argparse

Project roadmap

  1. 01

    Load a list of common passwords

    ~1h

    Download a list of the most common passwords (for example the top 10,000 from the SecLists project) into a data folder. Write a function that loads it into a set of lowercase strings, so checking a password takes constant time, and reports a clear error when the file is missing. Done when: checking whether password123 is in the set returns True instantly.

  2. 02

    Check character variety with regex

    ~1h

    Write functions using the re module that detect lowercase letters, uppercase letters, digits and symbols, and patterns that make passwords weaker: the same character repeated 3 or more times, sequences like abc or 123, and keyboard runs like qwerty. Return what was found as a small data structure. Done when: unit tests show each pattern detected correctly.

  3. 03

    Combine into a score

    ~1.5h

    Combine the checks into a score from 0 to 100: points for length (with diminishing returns after 16 characters) and for each character kind, minus points for patterns, and a score of 0 for passwords in the common list. Map the score to weak, medium or strong, and collect short suggestions (for example add symbols or make it longer). Document the scoring rules in README.md. Done when: sample weak and strong passwords get sensible scores and suggestions.

  4. 04

    Build the command line

    ~1h

    Use argparse: with no arguments, ask for the password with getpass so it isn't shown; add --file for batch mode and --json for machine-readable output. Warn that passing a password as an argument leaves it in the shell history, and don't offer that option. Never print the password itself. Done when: checking a hidden password prints its score, rating and suggestions.

  5. 05

    Add batch mode and tests

    ~1.5h

    In batch mode, read one password per line and print a summary table (line number, score and rating, without the password) and the count per rating. Write pytest tests: empty and very long passwords, each rule, common passwords, the score boundaries between ratings, and batch mode with a temporary file. Done when: pytest passes.

Ready to build this?

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

~6h · 5 steps

Tech stack

reargparse