Skip to main content

A password management tool

Project description

pwmg

A password management tool

pwmg is a standalone python3 script to manage a collection of password entries. Each entry consists of a site name, an user account name, and the password. pwmg will add a timestamp when it encrypts and stores the password entry. The encrypted entries are stored in a local file.

A master secrete key is used to encrypt and decrypt password entries.

The algorithm for encryption is XTEA, with 64 rounds of computation. See https://en.wikipedia.org/wiki/XTEA for more information. Each entry is padded to 256 bytes, prepended and appended with randomly generated printable characters. A '\0' is inserted to mark the start and/or end of the password entry. The entire string is then encrypted, 8-byte per block, with CBC.

The master secrete key must be more than 8 characters long. It is advised, but not enforced, to use mixed characters, special characters, and digits.

Perhaps what's interesting about this program is that it is a single file, uses only standard Python3 libraries, and does not require or download any additional modules from PyPi repository or any other source. Hence the user can be assured there is no possible malicious injection of Python code. You can download just the pwmg.py and it is ready to use.

You can install it with the pip command

# python3 -m pip install pwmg

Github link: https://github.com/fredxia/pwmg

Usage

The default file to store encrypted passwords is ~/.pwmg_db. There is a command line option -f to use a different file.

To avoid potential leak of passwords in the shell .history file master secrete key or password is only typed in at prompt, not with command line option.

Below is an example to save a password. Notice the master secrete key is not printed to the terminal (per Python3's getpass module).

$ pwmg update 'fred walmart account' testuser2gmail@gmail.com
Secrete key:
Password for fred walmart account:Test&simple2
Site 'fred walmart account' password updated

$ pwmg show
Secrete key:

    --------------------------------------------------------------------------
    | SITE                 | USER NAME           | PASSWORD     | TIMESTAMP  |
    --------------------------------------------------------------------------
    | fred walmart account | testuser2@gmail.com | Test&simple2 | 2021-08-09 |
    --------------------------------------------------------------------------

This is what the encrypted file looks like

% cat ~/.pwmg_db
# password file created 2021-08-09
ziNbM2q+FHn7iD4UXWg8tx48DC38eEh+pg+0MxfJogMjsi3H0L3iOC09bISNABMWi4g3UttuMNmF3O7t89/ww7wv7hh1+D98fZ8g/WUkgk3FslRDdJLeGk34BFrP1nIzyQD5adrYRVXtBkFv5pBwBr/lQfWQjsLyP8hMuCJ1DzOFiMAjLRwnIUhitwAqXcQwjo06EHmoi9NllW7W2NAWZQWnMRHHzURt+uBtUvFY9JSAWdLGRDdo2FhfbSeLwfc5ZIbBneMJc0Ye3alP8J9rODwXnoLSHaMY9iLzowHWR72fVP0nZa23ZLsKuZ937EkCX1FJP85IPL+hdSdwS/Y1Yg==

You can also remove a site. export passwords to a CSV file, or import passwords from an exported CSV file. For export and import the delimiter is assumed by default to be TAB character (can be changed with -d option).

Each functionality is a sub command. All sub commands can be listed by the help option. Without any command line sub command specified the default is "show" command.

By convention arguments in square brackets are optional in the following "-h" output.

% pwmg -h
usage: pwmg [-h] [-f <FILENAME>] {show,rm,update,pw,import,export} ...

A password management tool

optional arguments:
  -h, --help            show this help message and exit
  -f <FILENAME>, --file <FILENAME>
                        Password file. Default is ~/.pwmg_db

command:
  {show,rm,update,pw,import,export}
    show                show or search password entries
    update              update or add password entry    
    rm                  remove entry
    pw                  change master secrete key
    import              import from csv file
    export              export to csv file
% pwmg update -h
usage: pwmg update [-h] <SITE> <USER NAME>

positional arguments:
  <SITE>       site to delete
  <USER NAME>  user name
% pwmg show -h
usage: pwmg show [-h] [<NAME>]

positional arguments:
  <NAME>      site or user name
% pwmg rm -h
usage: pwmg rm [-h] <SITE>

positional arguments:
  <SITE>      site to delete
% pwmg import -h
usage: pwmg import [-h] [-d <DELIMITER>] <FILE>

positional arguments:
  <FILE>          file to import from
% pwmg export -h
usage: pwmg export [-h] [-d <DELIMITER>] <FILE>

positional arguments:
  <FILE>          file to export to

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

pwmg-0.0.6.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

pwmg-0.0.6-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file pwmg-0.0.6.tar.gz.

File metadata

  • Download URL: pwmg-0.0.6.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for pwmg-0.0.6.tar.gz
Algorithm Hash digest
SHA256 4c5724b05ad3e918be206e0c5edc068a2ab58f25f8c9276c215efc9c6cba286d
MD5 f916b50ea18a191e31c7bfc7cbfbc9bc
BLAKE2b-256 711a5152b8c02618f75416683ff3decfac2d54aae29747dcac3b8bcbc53061ef

See more details on using hashes here.

File details

Details for the file pwmg-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pwmg-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for pwmg-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c234bcd1b2b9e3a00d14434ed971f85f2d43ebe7f00c791b47094c1bc203d99b
MD5 fa14197560020e74d119cb5ed29b7469
BLAKE2b-256 dd57f3fcab5fdba70578b61d4178ad5a9b06d007944fc9360326f41f44412b71

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