Skip to content

Instantly share code, notes, and snippets.

@AcouBass
Created April 23, 2019 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AcouBass/bbc78e21f5c586ef81177ee9244afd1a to your computer and use it in GitHub Desktop.
Save AcouBass/bbc78e21f5c586ef81177ee9244afd1a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# This script requires Ruby, ROTP (Rubygems), totp (https://github.com/hobarrera/totp-cli), pass (http://passwordstore.org) and dmenu (suckless).
shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
## This is now dynamic, hahahahahahaha.
PASSLIST=(`ls $HOME/.password-store/2fa/`)
password=$(printf '%s\n' "${PASSLIST[@]}" | dmenu "$@")
[[ -n $password ]] || exit
if [[ $typeit -eq 0 ]]; then
/usr/bin/env totp $password | xsel
else
echo "Unknown password entry, please enter a valid entry."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment