Skip to main content

passgen

passgen is a tool for generating random passwords. It provides both command line utility and underlying python module.

Installation

passgen requires Python 2.7 or 3.x.

passgen can be installed with pip:

$ pip install passgen

To install it from source, enter the source distribution directory and run:

$ python setup.py install

To install in development mode, run from project directory:

$ pip install --user -e .

Usage (command line)

The most basic usage of passgen command line utility prints 10 random passwords, and is as follows:

$ passgen

passgen accepts several arguments configuring its outcome. Overall synopsis is:

$ passgen [-h] [-l LENGTH] [-n NUMBER]
          [-p] [--limit-punctuation LIMIT_PUNCTUATION]
          [--no-digits | --no-letters]
          [--upper | --lower]

Arguments:

-h

Display help

-l, --length LENGTH

Passwords should contain LENGTH characters. Defaults to 12.

-n, --number NUMBER

Generate NUMBER passwords. Defaults to 10.

-p, --punctuation

Use punctuation characters

--limit-punctuation LIMIT_PUNCTUATION

Specify allowed punctuation characters

--no-digits

Don’t use digits

--no-letters

Don’t use letters

--upper

Use only upper case letters

--lower

Use only lower case letters

Examples

Below are some examples of passgen usage.

Output one password:

$ passgen -n 1
faFMKqApw24P

Generate one password with eight characters:

$ passgen -n 1 -l 8
h2MowzBQ

Generate one password with all upper case letters:

$ passgen -n 1 --upper
3TLJ73WQSG6U

Generate one password with punctuation characters:

$ passgen -n 1 -p
oFmCF|s8kCE~

Python module

passgen Python module provides just one function also called passgen.

passgen(length=12, punctuation=False, digits=True, letters=True, case='both')

It returns a random string with length characters. punctuation, digits and letters arguments specify whether punctuation, digits and letters should be used. case specifies letter case and can be one of ‘upper’, ‘lower’ or ‘both’.

For more details, run:

$ python -c 'import passgen; help(passgen.passgen)'

Testing

The passgen tests are done using unittest. For running the tests, run from project directory:

$ python tests/test_passgen.py -v

TODO

  • Implement generation from format string. For example, ‘ddd’ generating three-digit password.

  • Allow occurance restrictions on punctuation, digits and letters. For example, passgen(min-punctuation=1) returning password with at least one punctuation.

License

See LICENSE.

Metadata

Release files for passgen 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for passgen 1.1.1
File Size Uploaded Provenance
passgen-1.1.1.tar.gz 5.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for passgen 1.1.1
File Interpreter ABI Platform
passgen-1.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 11.2 kB

Release files / passgen-1.1.1.tar.gz

Download URL passgen-1.1.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ed9680f4d9f3565c4cecc49c847934bcc75aa2264b47b9f5e7439d512a75a796
BLAKE2b-256 checksum
How to use checksums
0c7e6a9e2731575648d3072928c30dd7ea954fdc0f4520858ee36a2a63b24d92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

Release files / passgen-1.1.1-py2.py3-none-any.whl

Download URL passgen-1.1.1-py2.py3-none-any.whl
Size 5.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
83059543bdec78024e687c8c790ddc77bfa4d24f01448ce67c701945ff5f1109
BLAKE2b-256 checksum
How to use checksums
baa0c7d876f2625bc60737a58b4de6389580e0c8010ff699763314378b704e76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

Security for passgen 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page