2020-08-15 12:18:34 +00:00
|
|
|
#!/bin/bash
|
2020-10-14 08:52:24 +00:00
|
|
|
set -aeou pipefail
|
2020-08-15 12:18:34 +00:00
|
|
|
keepassdb="$HOME/Nextcloud/passwords/Passwords.kdbx"
|
|
|
|
|
|
|
|
type qrencode >/dev/null 2>&1 || { printf "qrencode is not installed\n" >&2; exit 1; }
|
|
|
|
type keepassxc-cli >/dev/null 2>&1 || { printf "KeepassXC is not installed\n" >&2; exit 1; }
|
|
|
|
|
2020-10-13 07:13:20 +00:00
|
|
|
printf "Enter password for %s: " "$keepassdb"
|
|
|
|
read -r -s password
|
2020-08-15 12:18:34 +00:00
|
|
|
printf "\n"
|
|
|
|
|
2020-10-13 07:16:58 +00:00
|
|
|
printf "Enter host name you want to generate the code for: "
|
2020-10-13 07:13:20 +00:00
|
|
|
read -r device
|
2020-08-15 12:18:34 +00:00
|
|
|
|
|
|
|
printf "Enter the tunnel name: "
|
2020-10-13 07:13:20 +00:00
|
|
|
read -r tunnel
|
2020-08-15 12:18:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
echo "$password" | keepassxc-cli show -q --attributes Notes "$keepassdb" /Wireguard/"$device"/"$tunnel" | qrencode -t ansiutf8
|
|
|
|
|
|
|
|
unset password
|