Skip to main content

Advanced password generator and hasher

Project description

opensesame

Advanced password generator and hasher made in Python.

Installation

From PyPI(any OS)

python3 -m pip install opensesame

Directly from GitHub(Linux only)

git clone "https://github.com/jenca-adam/opensesame/" opensesame_build
cd opensesame_build
./setup.sh
cd ..
rm -rf opensesame_build

You can also use sudo python3 setup.py install, but setup.sh allows local installation.

CLI

opensesame CLI supports two commands:
1.generate for generating passwords(default)

Usage: python -m opensesame generate [OPTIONS]

Options:
  -t, --type [chars|characters|c|word|w|pronounceable|p]
                                  generation method to use
  --min INTEGER                   Minimal number of characters in password
                                  (has no effect if type is word)
  --max INTEGER                   Maximal number of characters in password
                                  (has no effect if type is word)
  -l, --length INTEGER            Precise number of characters in password.
                                  Overrides --min and --max (has no effect if
                                  type is word)
  -s, --number-suffix INTEGER     Length of number suffix
  -c, --copy                      Use this to copy the generated password to
                                  the clipboard
  -h, --hash                      Print also the password hash
  -a, --algorithm [sha3_384|sha512|blake2b|sha1|sha224|sha3_512|sha256|shake_256|md5|sha384|shake_128|sha3_256|sha3_224|blake2s]
                                  Hashing algorithm to use with -h. Default
                                  MD5. (If -h is not set, has no effect)
  -L, --lowercase                 If type is chars, adds lowercase ASCII to
                                  the generation set. This flag is
                                  automatically set if none of -U,-D,-S,-A,-C
                                  is set.
  -U, --uppercase                 If type is chars, adds uppercase ASCII to
                                  the generation set
  -D, --digits                    If type is chars, adds decimal digits to the
                                  generation set
  -S, --symbols                   If type is chars, adds ASCII symbols to the
                                  generation set
  -A, --all                       If type is chars, adds all groups to the
                                  generation set
  -C, --copy-hash                 Use this to copy the generated hash to
                                  clipboard. Has no effect if -h is not set.
  -n, --number INTEGER            Number of passwords to generate
  -i, --infinite                  Constantly generates passwords. Overrides
                                  -n.
  --help                          Show this message and exit.

2.hash for hashing passwords.

Usage: python -m opensesame hash [OPTIONS]

Options:
  -i, --input FILENAME            Input to read from. Default is stdin
  -o, --output FILENAME           Output to write to. Default is stdout
  -a, --algorithm [sha224|blake2b|sha3_384|sha384|blake2s|sha1|shake_128|sha3_224|sha512|sha3_256|sha3_512|sha256|md5|shake_256]
                                  Hashing algorithm to use. Default MD5
  -b, --bytes-digest              Output normal digest instead of hexdigest.
  -r, --repr                      If -b is set, outputs Python internal string
                                  representation of bytes output
  --help                          Show this message and exit.

Python lib

Generation methods

opensesame

Advanced password generator and hasher made in Python.

Installation

From PyPI(any OS)

python3 -m pip install opensesame

Directly from GitHub(Linux only)

git clone "https://github.com/jenca-adam/opensesame/" opensesame_build
cd opensesame_build
./setup.sh
cd ..
rm -rf opensesame_build

You can also use sudo python3 setup.py install, but setup.sh allows local installation.

CLI

opensesame CLI supports two commands:
1.generate for generating passwords(default)

Usage: python -m opensesame generate [OPTIONS]

Options:
  -t, --type [chars|characters|c|word|w|pronounceable|p]
                                  generation method to use
  --min INTEGER                   Minimal number of characters in password
                                  (has no effect if type is word)
  --max INTEGER                   Maximal number of characters in password
                                  (has no effect if type is word)
  -l, --length INTEGER            Precise number of characters in password.
                                  Overrides --min and --max (has no effect if
                                  type is word)
  -s, --number-suffix INTEGER     Length of number suffix
  -c, --copy                      Use this to copy the generated password to
                                  the clipboard
  -h, --hash                      Print also the password hash
  -a, --algorithm [sha3_384|sha512|blake2b|sha1|sha224|sha3_512|sha256|shake_256|md5|sha384|shake_128|sha3_256|sha3_224|blake2s]
                                  Hashing algorithm to use with -h. Default
                                  MD5. (If -h is not set, has no effect)
  -L, --lowercase                 If type is chars, adds lowercase ASCII to
                                  the generation set. This flag is
                                  automatically set if none of -U,-D,-S,-A,-C
                                  is set.
  -U, --uppercase                 If type is chars, adds uppercase ASCII to
                                  the generation set
  -D, --digits                    If type is chars, adds decimal digits to the
                                  generation set
  -S, --symbols                   If type is chars, adds ASCII symbols to the
                                  generation set
  -A, --all                       If type is chars, adds all groups to the
                                  generation set
  -C, --copy-hash                 Use this to copy the generated hash to
                                  clipboard. Has no effect if -h is not set.
  -n, --number INTEGER            Number of passwords to generate
  -i, --infinite                  Constantly generates passwords. Overrides
                                  -n.
  --help                          Show this message and exit.

