'This method will discard the output the shell sends, it will read it
from the xml where it expects it to be present.
NOTE: if \'debug\' is true then it is being run from a test case and the
output being sent is valid.'

def parseOutputString(self, output, debug=False):

    parser = NmapXmlParser(output)
    for host in parser.hosts:
        if (host.mac_address == 'unknown'):
            host.mac_address = '00:00:00:00:00:00'
        if (host.ipv4_address != 'unknown'):
            minterfase = host.ipv4_address
            h_id = self.createAndAddHost(minterfase, host.os)
            i_id = self.createAndAddInterface(h_id, minterfase, host.mac_address, ipv4_address=host.ipv4_address, hostname_resolution=host.hostnames)
        else:
            minterfase = host.ipv6_address
            h_id = self.createAndAddHost(minterfase, host.os)
            i_id = self.createAndAddInterface(h_id, minterfase, host.mac_address, ipv6_address=host.ipv6_address, hostname_resolution=host.hostnames)
        for v in host.vulns:
            desc = v.desc
            desc += (('\nOutput:    ' + v.response) if v.response else '')
            v_id = self.createAndAddVulnToHost(h_id, v.name, desc=v.desc, severity=0)
        for port in host.ports:
            srvname = str(port.number)
            srvversion = 'unknown'
            if (port.service is not None):
                srvname = port.service.name
                srvversion = (port.service.product if (port.service.product != 'unknown') else '')
                srvversion += (('    ' + port.service.version) if (port.service.version != 'unknown') else '')
            s_id = self.createAndAddServiceToInterface(h_id, i_id, srvname, port.protocol, ports=[port.number], status=port.state, version=srvversion, description=srvname)
            note = True
            for v in port.vulns:
                severity = 0
                desc = v.desc
                desc += (('\nOutput:    ' + v.response) if v.response else '')
                if re.search('VULNERABLE', desc):
                    severity = 'high'
                if re.search('ERROR', desc):
                    severity = 'unclassified'
                if re.search("Couldn't", desc):
                    severity = 'unclassified'
                if v.web:
                    if note:
                        n_id = self.createAndAddNoteToService(h_id, s_id, 'website', '')
                        n2_id = self.createAndAddNoteToNote(h_id, s_id, n_id, minterfase, '')
                        note = False
                    v_id = self.createAndAddVulnWebToService(h_id, s_id, v.name, desc=desc, severity=severity, website=minterfase)
                else:
                    v_id = self.createAndAddVulnToService(h_id, s_id, v.name, desc=v.desc, severity=severity)
    del parser
    return True
