@@ -161,79 +161,79 @@ def fetch_links(url):
161161
162162
163163def get_weaknesses (cve_data ):
164- # """
165- # Extract CWE IDs from CVE data.
164+ """
165+ Extract CWE IDs from CVE data.
166166
167- # Args:
168- # cve_data (dict): The CVE data in a dictionary format.
167+ Args:
168+ cve_data (dict): The CVE data in a dictionary format.
169169
170- # Returns:
171- # List[int]: A list of unique CWE IDs.
170+ Returns:
171+ List[int]: A list of unique CWE IDs.
172172
173- # Examples:
174- # >>> mock_cve_data1 = {
175- # ... "containers": {
176- # ... "cna": {
177- # ... "providerMetadata": {
178- # ... "orgId": "f0158376-9dc2-43b6-827c-5f631a4d8d09"
179- # ... },
180- # ... "title": "mod_macro buffer over-read",
181- # ... "problemTypes": [
182- # ... {
183- # ... "descriptions": [
184- # ... {
185- # ... "description": "CWE-125 Out-of-bounds Read",
186- # ... "lang": "en",
187- # ... "cweId": "CWE-125",
188- # ... "type": "CWE"
189- # ... }
190- # ... ]
191- # ... }
192- # ... ]
193- # ... }
194- # ... }
195- # ... }
196- # >>> mock_cve_data2 = {
197- # ... "data_type": "CVE",
198- # ... "data_format": "MITRE",
199- # ... "data_version": "4.0",
200- # ... "generator": {
201- # ... "engine": "Vulnogram 0.0.9"
202- # ... },
203- # ... "CVE_data_meta": {
204- # ... "ID": "CVE-2022-28614",
205- # ... "ASSIGNER": "[email protected] ", 206- # ... "TITLE": "read beyond bounds via ap_rwrite() ",
207- # ... "STATE": "PUBLIC"
208- # ... },
209- # ... "problemtype": {
210- # ... "problemtype_data": [
211- # ... {
212- # ... "description": [
213- # ... {
214- # ... "lang": "eng",
215- # ... "value": "CWE-190 Integer Overflow or Wraparound"
216- # ... }
217- # ... ]
218- # ... },
219- # ... {
220- # ... "description": [
221- # ... {
222- # ... "lang": "eng",
223- # ... "value": "CWE-200 Exposure of Sensitive Information to an Unauthorized Actor"
224- # ... }
225- # ... ]
226- # ... }
227- # ... ]
228- # ... }
229- # ... }
173+ Examples:
174+ >>> mock_cve_data1 = {
175+ ... "containers": {
176+ ... "cna": {
177+ ... "providerMetadata": {
178+ ... "orgId": "f0158376-9dc2-43b6-827c-5f631a4d8d09"
179+ ... },
180+ ... "title": "mod_macro buffer over-read",
181+ ... "problemTypes": [
182+ ... {
183+ ... "descriptions": [
184+ ... {
185+ ... "description": "CWE-125 Out-of-bounds Read",
186+ ... "lang": "en",
187+ ... "cweId": "CWE-125",
188+ ... "type": "CWE"
189+ ... }
190+ ... ]
191+ ... }
192+ ... ]
193+ ... }
194+ ... }
195+ ... }
196+ >>> mock_cve_data2 = {
197+ ... "data_type": "CVE",
198+ ... "data_format": "MITRE",
199+ ... "data_version": "4.0",
200+ ... "generator": {
201+ ... "engine": "Vulnogram 0.0.9"
202+ ... },
203+ ... "CVE_data_meta": {
204+ ... "ID": "CVE-2022-28614",
205+ ... "ASSIGNER": "[email protected] ", 206+ ... "TITLE": "read beyond bounds via ap_rwrite() ",
207+ ... "STATE": "PUBLIC"
208+ ... },
209+ ... "problemtype": {
210+ ... "problemtype_data": [
211+ ... {
212+ ... "description": [
213+ ... {
214+ ... "lang": "eng",
215+ ... "value": "CWE-190 Integer Overflow or Wraparound"
216+ ... }
217+ ... ]
218+ ... },
219+ ... {
220+ ... "description": [
221+ ... {
222+ ... "lang": "eng",
223+ ... "value": "CWE-200 Exposure of Sensitive Information to an Unauthorized Actor"
224+ ... }
225+ ... ]
226+ ... }
227+ ... ]
228+ ... }
229+ ... }
230230
231- # >>> get_weaknesses(mock_cve_data1)
232- # [125]
231+ >>> get_weaknesses(mock_cve_data1)
232+ [125]
233233
234- # >>> get_weaknesses(mock_cve_data2)
235- # [190, 200]
236- # """
234+ >>> get_weaknesses(mock_cve_data2)
235+ [190, 200]
236+ """
237237
238238 alias = get_item (cve_data , "CVE_data_meta" , "ID" )
239239 cwe_id = []
0 commit comments