This page provides example code on how to interact with the KEVin API using Python.
Retrieve vulnerabilities using pagination:
page_number = 2
items_per_page = 50
response = requests.get(f'https://kevin.gtfkd.com/kev?page={page_number}&per_page={items_per_page}')
data = response.json()
print(data)
Retrieve recent KEV data:
import requests
response = requests.get('https://kevin.gtfkd.com/kev')
data = response.json()
print(data)
Search for vulnerabilities with a specific keyword:
search_keyword = 'Microsoft'
response = requests.get(f'https://kevin.gtfkd.com/kev?search={search_keyword}')
data = response.json()
print(data)
Fetch vulnerability details using a CVE-ID:
cve_id = 'CVE-2023-1234'
response = requests.get(f'https://kevin.gtfkd.com/kev/{cve_id}')
data = response.json()
print(data)
Retrieve new vulnerabilities added in the last 7 days:
response = requests.get('https://kevin.gtfkd.com/kev/recent?days=7')
data = response.json()
print(data)
Get the number of CVEs and KEVs:
response = requests.get('https://kevin.gtfkd.com/get_metrics')
data = response.json()
print('Number of CVEs:', data['cves_count'])
print('Number of KEVs:', data['kevs_count'])
cve_id = 'CVE-2023-1234'
response = requests.get(f'https://kevin.gtfkd.com/vuln/{cve_id}')
data = response.json()
print(data)
cve_id = 'CVE-2023-1234'
response = requests.get(f'https://kevin.gtfkd.com/vuln/{cve_id}/nvd')
data = response.json()
print(data)
cve_id = 'CVE-2023-1234'
response = requests.get(f'https://kevin.gtfkd.com/vuln/{cve_id}/mitre')
data = response.json()
print(data)
Retrieve vulnerabilities published in the last 7 days:
response = requests.get('https://kevin.gtfkd.com/recent/published?days=7')
data = response.json()
print(data)
Retrieve vulnerabilities modified in the last 7 days:
response = requests.get('https://kevin.gtfkd.com/recent/modified?days=7')
data = response.json()
print(data)