[Linux] Add keepass functions

This commit is contained in:
Ivan Malison 2016-12-07 18:10:32 -08:00
parent ee1df2f536
commit ee68f3f15c
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
2 changed files with 41 additions and 8 deletions

View File

@ -464,12 +464,6 @@ function localip {
esac
}
function keepass_system_password {
keepasshttp.py --get -u "http://$(hostname).systempassword" |
jq '.[].password' | unescape.py
}
function keepass_keepass_password {
keepasshttp.py --get -u "http://keepass.password" |
jq '.[].password' | unescape.py
function all_lines_after {
sed -n "/$1/"'$p'
}

View File

@ -0,0 +1,39 @@
keepass_system_password() {
keepasshttp.py --get -u "http://$(hostname).systempassword" |
jq '.[].password' | unescape.py
}
keepass_password() {
keepasshttp.py --get -u "http://keepass.password" |
jq '.[].password' | unescape.py
}
my_kp() {
kpcli --kdb "$HOME/SparkleShare/config/db.kdbx" \
--key "$HOME/SparkleShare/config/creds/keepass.key" \
--pwfile <(keepass_password) "$@"
}
list_passwords() {
my_kp --command 'ls Root/' | sed -n '/=== Entries ===/,$p' | tail -n +2
}
get_pass_from_entry() {
grep -E '^ *Pass:' | get_cols 2
}
select_password() {
list_passwords | rofi -dmenu -i | get_cols 2
}
get_password() {
my_kp --command "show -f Root/$1" | get_pass_from_entry
}
echo_selected_password() {
get_password "$(select_password)"
}
type_selected_password() {
xdotool type --clearmodifiers "$(echo_selected_password)"
}