import from Firefox

KPX user
Posts: 2
Joined: 17 Dec 2009, 03:37

import from Firefox

Postby vector » 17 Dec 2009, 03:53

Sorry if discussed elsewhere, I have searched but there seems to be confusing info.
Firstly my first database went well ..that is until I went to re open it... its telling me the database is either corrupted or key is incorrect.. not happy about that but life goes on lets try again.

Obviously I dont want to type it all back in again so I went looking for a solution to export the firefox passwords so I could import them into freepass.

Im running freepassx 0.4.1 in windows (and will be at home under linux)

I installed the firefox password exporter and exported an xml, so far so good.
Now this is where it gets confusing, keepass 1.x and 2.x and importing the xml

the keepassx dropdown import menu has three options keepass xml, pwrmanager and kwallet. I expected to seea firefox xml?

whats my next step

went thru this ... to-keepass
longwinded groovy conversion routine but keepassx would not import. not a valid keepassx file


KPX user
Posts: 2
Joined: 17 Dec 2009, 03:37

Re: import from Firefox

Postby vector » 17 Dec 2009, 06:06

got around this by cutting n pasting text inside an xml editor to resemble the keepassx format

im sure there is an easier way :cry:

KPX user
Posts: 1
Joined: 18 Feb 2010, 22:23

Re: import from Firefox

Postby digsim » 18 Feb 2010, 22:30

I hacked to script to work for keepassX. Basically it just creates an adapted xml-strucutre. For the title field i strip:
Here is the code

Code: Select all

2007 Matias Bjarland - Iteego (

Groovy script to convert passwords exported from
FireFox into format readable by KeePass password safe

You can change, distribute, modify, trash this file to your hearts

  Java 1.5 (J2SE)
                  available at
  Groovy Scripting Language
                  available at
  Password export/import extension to FireFox
                  available at

Modification History

Date        Who        Bug            Description
2007.Jan.19 mbjarland                 Initial Version
2010.Feb.18 digsim                      Adapted to keepassx

import groovy.xml.MarkupBuilder;
import java.util.UUID;

//This is the folder in KeePass where the passwords will be imported to,
//it will be created if it doesn't already exist
def DEFAULT_GROUP = "Firefox Imported";

//need to specify both in- and outfile
if (this.args.length != 2) {
  println("Usage: groovy ConvertFirefoxPasswords.groovy <infile> <outfile>");
  println("Where: ");
  println("       infile  - XML file exported from firefox using plugin at");
  println("       outfile - XML file to write to, this file can then be imported in KeePass using ");
  println("                 File -> Import From -> Import Keepass XML   ");

//create file objects and check that infile is readable
def inFile = new File(this.args[0]);
def outFile = new File(this.args[1]);
if (!inFile.exists() || !inFile.canRead()) {
  println("Unable to read file '${inFile}'");

//Groovy handles reading/writing markup beautifully...
//Walk trough each of the entries in the Firefox export and create KeePass
//format output
def inXml  = new groovy.util.XmlParser().parseText(inFile.getText());
def markup = new groovy.xml.MarkupBuilder(new FileWriter(outFile));
markup.database {
  inXml.entries.entry.each() { inEntry ->
    entry {
      def name = inEntry["@host"].replace('http:/', '');
      name = name.replace('https:/', '');
      name = name.replace('/', '');
      name = name.replace('.com', '');
      name = name.replace('.ch', '');
      name = name.replace('.org', '');
      name = name.replace('www.', '');
      title(name + " | " + inEntry["@user"])
      //create a random UUID to fake a KeePass UUID...there IS an infinitesimal (yea, that means
      //REALLY small) chance that this fails :). If so, re-run the conversion...
      //uuid(UUID.randomUUID().toString().replace('-', ''))

println("    --> Converted file saved at: '${outFile.getCanonicalPath()}'");


And the instructions from ... to-keepass
Save the above code as ConvertFirefoxPasswords.groovy
Export your Firefox passwords to XML using PasswordExporter
Install Groovy
groovy ConvertFirefoxPasswords.groovy password-export-2010-02-18 kp.xml

KPX user
Posts: 1
Joined: 09 Mar 2010, 06:59

Re: import from Firefox

Postby doctorwhite » 09 Mar 2010, 22:50

I've successfully converted the FF XML file using digsim's script but when I import it into keypassx it closes my open DB and prompts me to create a new master key for the imported DB. I want it to import it into the existing DB. Any ideas?

Return to “General Help”

Who is online

Users browsing this forum: No registered users and 1 guest