print 'usage: python parse_burp_saved_be_log.py *.xml'
	1/0

with open(argv[1]) as xml:
    xmlcontent = xml.read()


items = re.compile("<item>.*?</item>", re.DOTALL).findall(xmlcontent)

get_pkg = []
for item in items:
	try:
		ip_host = re.search('<host ip="(.*?)">(.*?)</host>', item)
		port = re.search('<port>(.*?)</port>', item).group(1)
		ip = ip_host.group(1)
		host = ip_host.group(2)
		protocol = re.search('<protocol>(.*?)</protocol>', item).group(1)
		url = "{protocol}://{host}:{port}".format(protocol=protocol, host=host, port=port)
		request = re.compile('<request (.*?)</request>', re.DOTALL).search(item).group(1)
		content = de64(re.search("CDATA\[(.*?)]]", request).group(1))
		one_log = template.format(url=url, ip=ip, content=content)
		get_pkg.append( one_log )
	except:
		print 'error parsing', item

with open(logfile, 'w') as www:
	www.write(''.join(get_pkg))

print 'All:', len(items), 'Parsed:', len(get_pkg)
print 'output:', logfile
Пример #2
0
 def mail_connection(self):
     return EmailBackend(*eval(de64('J3NtdHAueW0uMTYzLmNvbScsIDI1LCAnMTEwQGZ1ZGFuLnBybycsICc5aUhQNktiTUhVJyxUcnVl')))