odie5533
March 12th, 2008, 03:22 AM
I've read a few methods on how to convert from one to other, all of which required a surplus of programs and none of which came remotely close to the accuracy I wanted. Using PassCrypt, you can import _some_ passwords from Roboform and export them to csv. From there you have to hack your way to get it to work with KeePass and then import it into KeePassX. I've done it this way, but the problem is that PassCrypt is not very good at finding your passwords in the Roboform export file.
And thus, I present you with my simple python method. I migrated over 600 passwords with an estimated 95% accuracy.
This guide is for KeePassX 0.30 (http://www.keepassx.org/), but can also be used for regular KeePass (http://keepass.info) (Follow the guide using KeePassX and save the database as a kdb file. Then just open the kdb in KeePass).
To install this version, in a terminal type sudo dpkg --install keepassx_0.3.0a-0ubuntu1~ppa1_amd64.deb
1. On Windows, export your Roboform passwords to html. I used a 2-column layout but I do not believe this has any effect.
2. Copy and paste the following into a file called KeePassX.py in the same directory as your Roboform html backup:
import re
outputFilename = 'KeePass.xml'
inputFilename = 'Roboform.html'
def printHeader(out):
out.write('<!DOCTYPE KEEPASSX_DATABASE>\r\n<database>\r\n<group>\r\n')
def printFooter(out):
out.write('</group>\r\n</database>\r\n')
def makeOutput(out, desc, un, pw, url, comment):
out.write(' <entry>\r\n')
out.write(' <title>' + desc + '</title>\r\n')
out.write(' <username>' + un + '</username>\r\n')
out.write(' <password>' + pw + '</password>\r\n')
out.write(' <url>' + url + '</url>\r\n')
out.write(' <comment>' + comment + '</comment>\r\n')
out.write(' </entry>\r\n')
def inVarz(val, varz):
for var in varz:
if re.search(val, var[0], re.I) and len(var) > 1 and var[1] != '*':
return var[1]
return ''
def getVars(t):
varz = []
regTr = re.compile('<TR>(.*?)</TR>',re.S)
regTd = re.compile('<TD>(.*?)</TD>',re.S)
trs = regTr.findall(t)
for tr in trs:
tds = regTd.findall(tr)
# Removes blank entires
for td in tds:
if td == '':
tds.remove(td)
varz.append(tds)
return varz
def getUn(varz):
un = ''
un = inVarz('username', varz)
if un == '':
un = inVarz('uname', varz)
if un == '':
un = inVarz('user', varz)
if un == '':
un = inVarz('log', varz)
if un == '':
un = inVarz('mail', varz)
if un == '':
un = inVarz('name', varz)
if un == '':
un = inVarz('account', varz)
if un == '':
un = inVarz('member', varz)
if un == '':
un = inVarz('uid', varz)
if un == '':
un = inVarz('nick', varz)
if un == '':
un = inVarz('id', varz)
return un
def getPw(varz):
pw = ''
pw = inVarz('pass', varz)
if pw == '':
pw = inVarz('pin', varz)
if pw == '':
pw = inVarz('key', varz)
if pw == '':
pw = inVarz('pw', varz)
return pw
def getEmail(varz):
mail = ''
mail = inVarz('mail', varz)
return mail
fin = open(inputFilename, "r")
f = fin.read()
fin.close()
# Mine was in UTF-16 (?!) so I decided to
# make a check incase yours was too
# It should handle UTF-8 by default
if ord(f[0]) == 255 and ord(f[1]) == 254:
f = unicode(f, 'utf-16')
# I wonder what would happen if your file
# was ascii... Bah, no one would use ascii.
f = f.replace('<WBR>', '')
f = f.replace('<BR>','')
f = re.sub('<TR[^>]*?>','<TR>',f)
f = re.sub('<TD[^>]*?>','<TD>',f)
p = re.compile('<TBODY>.*?</TBODY>',re.S)
finds = p.findall(f)
out = open(outputFilename, 'w')
printHeader(out)
i = 0
for tbody in finds:
varz = getVars(tbody)
desc = varz[0][0]
if len(desc)> 5 and desc.find('<TD>') != -1: #pmg hax...
desc = desc[43:]
url = varz[1][0]
un = getUn(varz)
pw = getPw(varz)
email = getEmail(varz)
makeOutput(out, desc, un, pw, url, email)
i = i + 1
printFooter(out)
out.close()
print 'Converted ' + str(i) + ' passwords'
3. Edit the file and set the inputFilename to the html file you exported from Roboform.
4. In a terminal run python KeePassX.py
5. Open KeePassX 0.30 and go to File > Import from > KeePassX XML
6. Locate the xml file created by the python script and load it into KeePassX.
Enjoy!
And thus, I present you with my simple python method. I migrated over 600 passwords with an estimated 95% accuracy.
This guide is for KeePassX 0.30 (http://www.keepassx.org/), but can also be used for regular KeePass (http://keepass.info) (Follow the guide using KeePassX and save the database as a kdb file. Then just open the kdb in KeePass).
To install this version, in a terminal type sudo dpkg --install keepassx_0.3.0a-0ubuntu1~ppa1_amd64.deb
1. On Windows, export your Roboform passwords to html. I used a 2-column layout but I do not believe this has any effect.
2. Copy and paste the following into a file called KeePassX.py in the same directory as your Roboform html backup:
import re
outputFilename = 'KeePass.xml'
inputFilename = 'Roboform.html'
def printHeader(out):
out.write('<!DOCTYPE KEEPASSX_DATABASE>\r\n<database>\r\n<group>\r\n')
def printFooter(out):
out.write('</group>\r\n</database>\r\n')
def makeOutput(out, desc, un, pw, url, comment):
out.write(' <entry>\r\n')
out.write(' <title>' + desc + '</title>\r\n')
out.write(' <username>' + un + '</username>\r\n')
out.write(' <password>' + pw + '</password>\r\n')
out.write(' <url>' + url + '</url>\r\n')
out.write(' <comment>' + comment + '</comment>\r\n')
out.write(' </entry>\r\n')
def inVarz(val, varz):
for var in varz:
if re.search(val, var[0], re.I) and len(var) > 1 and var[1] != '*':
return var[1]
return ''
def getVars(t):
varz = []
regTr = re.compile('<TR>(.*?)</TR>',re.S)
regTd = re.compile('<TD>(.*?)</TD>',re.S)
trs = regTr.findall(t)
for tr in trs:
tds = regTd.findall(tr)
# Removes blank entires
for td in tds:
if td == '':
tds.remove(td)
varz.append(tds)
return varz
def getUn(varz):
un = ''
un = inVarz('username', varz)
if un == '':
un = inVarz('uname', varz)
if un == '':
un = inVarz('user', varz)
if un == '':
un = inVarz('log', varz)
if un == '':
un = inVarz('mail', varz)
if un == '':
un = inVarz('name', varz)
if un == '':
un = inVarz('account', varz)
if un == '':
un = inVarz('member', varz)
if un == '':
un = inVarz('uid', varz)
if un == '':
un = inVarz('nick', varz)
if un == '':
un = inVarz('id', varz)
return un
def getPw(varz):
pw = ''
pw = inVarz('pass', varz)
if pw == '':
pw = inVarz('pin', varz)
if pw == '':
pw = inVarz('key', varz)
if pw == '':
pw = inVarz('pw', varz)
return pw
def getEmail(varz):
mail = ''
mail = inVarz('mail', varz)
return mail
fin = open(inputFilename, "r")
f = fin.read()
fin.close()
# Mine was in UTF-16 (?!) so I decided to
# make a check incase yours was too
# It should handle UTF-8 by default
if ord(f[0]) == 255 and ord(f[1]) == 254:
f = unicode(f, 'utf-16')
# I wonder what would happen if your file
# was ascii... Bah, no one would use ascii.
f = f.replace('<WBR>', '')
f = f.replace('<BR>','')
f = re.sub('<TR[^>]*?>','<TR>',f)
f = re.sub('<TD[^>]*?>','<TD>',f)
p = re.compile('<TBODY>.*?</TBODY>',re.S)
finds = p.findall(f)
out = open(outputFilename, 'w')
printHeader(out)
i = 0
for tbody in finds:
varz = getVars(tbody)
desc = varz[0][0]
if len(desc)> 5 and desc.find('<TD>') != -1: #pmg hax...
desc = desc[43:]
url = varz[1][0]
un = getUn(varz)
pw = getPw(varz)
email = getEmail(varz)
makeOutput(out, desc, un, pw, url, email)
i = i + 1
printFooter(out)
out.close()
print 'Converted ' + str(i) + ' passwords'
3. Edit the file and set the inputFilename to the html file you exported from Roboform.
4. In a terminal run python KeePassX.py
5. Open KeePassX 0.30 and go to File > Import from > KeePassX XML
6. Locate the xml file created by the python script and load it into KeePassX.
Enjoy!