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.

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 with randomly generated printable characters. A '\0' is inserted to mark the start of the password entry. The entire string is then encrypted, 8-byte each, 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

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

% 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.4.tar.gz (7.5 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.4-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pwmg-0.0.4.tar.gz
  • Upload date:
  • Size: 7.5 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.4.tar.gz
Algorithm Hash digest
SHA256 a7fcc35f6fd56696b0e1fbe326775b428a3bbc5915f7257f92bc6fe0f3fedf5f
MD5 657d1710f4a573112df79da3fc20b7cc
BLAKE2b-256 bd25c13959351d399864e40fa0936fdc8ac8fda67663ff8ef4922f2ab5d9060a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pwmg-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6ed812221619d262d57f75adad06e21dd42d705773843e49f1065285cec462e2
MD5 ee0fd97e907c04392550339a4708e191
BLAKE2b-256 f79b728c8cb7d6a9e2ea8185288f332c5e68d6d05e06bddbc08ef055b9ea0626

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