#!/usr/bin/env python
-from common import cmd_name
+from common import cmd_name, to_utf8
from xml.etree.cElementTree import XML
from argparse import ArgumentParser
__credits__ = []
__license__ = 'GPL'
-__version__ = '0.1'
+__version__ = '0.2'
__maintainer__ = 'Nadeem Douba'
__email__ = 'ndouba@gmail.com'
__status__ = 'Development'
csv = open(f.split('/')[1].split('.')[0] + '.csv', 'w')
xml = XML(zip.open(f).read())
for e in xml.findall('{http://graphml.graphdrawing.org/xmlns}graph/{http://graphml.graphdrawing.org/xmlns}node/{http://graphml.graphdrawing.org/xmlns}data/{http://maltego.paterva.com/xml/mtgx}MaltegoEntity'):
- csv.write(('"Entity Type=%s",' % e.get('type')).strip())
+ csv.write(to_utf8(('"Entity Type=%s",' % e.get('type')).strip()))
for prop in e.findall('{http://maltego.paterva.com/xml/mtgx}Properties/{http://maltego.paterva.com/xml/mtgx}Property'):
value = prop.find('{http://maltego.paterva.com/xml/mtgx}Value').text or ''
if '"' in value:
value.replace('"', '""')
- csv.write(('"%s=%s",' % (prop.get('displayName'), value)).strip())
+ csv.write(to_utf8(('"%s=%s",' % (prop.get('displayName'), value)).strip().replace('\n', ', ')))
csv.write('\n')
\ No newline at end of file