vdb/lib/nvd.py
def fetch(self, year):
        """Private Method which downloads the given CVE gzip from NVD"""
        url = config.nvd_url % dict(year=year)
        LOG.debug("Download NVD CVE from {}".format(url))
        with tempfile.NamedTemporaryFile() as tf:
            try:
                r = requests.get(url, stream=True)
            except Exception:
                logging.warning(f"Exception while downloading NVD feed from {url}")
                return None
            for chunk in r.iter_content(chunk_size=download_chunk_size):
                tf.write(chunk)
            tf.flush()
            with gzip.open(tf.name, "rb") as gzipjf:
                cve_data = gzipjf.read()
                try:
                    json_data = json_lib.loads(cve_data)
                    return self.convert(json_data)
                except Exception:
                    logging.warning("Exception while parsing NVD CVE feed")
                    return None
Private Method which downloads the given CVE gzip from NVD
Private Method which downloads the given CVE gzip from NVD
Private Method which downloads the given CVE gzip from NVD
def fetch(self, year):
        url = config.nvd_url % dict(year=year)
        LOG.debug("Download NVD CVE from {}".format(url))
        with tempfile.NamedTemporaryFile() as tf:
            try:
                r = requests.get(url, stream=True)
            except Exception:
                logging.warning(f"Exception while downloading NVD feed from {url}")
                return None
            for chunk in r.iter_content(chunk_size=download_chunk_size):
                tf.write(chunk)
            tf.flush()
            with gzip.open(tf.name, "rb") as gzipjf:
                cve_data = gzipjf.read()
                try:
                    json_data = json_lib.loads(cve_data)
                    return self.convert(json_data)
                except Exception:
                    logging.warning("Exception while parsing NVD CVE feed")
                    return None
def fetch ( self , year ) : url = config . nvd_url % dict ( year = year ) LOG . debug ( "Download NVD CVE from {}" . format ( url ) ) with tempfile . NamedTemporaryFile ( ) as tf : try : r = requests . get ( url , stream = True ) except Exception : logging . warning ( f"Exception while downloading NVD feed from {url}" ) return None for chunk in r . iter_content ( chunk_size = download_chunk_size ) : tf . write ( chunk ) tf . flush ( ) with gzip . open ( tf . name , "rb" ) as gzipjf : cve_data = gzipjf . read ( ) try : json_data = json_lib . loads ( cve_data ) return self . convert ( json_data ) except Exception : logging . warning ( "Exception while parsing NVD CVE feed" ) return None
Private Method which downloads the given CVE gzip from NVD
Private Method which downloads the given CVE gzip from NVD
"""Private Method which downloads the given CVE gzip from NVD"""
self
year