diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-03-20 02:20:44 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-03-20 02:24:17 -0600 |
commit | 60c8957c84a8f70ddc549dc614b6d35981cb1291 (patch) | |
tree | 9610288ad222c1010af14c8347685086a75a91ac /contrib | |
parent | af2d9cb7d44cec75a485cb51971ef6dc3ee2db4e (diff) |
New pwsafe2pass script.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/pwsafe2pass.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/pwsafe2pass.sh b/contrib/pwsafe2pass.sh new file mode 100755 index 0000000..c29bb3f --- /dev/null +++ b/contrib/pwsafe2pass.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Copyright (C) 2013 Tom Hendrikx <tom@whyscream.net>. All Rights Reserved. +# This file is licensed under the GPLv2+. Please see COPYING for more information. + +export=$1 + +IFS=" " # tab character +cat "$export" | while read uuid group name login passwd notes; do + test "$uuid" = "# passwordsafe version 2.0 database" && continue + test "$uuid" = "uuid" && continue + test "$name" = '""' && continue; + + group="$(echo $group | cut -d'"' -f2)" + login="$(echo $login | cut -d'"' -f2)" + passwd="$(echo $passwd | cut -d'"' -f2)" + name="$(echo $name | cut -d'"' -f2)" + + # cleanup + test "${name:0:4}" = "http" && name="$(echo $name | cut -d'/' -f3)" + test "${name:0:4}" = "www." && name="$(echo $name | cut -c 5-)" + + entry="" + test -n "$login" && entry="${entry}login: $login\n" + test -n "$passwd" && entry="${entry}pass: $passwd\n" + test -n "$group" && entry="${entry}group: $group\n" + + echo Adding entry for $name: + echo -e $entry | pass insert --multiline --force "$name" + test $? && echo "Added!" +done |