def getcpe(self, cpeid=None): if not(self.namelookup): return cpeid e = db.getCPE(cpeid) if e is None: e = db.getAlternativeCPE(cpeid) if e is None: return cpeid if 'id' in e: return e['title']
def getcpe(self, cpeid=None): if not (self.namelookup): return cpeid e = db.getCPE(cpeid) if e is None: e = db.getAlternativeCPE(cpeid) if e is None: return cpeid if 'id' in e: return e['title']
else: collections = db.getCVEs() # check cpes for cves and parse and store missing cpes in cpeother batch = [] # skip on empty collections col = list(collections) if not col: print("Empty collections, import skipped") sys.exit(2) for item in progressbar(col): for cpeentry in item['vulnerable_configuration']: checkdup = db.getAlternativeCPE(cpeentry) if checkdup and len(checkdup) <= 0: entry = db.getCPE(cpeentry) if entry and len(entry.count) <= 0: title = cpeentry title = title[10:] title = title.replace(':-:', ' ', 10) title = title.replace(':', ' ', 10) title = title.replace('_', ' ', 10) title = urllib.parse.unquote_plus(title) title = title.title() batch.append({'id': cpeentry, 'title': title}) if len(batch) != 0: db.cpeotherBulkInsert(batch) #update database info after successful program-run db.setColUpdate('cpeother', icve)
def lookupcpe(cpeid=None): e = db.getCPE(cpeid) if e is None: return cpeid if "id" in e: return e["title"]
def lookupcpe(cpeid=None): e = db.getCPE(cpeid) if e is None: return cpeid if 'id' in e: return e['title']
else: collections = db.getCVEs() # check cpes for cves and parse and store missing cpes in cpeother batch = [] # skip on empty collections col=list(collections) if not col: print ("Empty collections, import skipped") sys.exit(2) for item in progressbar(col): for cpeentry in item['vulnerable_configuration']: checkdup = db.getAlternativeCPE(cpeentry) if checkdup and len(checkdup) <= 0: entry = db.getCPE(cpeentry) if entry and len(entry.count) <= 0: title = cpeentry title = title[10:] title = title.replace(':-:', ' ',10) title = title.replace(':', ' ',10) title = title.replace('_', ' ',10) title = urllib.parse.unquote_plus(title) title = title.title() batch.append({'id': cpeentry, 'title': title}) if len(batch) != 0: db.cpeotherBulkInsert(batch) #update database info after successful program-run db.setColUpdate('cpeother', icve)