Skip to content

Instantly share code, notes, and snippets.

@jamespo
Created June 29, 2012 20:45
Show Gist options
  • Save jamespo/3020536 to your computer and use it in GitHub Desktop.
Save jamespo/3020536 to your computer and use it in GitHub Desktop.
parse phpchain xml export to csv format for import by keepass 2
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''parsephpchain.py - parse phpchain XML export to CSV'''
import xml.etree.ElementTree as ET
import sys
def parse(file):
tree = ET.parse(file)
root = tree.getroot()
pws = root.findall('pwentry')
for pw in pws:
fields = ['username','url','password','title']
outfields = []
for field in fields:
key = pw.find(field)
if key is not None:
outfields.append(key.text)
else:
outfields.append('')
print '|'.join(outfields)
def main(filename):
parse(filename)
if __name__ == '__main__':
main(sys.argv[1])
@jamespo
Copy link
Author

jamespo commented Jun 28, 2023

It's available in the GUI, I can't remember where as it's > 10 years since I used phpChain.

@dropbrick
Copy link

Ok... can't see anything in the GUI. Pretty much no buttons or settings really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment