Skip to content

Instantly share code, notes, and snippets.

@obfusk
Last active July 27, 2021 14:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obfusk/7de8959e136e3739151cf7537f3f54d6 to your computer and use it in GitHub Desktop.
Save obfusk/7de8959e136e3739151cf7537f3f54d6 to your computer and use it in GitHub Desktop.
#!/bin/bash
name="$1"
if [ -z "$name" ]; then
read -r -p 'name> '
name="$REPLY"
fi
read -r -p 'key> '
key="$REPLY"
printf '%s' "$key" | gpg -r YOUR_KEY_ID -e > /some/path/"$name".gpg
#!/usr/bin/python3
# apt install python3-pyotp
import pyotp, sys
totp = pyotp.TOTP(sys.stdin.readline().strip().replace(" ", ""))
print(totp.now())
#!/bin/bash
name="$1"
if [ -z "$name" ]; then
read -r -p 'name> '
name="$REPLY"
fi
gpg -d /some/path/"$name".gpg | /some/path/totp.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment