30
30
logging .basicConfig (level = logging .DEBUG )
31
31
32
32
# database defaults
33
- DISK_LOCATION_DEFAULT = os .path .join (os .path .expanduser ("~" ), ".cache" , "cvedb " )
33
+ DISK_LOCATION_DEFAULT = os .path .join (os .path .expanduser ("~" ), ".cache" , "cve-bin-tool " )
34
34
DBNAME = "cve.db"
35
+ OLD_CACHE_DIR = os .path .join (os .path .expanduser ("~" ), ".cache" , "cvedb" )
35
36
36
37
37
38
class EmptyCache (Exception ):
@@ -145,7 +146,7 @@ class CVEDB(object):
145
146
Downloads NVD data in json form and stores it on disk in a cache.
146
147
"""
147
148
148
- CACHEDIR = os . path . join ( os . path . expanduser ( "~" ), ".cache" , "cvedb" )
149
+ CACHEDIR = DISK_LOCATION_DEFAULT
149
150
FEED = "https://nvd.nist.gov/vuln/data-feeds"
150
151
LOGGER = LOGGER .getChild ("CVEDB" )
151
152
NVDCVE_FILENAME_TEMPLATE = "nvdcve-1.1-{}.json"
@@ -592,6 +593,10 @@ def clear_cached_data(self):
592
593
if os .path .exists (self .cachedir ):
593
594
self .LOGGER .warning (f"Deleting cachedir { self .cachedir } " )
594
595
shutil .rmtree (self .cachedir )
596
+ # Remove files associated with pre-1.0 development tree
597
+ if os .path .exists (OLD_CACHE_DIR ):
598
+ seLf .LOGGER .warning (f"Deleting old cachedir { OLD_CACHE_DIR } " )
599
+ shutil .rmtree (OLD_CACHE_DIR )
595
600
596
601
597
602
def refresh ():
@@ -601,7 +606,7 @@ def refresh():
601
606
602
607
if __name__ == "__main__" :
603
608
LOGGER .debug ("Experimenting..." )
604
- cvedb = CVEDB (os . path . join ( os . path . expanduser ( "~" ), ".cache" , "cvedb" ) )
609
+ cvedb = CVEDB (DISK_LOCATION_DEFAULT )
605
610
# cvedb.refresh()
606
611
# print(cvedb.years())
607
612
# connection = cvedb.init_database()
0 commit comments