28 lines
No EOL
500 B
Bash
Executable file
28 lines
No EOL
500 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
function lhash {
|
|
echo -n "${1}" | openssl dgst -sha512 | cut -d' ' -f2 | openssl dgst -md5 | cut -d' ' -f2
|
|
}
|
|
|
|
# Prompt user for input
|
|
read -p "Website: " url
|
|
read -p "Login: " login
|
|
read -s -p "Password: " password
|
|
echo
|
|
|
|
domain=$(echo "$url" | sed -E 's~https?://([^/]+).*~\1~')
|
|
hash=$(lhash "$login")
|
|
pass_path="web/${domain}/${hash}"
|
|
|
|
# Entry content
|
|
entry="${password}
|
|
url: ${url}
|
|
login: ${login}
|
|
"
|
|
|
|
echo "$entry" | pass insert -m "$pass_path"
|
|
|
|
# url
|
|
# login
|
|
# tags
|
|
# note |