util Package¶
callback
Module¶
Callback interface To be used when UI needs to be back to get info from user.
config
Module¶
-
class
pwman.util.config.
Config
(filename=None, defaults=None, **kwargs)¶ The configuration of pwman is done with an ini file found in XDG_CONFIG_HOME on Unix systems. On windows the configuration is found in
%APPDATA/pwman/%
The following describe the possible sections in the file and the default values of each parameter:Section Readline history path to the file containing history of commands typed Section Global save True or False - whether the Configuring file should be saved colors yes or no - If set to no, no colors used in output. This is useful for breil terminals. cp_timeout Number of seconds before the clipboard is erased. cls_timeout Number of seconds before the screen is clean after a print. Set to 0 to disable. umask The umask in which database and configuration files are written. xsel path to the xsel binary (LinuxBSD only). lock_timeout sets the period (in secods) after which the database is locked. Section Database dburi Database URI conforming to RFC3986. SQLite, Postgreql, MySQL and MongoDB are currently supported.
- SQLite example:
- sqlite:///path/to/your/db
- Postgreql example:
- postgresql://<user>:<pass>@<host[:port]>/<database>
- MySQL example:
- mysql://<user>:<pass>@<host[:port]>/<database>
- MongoDB example:
- mongodb://<user>:<pass>@<host[:port]>/<database>
Section Updater supress_version_check yes or no - check for newer versions of pwman3 client_info sha256 digest of host name and username, used for identifying the client Section UI URL_length - 22 - the max length of URL to show.
- Longer URLs are trimmed
URL_pad 25 - the padding of the URL in line_format user_pad - 25 - the padding of the user name in
- line_format
tag_pad 20 - the padding of tags in the line_format line_format {ID:<3} {USER:<{user_pad}}{URL:<{url_pad}}{Tags:<{tag_pad}} # noqa -
get_value
(section, name)¶
-
save
()¶
-
set_value
(section, name, value)¶
-
exception
pwman.util.config.
ConfigException
(message)¶ Basic exception for config.
-
exception
pwman.util.config.
ConfigNoConfigException
(message)¶
-
pwman.util.config.
find_config_dir
¶ Backward compatibly config dir finder
If ~/.appname is not found define a new XDG compat one
-
pwman.util.config.
get_pass_conf
(config)¶
crypto_engine
Module¶
-
class
pwman.util.crypto_engine.
CryptoEngine
(salt=None, digest=None, algorithm='AES', timeout=-1, reader=None)¶ -
authenticate
(password)¶ salt and digest are stored in a file or a database
-
callback
¶ return call back function
-
changepassword
(reader=<built-in function input>)¶
-
decrypt
(cipher_text)¶
-
encrypt
(text)¶
-
forget
()¶ discard cipher
-
classmethod
get
(timeout=-1)¶
-
get_salt_digest
()¶
-
set_salt_digest
(key)¶
-
-
exception
pwman.util.crypto_engine.
CryptoException
¶
-
pwman.util.crypto_engine.
decode_AES
(cipher, encoded_text)¶
-
pwman.util.crypto_engine.
encode_AES
(cipher, clear_text)¶
-
pwman.util.crypto_engine.
generate_password
(pass_len=8, uppercase=True, lowercase=True, digits=True, special_chars=True)¶
-
pwman.util.crypto_engine.
get_cipher
(password, salt)¶ Create a chiper object from a hashed password
-
pwman.util.crypto_engine.
get_digest
(password, salt)¶ Get a digest based on clear text password
-
pwman.util.crypto_engine.
prepare_data
(text, block_size)¶ prepare data before encryption so the lenght matches the expected lenght by the algorithm.
-
pwman.util.crypto_engine.
zerome
(string)¶ securely erase strings … for windows: ctypes.cdll.msvcrt.memset