加密和解密私有信息

secrets-guard的Python项目详细描述


加密和解密用python3编写的私有信息。

说明

secrets guard是加密和解密任何类型信息的工具。

这个想法是用一个给定的模型创建一个商店,然后在里面插入“秘密”。

它类似于linux工具pass,但使用aes而不是gpg,并允许创建包含任何信息之王的通用存储,而不仅仅是密码。

要求

至少需要Python3。

需要“PyCryptoDome”库。

安装

pip3 install secrets-guard

脚本可以与python3 -m secrets_guard ...一起使用。

除了通过pip安装之外,还将安装名为secrets的脚本,这是python3 -m secrets_guard的快捷方式。

用法

根据提供的参数,每个命令可以在交互模式或批处理模式下工作。

例如,如果key未随--key一起提供,则将向用户请求它。

存储命令

创建

首先,应该使用命令create创建存储区。

例如,创建一个名为“password”的基本密码存储:

secrets create password --fields Site Account Password Other --key mykey

销毁

可以使用destroy销毁存储区。

secrets destroy password

列表

对于列出路径中的所有存储(如果未使用--path指定,则为默认值),可以使用list命令。

secrets list

显示

使用show可以看到存储区的全部内容。

secrets show password --key mykey

更改存储区的密钥。

secrets key password newkey --key oldkey

清除

从商店里删除所有的秘密。

secrets clear password --key mykey

秘密命令

添加

一个秘密可以通过以下方式添加到现有的存储库中
secrets add password --data Site="Megavideo" Account="me@gmail.com" Password="MyPassword" --key mykey

grep

要在机密字段之间搜索特定单词(或正则表达式),可以使用命令grep

secrets grep password MyPass --key mykey
secrets grep password "^My.*word" --key mykey

移除

可以使用remove从存储中删除机密。

必须指定要删除的机密的ID(可以使用grepshow检索它)。

secrets remove password 12

修改

可以使用modify更改机密字段,如下所示:

secrets modify password 11 --data Password="MyNewPassword" --key mykey

帮助

有关命令的详细信息,请使用help

NAME
    secrets - encrypt and decrypt private information (such as passwords)

SYNOPSIS
    secrets <COMMAND> [COMMAND_OPTIONS] [GENERAL_OPTIONS]

DESCRIPTION
    Stores and retrieves encrypted data to/from files.

    Each command can be used either in batch or interactive mode;
    each mandatory but not specified argument will be required interactively.

    One of the following command must be specified:

COMMANDS
    help
        Shows this help message.

    create [<STORE_NAME>] [--fields FIELDS] [--path <PATH>] [--key <STORE_KEY>]
        Creates a new store at the given path using the given key.
        The FIELDS must be expressed as a space separated list of field names.

        Furthermore some attributes can be expressed for the fields by appending
        "+<attr_code_1><attr_code_2>..." after the field name.

        The available attributes are
        1) h: hidden (the user input is not shown)
        2) m: mandatory (the field must contain a non empty string)

        e.g. secrets create password --fields Site Account Password Other --key mykey
        e.g. secrets create password --fields Site+m Account+m Password+mh Other --mykey

    destroy [<STORE_NAME>] [--path <PATH>]
        Destroys the store at the given path.

        e.g. secrets destroy password

    list [--path <PATH>]
        List the names of the stores found at the path specified
        by --path (or at the default one if not specified).

        e.g. secrets list

    show [<STORE_NAME>] [--path <PATH>] [--key <STORE_KEY>] [--no-table]
        Decrypts and shows the content of an entire store.

        e.g. secrets show password --key mykey

    key [<STORE_NAME>] [<NEW_STORE_KEY>] [--path <PATH>] [--key <STORE_KEY>]
        Changes the key of the store from STORE_KEY to NEW_STORE_KEY.

        e.g. secrets key newkey --key currentkey

    clear [<STORE_NAME>] [--path <PATH>] [--key <STORE_KEY>]
        Clears the content (all the secrets) of a store.
        The model is left unchanged.

    add [<STORE_NAME>] [--data DATA] [--path <PATH>] [--key <STORE_KEY>]
        Inserts a new secret into a store.
        The DATA must be expressed as a key=value list where the key should
        be a field of the store.

        e.g. secrets add password --data Site="Megavideo" Account="me@gmail.com" Password="MyPassword" --key mykey

    grep [<STORE_NAME>] [<SEARCH_PATTERN>] [--path <PATH>] [--key <STORE_KEY>] [--no-color] [--no-table]
        Performs a regular expression search between the data of the store.
        The SEARCH_PATTERN can be any valid regular expression.
        The matches will be highlighted unless --no-color is specified.

        e.g. secrets grep password MyPass --key mykey
        e.g. secrets grep password "^My.*word" --key mykey

    remove [<STORE_NAME>] [<SECRET_IDS>*] [--path <PATH>] [--key <STORE_KEY>]
        Removes the secret(s) with the given SECRET_IDS from the store.
        The SECRET_IDS should be retrieved using the secrets grep command.

        e.g. secrets remove password 12
        e.g. secrets remove password 12 14 15 7 11

    modify [<STORE_NAME>] [<SECRET_ID>] [--data DATA] [--path <PATH>] [--key <STORE_KEY>]
        Modifies the secret with the given SECRET_ID using the given DATA.
        The DATA must be expressed as a key=value list.

        e.g. secrets modify password 11 --data Password="MyNewPassword" --key mykey

GENERAL OPTIONS
    --verbose
        Prints debug statements.

    --no-keyring
        Do not use the keyring for retrieve the password.
        By default a password used for open a store is cached in the keyring
        for further uses.

许可证

秘密守卫是MIT licensed

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
多线程重新构造使用线程池和BlockingQueue的I/O密集型Java web服务   java SWT CTabFolder检查CTAB是否存在   java如何防止具体类的实例化?   java如何将子域定向到正确的JBoss应用程序?   java Android外部文件出现不一致   java FileSystemNotFoundException:未安装提供程序“jndi”   显示jframe上的java隐藏单选按钮   java CXF客户端TCP连接在每个请求之间关闭   Hadoop查询、日期、循环、BASH或Java   java从长类型到十进制类型对象的转换类型错误   java为什么不在用户消息中提供用户提供的数据?有可能的威胁/攻击吗?   使用作用域存储MediaStore的应用程序中的java共享意图问题   java我可以通过将成员指针传递给方法并在方法中分配来初始化它吗?   java如何在一个包含正负值的数组中找到最大的负值?   java有比较二叉树路径的简单方法吗?   java Swagger(ui)不显示操作   java KairosDB缺失值的线性插值   用于此特定求和的java循环