2 # passman -- simple password manager
3 # Copyright (C) 2013-2019 Sergey Matveev (stargrave@stargrave.org)
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; version 3 of the License.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 gpg --armor --gen-random 1 16 | tr '+/' '-_' | tr -d =
26 xclip -in -selection $1
37 [ -n "$passwd" ] || passwd=$(generator)
38 echo Adding password for $dst
41 echo "$passwd" > $DB/$dst/passwd
45 result=$(find . -type d -path "*$1*" | while read ent; do
46 [ -e "$ent/passwd" ] || continue
47 echo "$ent" | sed 's#^\./##'
49 if [ $(echo "$result" | wc -l) -ne 1 ]; then
53 [ -n "$result" ] || exit 1
55 if [ -e "$result"/data ]; then
56 echo -n "Associated data: "
59 perl -ne 'chop and print' "$result"/passwd | cliper clipboard
60 echo $(basename "$result") | perl -ne 'chop and print' | cliper primary
62 echo -n | cliper clipboard