This very simple script converts a CSV password file to XML ; this is typically needed if you were using Brave browser and/or Firefox and want to switch to something that sucks1 a little less such as Falkon
TODO
It only works for firefox so far
Content
#!/usr/bin/python
# vim: noet ts=4 number nowrap
"""
take a CSV passwords file from Brave of Firefox and convert it to XML for Falkon
"""
from lxml import etree
from sys import argv
root = etree.Element("passwords")
with open(argv[1]) as CSV:
# skipping the first line, it's the header
CSV.readline()
while True:
line = CSV.readline().rstrip('\n').split(',')
if line == ['']:
break
else:
e = etree.SubElement(root, 'entry')
i = etree.SubElement(e, "server")
i.text = line[0].lstrip('"').rstrip('"')
i = etree.SubElement(e, "username")
i.text = line[1].lstrip('"').rstrip('"')
i = etree.SubElement(e, "password")
i.text = line[2].lstrip('"').rstrip('"')
i = etree.SubElement(e, "data")
i.text = line[1].lstrip('"').rstrip('"')+"&"+line[2].lstrip('"').rstrip('"')
e.append( i )
print(etree.tostring(root, pretty_print=True).decode())
-
All browsers suck. ↩︎