[prev in list] [next in list] [prev in thread] [next in thread] 

List:       password-store
Subject:    [pass] Bash script to import passwords from Firefox password manager
From:       shujie zhang <zhang.shujie87 () gmail ! com>
Date:       2015-11-05 20:00:18
Message-ID: CANgXJeNpqkQZPZBiCSOZrjKAx9KWUhfeMCtYAAiwHS7Vq16k6w () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

I started to use Pass this week.
I wrote a bash script to import passwords from Firefox.

You export cvs file by using a extention called "Password Exporter" and
then use this script to import passwords from the cvs file.



##################################

#!/bin/bash
#
# Copyright (C) 2013 Shujie Zhang <zhang.shujie87@gmail.com>. All Rights
Reserved.
# This file is licensed under the GPLv3+. Please see COPYING for more
information.
#
# Usage:
# Export cvs file from firefox by using extention "Password Exporter"
# https://addons.mozilla.org/en-US/firefox/addon/password-exporter/
#
# You can test run it to check if bash syntax are OK:
#         ./firefox2pass.sh testrun CVS_FILE
# Import to pass run as :
#         ./firefox2pass.sh import CVS_FILE
# Feature:
# * If username do not exist, use NONAME as username

args=("$@")

helptext=$'Usage:
You can test run it to check if bash syntax are OK:
        ./firefox2pass.sh testrun CVS_FILE
Import to pass run as :
        ./firefox2pass.sh import CVS_FILE

Feature:
* If username do not exist, use NONAME as username'


main(){
cat ${args[1]} | tail -n +3 | cut -f 1,2,3 -d , | sed "s/http.*\:\/\///g" |
sed "s/\"//g"   |awk -F , -O '{ OFS = ","; print $1, $2, $3, $3 }' | sed
"s/,,/,NONAME,/g" | sed "s/,/\//1" | sed "s/^/pass insert /g" | sed
"s/,/\n/g"
}


if [ -z "${args[1]}" ] ; then
        echo "$helptext"
elif [ "${args[0]}" = "testrun" ]; then
        main
elif [ "${args[0]}" = "import" ]; then
        main | bash
else    echo "$helptext"
fi


##########################

[Attachment #5 (text/html)]

<div dir="ltr"><div><div><div>Hi,<br><br></div>I started to use Pass this \
week.<br></div>I wrote a bash script to import passwords from \
Firefox.<br></div><br>You export cvs file by using a extention called &quot;Password \
Exporter&quot; and then use this script to import passwords from the cvs \
file.<br><div><div><div><div><div><br><br><br>##################################<br><br>#!/bin/bash<br>#<br># \
Copyright (C) 2013 Shujie Zhang &lt;<a \
href="mailto:zhang.shujie87@gmail.com">zhang.shujie87@gmail.com</a>&gt;. All Rights \
Reserved.<br># This file is licensed under the GPLv3+. Please see COPYING for more \
information.<br>#<br># Usage:<br># Export cvs file from firefox by using extention \
&quot;Password Exporter&quot;<br># <a \
href="https://addons.mozilla.org/en-US/firefox/addon/password-exporter/">https://addons.mozilla.org/en-US/firefox/addon/password-exporter/</a><br># \
<br># You can test run it to check if bash syntax are OK: <br>#                 \
./firefox2pass.sh testrun CVS_FILE<br># Import to pass run as :<br>#                 \
./firefox2pass.sh import CVS_FILE<br># Feature:<br># * If username do not exist, use \
NONAME as username<br><br>args=(&quot;$@&quot;)<br><br>helptext=$&#39;Usage:<br>You \
can test run it to check if bash syntax are OK: <br>               ./firefox2pass.sh \
testrun CVS_FILE<br>Import to pass run as :<br>               ./firefox2pass.sh \
import CVS_FILE<br><br>Feature:<br>* If username do not exist, use NONAME as \
username&#39;<br><br><br>main(){<br>cat ${args[1]} | tail -n +3 | cut -f 1,2,3 -d , | \
sed &quot;s/http.*\:\/\///g&quot; | sed &quot;s/\&quot;//g&quot;     |awk -F , -O \
&#39;{ OFS = &quot;,&quot;; print $1, $2, $3, $3 }&#39; | sed \
&quot;s/,,/,NONAME,/g&quot; | sed &quot;s/,/\//1&quot; | sed &quot;s/^/pass insert \
/g&quot; | sed &quot;s/,/\n/g&quot;<br>}<br><br><br>if [ -z &quot;${args[1]}&quot; ] \
; then<br>               echo &quot;$helptext&quot;<br>elif [ &quot;${args[0]}&quot; \
= &quot;testrun&quot; ]; then<br>               main<br>elif [ &quot;${args[0]}&quot; \
= &quot;import&quot; ]; then<br>               main | bash<br>else       echo \
&quot;$helptext&quot;               \
<br>fi<br><br><br>##########################<br></div></div></div></div></div></div>



_______________________________________________
Password-Store mailing list
Password-Store@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/password-store


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic