File tree Expand file tree Collapse file tree 1 file changed +5
-16
lines changed
cve_bin_tool/sbom_manager Expand file tree Collapse file tree 1 file changed +5
-16
lines changed Original file line number Diff line number Diff line change 1
1
# Copyright (C) 2021 Anthony Harrison
2
2
# SPDX-License-Identifier: GPL-3.0-or-later
3
3
4
- import sqlite3
5
4
from collections import defaultdict
6
5
from logging import Logger
7
6
from typing import DefaultDict , Dict , List , Optional
@@ -83,21 +82,11 @@ def scan_file(self) -> Dict[ProductInfo, TriageData]:
83
82
return self .sbom_data
84
83
85
84
def get_vendor (self , product : str ) -> Optional [str ]:
86
- self .cvedb .db_open ()
87
- if not self .cvedb .connection :
88
- raise ConnectionError ()
89
- self .cursor = self .cvedb .connection .cursor ()
90
- get_vendor_request = "SELECT DISTINCT VENDOR FROM cve_range where PRODUCT=?"
91
- self .cursor .execute (get_vendor_request , [product ])
92
- try :
93
- # If multiple unique vendors then shouldn't proceed....
94
- vendor = self .cursor .fetchone ()[0 ]
95
- # print(f"{product} is produced by {vendor}")
96
- except (sqlite3 .Error , TypeError ) as e :
97
- LOGGER .debug (e , exc_info = True )
98
- vendor = None
99
- self .cvedb .db_close ()
100
- return vendor
85
+ vendor_package_pair = self .cvedb .get_vendor_product_pairs (product )
86
+ if vendor_package_pair != []:
87
+ vendor = vendor_package_pair [0 ]["vendor" ]
88
+ return vendor
89
+ return None
101
90
102
91
103
92
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments