panos_util/objects.py
def create_from_element(e: Element) -> VulnerabilitySignature:
        """Create VulnerabilitySignature from XML element."""
        threat_id = e.get("name")
        threat_name = strip_empty(e.findtext("threatname"))

        vendor_id = []
        for vendor in e.findall(".//vendor/member"):
            vendor_id.append(vendor.text)

        cve_id = []
        for cve in e.findall(".//cve/member"):
            cve_id.append(cve.text)

        category = strip_empty(e.findtext("category"))
        severity = strip_empty(e.findtext("severity"))

        min_version = None
        max_version = None
        engine_version = e.find(".//engine-version")
        if engine_version is not None:
            min_version = engine_version.get("min")
            max_version = engine_version.get("max")

        default_action = strip_empty(e.findtext("default-action"))

        affected_hosts = []
        for affected_host in e.findall("./affected-host/"):
            affected_hosts.append(affected_host.tag)

        return VulnerabilitySignature(
            threat_id,
            threat_name,
            vendor_id,
            cve_id,
            category,
            severity,
            min_version,
            max_version,
            affected_hosts,
            default_action,
        )
Create VulnerabilitySignature from XML element.
Create VulnerabilitySignature from XML element.
Create VulnerabilitySignature from XML element .
def create_from_element(e: Element) -> VulnerabilitySignature:
        threat_id = e.get("name")
        threat_name = strip_empty(e.findtext("threatname"))
        vendor_id = []
        for vendor in e.findall(".//vendor/member"):
            vendor_id.append(vendor.text)
        cve_id = []
        for cve in e.findall(".//cve/member"):
            cve_id.append(cve.text)
        category = strip_empty(e.findtext("category"))
        severity = strip_empty(e.findtext("severity"))
        min_version = None
        max_version = None
        engine_version = e.find(".//engine-version")
        if engine_version is not None:
            min_version = engine_version.get("min")
            max_version = engine_version.get("max")
        default_action = strip_empty(e.findtext("default-action"))
        affected_hosts = []
        for affected_host in e.findall("./affected-host/"):
            affected_hosts.append(affected_host.tag)
        return VulnerabilitySignature(
            threat_id,
            threat_name,
            vendor_id,
            cve_id,
            category,
            severity,
            min_version,
            max_version,
            affected_hosts,
            default_action,
        )
def create_from_element ( e : Element ) -> VulnerabilitySignature : threat_id = e . get ( "name" ) threat_name = strip_empty ( e . findtext ( "threatname" ) ) vendor_id = [ ] for vendor in e . findall ( ".//vendor/member" ) : vendor_id . append ( vendor . text ) cve_id = [ ] for cve in e . findall ( ".//cve/member" ) : cve_id . append ( cve . text ) category = strip_empty ( e . findtext ( "category" ) ) severity = strip_empty ( e . findtext ( "severity" ) ) min_version = None max_version = None engine_version = e . find ( ".//engine-version" ) if engine_version is not None : min_version = engine_version . get ( "min" ) max_version = engine_version . get ( "max" ) default_action = strip_empty ( e . findtext ( "default-action" ) ) affected_hosts = [ ] for affected_host in e . findall ( "./affected-host/" ) : affected_hosts . append ( affected_host . tag ) return VulnerabilitySignature ( threat_id , threat_name , vendor_id , cve_id , category , severity , min_version , max_version , affected_hosts , default_action , )
Create VulnerabilitySignature from XML element.
Create VulnerabilitySignature from XML element .
"""Create VulnerabilitySignature from XML element."""
e
Element