Dec
05
2009

how-to: migrating your passwords from firefox to uzbl’s formfiller

update 2009-11-07: fixed bug in script

uzbl has a simple but nice formfiller script that automatically fills forms for you.

if you’ve been using firefox’s password manager, you probably have a large list of user details you’d probably like to use in uzbl too. migrating the data is actually simpler than you think.

first, install the Password Exporter add-on in your firefox.

then go to edit->preferences->security->import/export passwords, click export passwords (do NOT check the checkbox), select csv in the bottom right select box and save the file in your ${HOME}.

you should now have a file called password-export-`date +%Y-%m-%d` (current date ;)) in your ~ folder.

now open a terminal and run the following:

cat ~/password-export-`date +%Y-%m-%d` | grep "^\"http" | while read i; do S=`echo $i | cut -d"\"" -f2`; S="${S/http:\/\/}"; S="${S/https:\/\/}"; U=`echo $i | cut -d"\"" -f4`; P=`echo $i | cut -d"\"" -f6`; UF=`echo $i | cut -d"\"" -f12`; PF=`echo $i | cut -d"\"" -f14`; echo $UF: $U | sed "s/\@/\\\@/g" > ~/.local/share/uzbl/forms/$S; echo $PF: $P | sed "s/\@/\\\@/g" >> ~/.local/share/uzbl/forms/$S; done

note that the above command will overwrite any existing domains.
the command below are slightly modified to only add non-existing domains:

cat ~/password-export-`date +%Y-%m-%d` | grep "^\"http" | while read i; do S=`echo $i | cut -d"\"" -f2`; S="${S/http:\/\/}"; S="${S/https:\/\/}"; U=`echo $i | cut -d"\"" -f4`; P=`echo $i | cut -d"\"" -f6`; UF=`echo $i | cut -d"\"" -f12`; PF=`echo $i | cut -d"\"" -f14`; echo $UF: $U | sed "s/\@/\\\@/g" >> ~/.local/share/uzbl/forms/$S; [[ ! -f ~/.local/share/uzbl/forms/$S ]] && echo $PF: $P | sed "s/\@/\\\@/g" >> ~/.local/share/uzbl/forms/$S; done

that’s it! you should have a file per domain with the necessary info in ~/.local/share/uzbl/forms

ls ~/.local/share/uzbl/forms/

open a uzbl instance, visit a site with a form and press zl [default binding] to tell formfiller to fill in the form for you :)

tags: , , ,
posted in uzbl by Alex “wired” Alexander

Follow comments via the RSS Feed | Leave a comment | Trackback URL

6 Responses to “how-to: migrating your passwords from firefox to uzbl’s formfiller”

  1. hash says:

    Will this work if I have multiple passwords for some host?

    • wired says:

      After a quick look in formfiller.sh I’d say no, also the above script will ignore multiple username/password sets (the first version will overwrite the first with the last, the second will ignore anything after the first).

      Anyway, formfiller needs an update to support multiple accounts.

  2. wired says:

    I’ve updated the commands, fixed issue with usernames missing and @s trimmed by uzbl.

    I recommend running the first command again :)

  3. tsakf says:

    Very informative article. Added it to my library:

    http://fosslib.tsakf.net/record/309

  4. Emily says:

    Will this work if I have multiple passwords for some host?

Leave a Reply

 
Powered by Wordpress and MySQL. Original theme by openark.org - customization by me :)