2.hash for hashing passwords.

Usage: python -m opensesame hash [OPTIONS]

Options:
  -i, --input FILENAME            Input to read from. Default is stdin
  -o, --output FILENAME           Output to write to. Default is stdout
  -a, --algorithm [sha224|blake2b|sha3_384|sha384|blake2s|sha1|shake_128|sha3_224|sha512|sha3_256|sha3_512|sha256|md5|shake_256]
                                  Hashing algorithm to use. Default MD5
  -b, --bytes-digest              Output normal digest instead of hexdigest.
  -r, --repr                      If -b is set, outputs Python internal string
                                  representation of bytes output
  --help                          Show this message and exit.

Python lib

Generation methods

chars

This generates a password of a given length randomly selecting from the given character sets. Character sets are:

  • lowercase -> lower case ascii chars
  • uppercase -> UPPER CASE ASCII CHARS
  • digits -> 0123456789
  • symbols -> !"#$%&'()+,*-./:;<=>?@[]^_`{|}~
  • all -> everything above Character sets are added by setting kwarg <CHARSET_NAME> to True. If no character sets are specified, only lowercase is used.

You can specify length using length,min and max atributtes, where length overrides the boundaries(min and max). Default length is picked between 6 and 20.

:warning: Be careful! Don't select only one boundary, as it might cause IndexError.

You can also generate a pronounciable password by setting pronounciable to True. Character sets don't apply to pronounciable passwords.

word

This just selects a random word from the wordlist. No attributes from chars apply to this.

passgen

With passgen,you can select a method and call the method with given **kwargs.
It's just a wrapper.
The methods are selected by setting the first arg of passgen to chars,word or pronounciable. You can also set it to the first char of their name.

number_suffix

chars,word and passgen all have the argument number_suffix. It specifies how many digits are supposed to be added to the end of the password.

Password object

Generation methods return this.
It's a string wrapped in hashing. Hashing is done with Password.hash(algorithm). Password.hash returns Hash object with attributes hexdigest(hexadecimal representation of the digest) and bytesdigest(actual digest)

chars

This generates a password of a given length randomly selecting from the given character sets. Character sets are:

  • lowercase -> lower case ascii chars
  • uppercase -> UPPER CASE ASCII CHARS
  • digits -> 0123456789
  • symbols -> !"#$%&'()+,*-./:;<=>?@[]^_`{|}~
  • all -> everything above Character sets are added by setting kwarg <CHARSET_NAME> to True. If no character sets are specified, only lowercase is used.

You can specify length using lgit clone git@github.com:YOUR-USERNAME/warehouse.gitength,min and max atributtes, where length overrides the boundaries(min and max). Default length is picked between 6 and 20.

:warning: Be careful! Don't select only one boundary, as it might cause IndexError.

You can also generate a pronounciable password by setting pronounciable to True. Character sets don't apply to pronounciable passwords.

word

This just selects a random word from the wordlist. No attributes from chars apply to this.

passgen

With passgen,you can select a method and call the method with given **kwargs.
It's just a wrapper.
The methods are selected by setting the first arg of passgen to chars,word or pronounciable. You can also set it to the first char of their name.

number_suffix

chars,word and passgen all have the argument number_suffix. It specifies how many digits are supposed to be added to the end of the password.

Password object

Generation methods return this.
It's a string wrapped in hashing. Hashing is done with Password.hash(algorithm). Password.hash returns Hash object with attributes hexdigest(hexadecimal representation of the digest) and bytesdigest(actual digest)

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

pyopensesame-1.0.1.tar.gz (173.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyopensesame-1.0.1-py3-none-any.whl (171.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyopensesame-1.0.1.tar.gz
  • Upload date:
  • Size: 173.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.62.3 importlib-metadata/5.0.0 keyring/23.4.0 rfc3986/1.5.0 colorama/0.4.5 CPython/3.10.8

File hashes

Hashes for pyopensesame-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c9841820a69a6cc1c22568499e1c063830d54fcffb2c4e95ece0ca45339fb7d1
MD5 be278a7143205f2775863b0fc79456ce
BLAKE2b-256 454ba6d4c39c75b602d2f2113ad46b458c1b11efc3c2c1d6ef65ee0883e7df2e

See more details on using hashes here.

File details

Details for the file pyopensesame-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyopensesame-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 171.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.62.3 importlib-metadata/5.0.0 keyring/23.4.0 rfc3986/1.5.0 colorama/0.4.5 CPython/3.10.8

File hashes

Hashes for pyopensesame-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2277f8aeb78d6c67c1d33971824915c0230ca71a7ba395b40a30b9f1b425a246
MD5 a0e28952130798947cf681fb82160a2d
BLAKE2b-256 04ab641e9fa0578d64c2466bbeaf1d532cab267f5a6556fbfbaff80c95c09b23

See more details on using hashes here.

Supported by

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