2 # passman -- simple password manager
3 # Copyright (C) 2013-2016 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; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 gpg --armor --gen-random 1 16 | tr '+/' '-_' | tr -d =
27 xclip -in -selection $1
38 [ -n "$passwd" ] || passwd=$(generator)
39 echo Adding password for $dst
42 echo "$passwd" > $DB/$dst/passwd
46 result=$(find . -type d -path "*$1*" | while read ent; do
47 [ -e "$ent/passwd" ] || continue
48 echo "$ent" | sed 's#^\./##'
50 if [ $(echo "$result" | wc -l) -ne 1 ]; then
54 [ -n "$result" ] || exit 1
56 if [ -e "$result"/data ]; then
57 echo -n "Associated data: "
60 perl -ne 'chop and print' "$result"/passwd | cliper clipboard
61 echo $(basename "$result") | perl -ne 'chop and print' | cliper primary
63 echo -n | cliper clipboard