diff farolluz/parsers/cve.py @ 48:3826f2701ff2

CPE: Add the possibility to add ourself integrally to the product tree
author Benoît Allard <benoit.allard@greenbone.net>
date Tue, 30 Dec 2014 12:30:19 +0100
parents 075519975933
children
line wrap: on
line diff
--- a/farolluz/parsers/cve.py	Tue Dec 30 12:29:07 2014 +0100
+++ b/farolluz/parsers/cve.py	Tue Dec 30 12:30:19 2014 +0100
@@ -32,6 +32,7 @@
 
 import xml.etree.ElementTree as ET
 
+from .cpe import parse as parseCPE
 from .xml import parseDate
 
 from .. import __version__
@@ -150,13 +151,7 @@
     for i, cpe in enumerate(xml.findall(
                                 '/'.join([UN('vuln', 'vulnerable-software-list'),
                                           UN('vuln', 'product')]))):
-        if doc._producttree is None:
-            doc.createProductTree()
-        try:
-            prod = doc._producttree.getProductForCPE(cpe.text)
-        except KeyError:
-            prod = CVRFFullProductName('%s-P%d' % (vulnid, i), cpe.text, doc._producttree, cpe.text)
-            doc._producttree.addProduct(prod)
+        prod = parseCPE(cpe.text).addToDoc(doc)
         vulnerable_products.append(prod)
 
     if vulnerable_products:
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)