Skip to main content

Random password generator

Project description

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] [--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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

passgen-1.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

passgen-1.0.1-py2.py3-none-any.whl (6.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file passgen-1.0.1.tar.gz.

File metadata

  • Download URL: passgen-1.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for passgen-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8575327aedcc3ba75d6c05475e8d4d59cd0a2fe6d5d0246b375e9891912f96e6
MD5 404992cb10dc98c877e366ee12d993d6
BLAKE2b-256 d036a5ccad10eb314f12f52463e81223d4eada40e225ac9e0ce7e76c26884abc

See more details on using hashes here.

File details

Details for the file passgen-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for passgen-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6b0c19f3448b6ab1fd62078b9c4fb03c2ac5b06be5d79e549bc70bc7d9d36bd2
MD5 b9901d5bf301101d0e23d92a5a7705cd
BLAKE2b-256 c99b1492149976db8820bbe2ef76ddb505f99e8be9542013031974590b6f5bb2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page