加密和解密私有信息

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第三方库


热门话题
java将多个线程中的函数放入单个队列   数组在Java中,如何在不改变整数顺序的情况下找到整数组的顺序?   java控制器属于表示层?   java Apache Ivy和本地Maven repo如何处理使用Maven 3构建的快照   Java可与泛型类型进行比较   java这个表达式在泛型中是什么意思   JavaEclipse和TeamCity插件   java检测构造函数中的final是否为空   java如何在StanfordCoreNLP管道中同时使用词汇化和依赖性解析器?   java在AntUnit控制台日志中显示完整异常堆栈跟踪   lambda如何与Java 8供应商建立连锁关系   如何让GRPC的重试机制在Kubernetes集群中使用grpcjava工作?   如何使用openjdk:7 Docker映像和Gradle包装器避免“EC参数错误”?   java将集合映射扩展为一维映射新的“无法推断函数接口类型”