password-store

Simple password manager using gpg and ordinary unix directories
git clone https://git.zx2c4.com/password-store
Log | Files | Refs | README | LICENSE

pwsafe2pass.sh (1082B)


      1 #!/usr/bin/env bash
      2 # Copyright (C) 2013 Tom Hendrikx <tom@whyscream.net>. All Rights Reserved.
      3 # This file is licensed under the GPLv2+. Please see COPYING for more information.
      4 
      5 export=$1
      6 
      7 IFS="	" # tab character
      8 cat "$export" | while read uuid group name login passwd notes; do
      9      test "$uuid" = "# passwordsafe version 2.0 database" && continue
     10      test "$uuid" = "uuid" && continue
     11      test "$name" = '""' && continue;
     12 
     13      group="$(echo $group | cut -d'"' -f2)"
     14      login="$(echo $login | cut -d'"' -f2)"
     15      passwd="$(echo $passwd | cut -d'"' -f2)"
     16      name="$(echo $name | cut -d'"' -f2)"
     17 
     18      # cleanup
     19      test "${name:0:4}" = "http" && name="$(echo $name | cut -d'/' -f3)"
     20      test "${name:0:4}" = "www." && name="$(echo $name | cut -c 5-)"
     21 
     22      entry=""
     23      test -n "$login" && entry="${entry}login: $login\n"
     24      test -n "$passwd" && entry="${entry}pass: $passwd\n"
     25      test -n "$group" && entry="${entry}group: $group\n"
     26 
     27      echo Adding entry for $name:
     28      echo -e $entry | pass insert --multiline --force "$name"
     29      test $? && echo "Added!"
     30 done