How To Parse MBSA Files Using Python Script
Have you ever needed to analyze MBSA files using Python? Well, you can stop cramming now because Azmath just shared the answer to your problem with this nice Python script!
#------------------------------------------------------------------------------- # Name: MBSA parser # Author: Azmath # Created: 11/07/2012 # Copyright: (c) 2012 #------------------------------------------------------------------------------- from xml.etree import ElementTree with open('test.mbsa', 'rt') as f: tree = ElementTree.parse(f) print "servername" + "|"+"domainname" +"|"+"scandate"+"|"+"id" +"|"+ "severity" +"|"+ "Patchtype" + "|"+"Description" for node in tree.iter('SecScan'): name = node.attrib.get('Machine') domain = node.attrib.get('Domain') scandate = node.attrib.get('LDate') if name and domain: print ' %s :: %s' % (name, domain) else: print name for node in tree.iter('UpdateData'): id = node.attrib.get('ID') if id: isinstalled = node.attrib.get('IsInstalled') if isinstalled == 'false': bid = node.attrib.get('BulletinID') if bid: bulletinid = bid else: bulletinid = "None" idd = node.attrib.get('ID') #print "Patch id = " +idd severity = node.attrib.get('Severity') #print "Severity = "+severity dtype = node.attrib.get ('Type') #print "Patch type:" + dtype for p in node.getiterator('Title'): desc = p.text print name + "|"+domain +"|"+scandate+"|"+idd +"|"+ severity +"|"+ dtype + "|"+desc