Skip to content

Quickly choose a One-Time Password (OTP) to generate

License

Notifications You must be signed in to change notification settings

fallalex/otpass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

otpass

This script accepts a TOTP token file over stdin, from a tool like Pass. Using a combination of aliases and fuzzy search to find the one-time password to generate then place in the clipboard.

With longer provider names having an alias is helpful aws => Amazon Web Services. Most providers will only have one account with TOTP, making an alias for accounts less valuable. Rather than completion this script uses fuzzy search for providers and account descriptions. The combination of fuzzy search and aliases is more powerful in many ways and less distracting when compared to completion.

There are tools that fill this role like pass-otp. I hope this alternative's helps others, as it has me.

Here are some examples:

$ otpass go
Google
[email protected]
439013

$ otpass go -a 1
Google
[email protected]
946887

$ otpass -a ro ams
Amazon Web Services
root
200685

$ otpass am
Amazon
[email protected]
916049

The structure of the YAML file follows the example below, alias is optional the rest are required. The YAML file should be encrypted, how is up to the user.

Amazon:
  accounts:
    - [email protected]: EJCO324TR4KCPSGR
Amazon Web Services:
  alias: aws
  accounts:
    - myuser: GZBTHCYO5DWMHVMI
    - root: EQF5MDZFBUTFM4AD
GitHub:
  accounts:
    - [email protected]: V7VU5M336VMW7ZQX
    - [email protected]: X5IPLL76KTEKP24J
Google:
  accounts:
    - [email protected]: G654U2GGSO3T4RSI
    - [email protected]: KILLKXQT3W56M66L

Below is an example of piping the YAML token file to the script and making an alias to the command for ease of use. This would be added to .bash_profile or .zshrc.

alias otpass="pass otp.yaml | otpass.py"

usage: otpass.py [-h] [-c] [-a ACCOUNT] [Q]

positional arguments:
  Q                     fuzzy search provider names

optional arguments:
  -h, --help            show this help message and exit
  -c, --no-clip         do not put result into clipboard
  -a ACCOUNT, --account ACCOUNT
                        fuzzy search account names

Dependencies

Install

All the external requirements are easy to install with pip, for other methods refer to their docs.

pip install yaml
pip install pyotp
pip install pyperclip
pip install fuzzywuzzy[speedup]

About

Quickly choose a One-Time Password (OTP) to generate

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages