Created
June 29, 2012 20:45
-
-
Save jamespo/3020536 to your computer and use it in GitHub Desktop.
parse phpchain xml export to csv format for import by keepass 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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]) |
It's available in the GUI, I can't remember where as it's > 10 years since I used phpChain.
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
Hi! How did you export an XML from Phpchain ?