Skip to content

Repository files navigation

Password Management System

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.

Features

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

Quick Start

python -m venv .venv
source .venv/bin/activate  # On Windows use .venv\Scripts\activate
pip install -r requirements.txt
python main.py --help

CLI Overview

  • python main.py generate --quantity 20 --file my_passwords --show
    Generates 20 policy-compliant passwords, writes them to my_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; use python main.py login alice "ValidPass1" to authenticate.
  • python main.py policy
    Displays the current password policy values.

Browser UI & API

python main.py flask --host 0.0.0.0 --port 5000 --debug

Then open http://127.0.0.1:5000/ for the browser dashboard. The same service exposes JSON endpoints:

  • POST /gpw with {"quantity": 5} → returns generated passwords.
  • POST /hibp with {"password": "MySecret123"} → returns a breach count.

Running Tests

pytest

Tests isolate the users/ directory and mock external HIBP calls for deterministic results.

Docker & Compose

docker build -t pms .
docker run -p 5000:5000 pms
# or
docker compose up api
docker compose run --rm tests

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

Configuration

  • 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 --directory is specified.

About

a simple password manager system

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages