From d55e403c7aefd097486a496816e62806e93a181c Mon Sep 17 00:00:00 2001 From: Ramaguru Radhakrishnan <r_ramaguru@cb.amrita.edu> Date: Wed, 12 Apr 2023 10:49:12 +0530 Subject: [PATCH] Added script to collect CVE --- scripts/CVE_Collector.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 scripts/CVE_Collector.py diff --git a/scripts/CVE_Collector.py b/scripts/CVE_Collector.py new file mode 100644 index 0000000..9064a1e --- /dev/null +++ b/scripts/CVE_Collector.py @@ -0,0 +1,30 @@ +# Author: Ramaguru Radhakrishnan +# Date: 08-April-2023 +# Description : To collect the CVEs from the NIST Endpoint API + +import requests +import json +from bs4 import BeautifulSoup + +# Define the base URL for the NVD API +base_url = 'https://services.nvd.nist.gov/rest/json/cves/1.0' + +#search_url = 'https://nvd.nist.gov/vuln/search/results?form_type=Advanced&results_type=overview&search_type=all&query=crypto&startIndex=0' + +# Define the query parameters for the API request +params = {'resultsPerPage': 1000, 'startIndex': 0} + +# Send the API request and get the response +response = requests.get(base_url, params=params) + +# Parse the response JSON and get the CVE items +cve_items = json.loads(response.content)['result']['CVE_Items'] + +#print (cve_items) + +# Print the CVE IDs and descriptions for the first 10 items +for item in cve_items[:10]: + print('CVE ID:', item['cve']['CVE_data_meta']['ID']) + print('Description:', item['cve']['description']['description_data'][0]['value']) + print('---') + -- GitLab