Modernised password management toolkit offering a Typer-based CLI, a lightweight Flask API, and robust password policy enforcement. The application can generate compliant credentials, validate passwords against the Have I Been Pwned (HIBP) database, and manage a simple JSON-backed user store.
- Strong password generation that honours configurable policies stored in
pw_policies.json. - Local user account creation and login flow with SHA-512 hashing and policy checks.
- HIBP range-query integration with graceful error handling.
- Flask API for password generation and breach lookups.
- Browser UI (Flask + Jinja) for generating passwords, checking breaches, and managing accounts.
- Comprehensive pytest suite and Docker-based workflows.
python -m venv .venv
source .venv/bin/activate # On Windows use .venv\Scripts\activate
pip install -r requirements.txt
python main.py --helppython main.py generate --quantity 20 --file my_passwords --show
Generates 20 policy-compliant passwords, writes them tomy_passwords.txt, and prints them.python main.py hibp "MySecret123"
Reports how many times the password has appeared in known breaches.python main.py signup alice "ValidPass1"
Creates a new local account; usepython main.py login alice "ValidPass1"to authenticate.python main.py policy
Displays the current password policy values.
python main.py flask --host 0.0.0.0 --port 5000 --debugThen open http://127.0.0.1:5000/ for the browser dashboard. The same service exposes JSON endpoints:
POST /gpwwith{"quantity": 5}→ returns generated passwords.POST /hibpwith{"password": "MySecret123"}→ returns a breach count.
pytestTests isolate the users/ directory and mock external HIBP calls for deterministic results.
docker build -t pms .
docker run -p 5000:5000 pms
# or
docker compose up api
docker compose run --rm testsThe container exposes port 5000 for the web UI and API. Visit http://127.0.0.1:5000/ after docker compose up api to use the dashboard.
- Adjust password rules in
pw_policies.json(min length, casing, digits, symbols). - User records are stored as JSON files under
users/; keep this folder out of version control for real deployments. - Generated password files default to the current working directory unless
--directoryis specified.