Skip to content

Instantly share code, notes, and snippets.

@seeschloss
Created May 2, 2025 09:05
Show Gist options
  • Save seeschloss/66a7d29c49665733db0419954c699400 to your computer and use it in GitHub Desktop.
Save seeschloss/66a7d29c49665733db0419954c699400 to your computer and use it in GitHub Desktop.
#!/bin/bash
STORE="$HOME/.priv/totp-aegis.txt"
while read LINE; do
ID="$(echo $LINE | sed 's@.*totp/\([^?]*\)?.*@\1@' | sed 's/%3A/:/' | sed 's/%40/@/')"
ALGORITHM="$(echo $LINE | sed 's/.*algorithm=\([^&]*\).*/\1/')"
SECRET="$(echo $LINE | sed 's/.*secret=\([^&]*\).*/\1/')"
TOTP=$(oathtool -b --totp=$ALGORITHM $SECRET)
printf "% 25s\t%s\n" "$ID" "$TOTP"
done < "$STORE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment