2fa 563 B

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. # This script requires Ruby, ROTP (Rubygems), totp (https://github.com/hobarrera/totp-cli), pass (http://passwordstore.org) and dmenu (suckless).
  3. shopt -s nullglob globstar
  4. typeit=0
  5. if [[ $1 == "--type" ]]; then
  6. typeit=1
  7. shift
  8. fi
  9. ## This is now dynamic, hahahahahahaha.
  10. PASSLIST=(`ls $HOME/.password-store/2fa/`)
  11. password=$(printf '%s\n' "${PASSLIST[@]}" | dmenu "$@")
  12. [[ -n $password ]] || exit
  13. if [[ $typeit -eq 0 ]]; then
  14. /usr/bin/env totp $password | xsel
  15. else
  16. echo "Unknown password entry, please enter a valid entry."
  17. fi