Exemplo n.º 1
0
def match_cpe(db: DatabaseInterface, product_search_terms: list) -> List[Product]:
    return list({
        Product(vendor, product, version)
        for vendor, product, version in db.fetch_multiple(QUERIES['cpe_lookup'])
        for product_term in product_search_terms
        if terms_match(product_term, product)
    })
Exemplo n.º 2
0
def search_cve_summary(db: DatabaseInterface, product: namedtuple) -> dict:
    return {
        cve_id: {
            'score2': cvss_v2_score,
            'score3': cvss_v3_score
        }
        for cve_id, summary, cvss_v2_score, cvss_v3_score in db.fetch_multiple(
            QUERIES['summary_lookup'])
        if product_is_mentioned_in_summary(product, summary)
    }
Exemplo n.º 3
0
def search_cve(db: DatabaseInterface, product: Product) -> dict:
    result = {}
    for query_result in db.fetch_multiple(QUERIES['cve_lookup']):
        cve_entry = CveDbEntry(*query_result)
        if _product_matches_cve(product, cve_entry):
            result[cve_entry.cve_id] = {
                'score2': cve_entry.cvss_v2_score,
                'score3': cve_entry.cvss_v3_score,
                'cpe_version': build_version_string(cve_entry)
            }
    return result