跳转到主要内容

OTP命令行工具

项目描述

Travis state

Keyring OTP

Keyring OTP是一个命令行界面,用于从存储在Gnome Keyring(seahorse的后端)中的秘密中生成一次性密码。

安装

此应用程序在python3虚拟环境中在debian stretch上正确运行

$ python3 -m venv koptvenv
$ source ./kotpvenv/bin/activate

这需要在您的计算机上安装xclip,以便在程序结束时临时将秘密放入您的剪贴板,初始值将回到您的剪贴板中

$ apt install xclip

使用您喜欢的安装程序进行安装。例如

$ pip install keyring-otp

用法

使用-h获取最近的帮助

$ kotp -h
usage: kotp [-h] [-s SECRET] [-o] [-d DURATION] keyring key

CLI to generate One Time Password from secrets stored in Keyring (using
seahorse password manager)

positional arguments:
  keyring
  key

optional arguments:
  -h, --help            show this help message and exit
  -s SECRET, --secret SECRET
                        Force using secret from command line instead getting
                        it from the password manager. (as keyring and key are
                        mandatory set any values they will be ignored).
  -o, --output          Display output in console and in the clipboard (useful
                        if you can't install xclip).
  -d DURATION, --duration DURATION
                        How many seconds you wants the One Time Password in
                        your clipboard. Note that as time is changing, the
                        TOTP password will be updated and your clipboard will
                        be updated too!

假设我有一个名为otp的密钥环,其中包含一个名为github的密钥,该密钥包含我的github otp密码。

Seahorse Gnome password manager

要获取基于时间的OTP密码并将其放入我的剪贴板,我执行以下操作

$ kotp otp github

以下是一个通过命令行提供OTP密码值的示例

$ kotp -s SECRETS -o -d 35 nothing real
Current TOTP 887562 at Wed Nov  8 07:48:18 2017
Current TOTP 291833 at Wed Nov  8 07:48:30 2017

路线图

  • 使其可用作API,API消费者可以添加多个回调,这些回调应该在OTP更改时被调用一次(回调可以在入口点声明,以便用户容易地定义新的回调),此应用程序应声明一些默认行为,如

    • 在控制台打印

    • 填充剪贴板(需要初始化方法和最终方法来设置回当前剪贴板值)

  • 提示解锁密钥环

  • 考虑替换-s选项并打开秘密输入,以避免在bash历史记录中留下痕迹

  • 使用python keyring使此应用程序与更多的密码管理器兼容:GnomeKeyring(用于Gnome环境)或KDEWallet(用于KDE环境)或Win32CryptoRegistry(用于Windows)

  • 管理Passman后端

  • 保存新的秘密

作者

变更日志

0.3(未发布)
0.2 (2117-11-19)
  • 设置Travis

  • 只有当TOTP更改时才设置剪贴板

  • 修复readme.rst,以便在pypi上更清晰

0.1 (2017-11-11)
  • 初始实现

项目详情


下载文件

下载适合您平台的应用程序文件。如果您不确定要选择哪一个,请了解更多关于安装包的信息。

源分发

keyring-otp-0.2.tar.gz (40.4 kB 查看散列)

上传时间

构建分发

keyring_otp-0.2-py3-none-any.whl (8.1 kB 查看散列)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面