Interacting with KEVin API

This page provides example code on how to interact with the KEVin API using Python.

Fetching Vulnerabilities with Pagination

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)
    

Get Recent Known Exploited Vulnerabilities

Retrieve recent KEV data:


import requests

response = requests.get('https://kevin.gtfkd.com/kev')
data = response.json()
print(data)
    

Search for Vulnerabilities

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 a Vulnerability by CVE-ID

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)
    

Get Recent Vulnerabilities

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 Metrics

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'])
    

Fetch Data from cveLand


cve_id = 'CVE-2023-1234'
response = requests.get(f'https://kevin.gtfkd.com/vuln/{cve_id}')
data = response.json()
print(data)
    

Fetch NVD Data for a CVE-ID


cve_id = 'CVE-2023-1234'
response = requests.get(f'https://kevin.gtfkd.com/vuln/{cve_id}/nvd')
data = response.json()
print(data)
    

Fetch Mitre Data for a CVE-ID


cve_id = 'CVE-2023-1234'
response = requests.get(f'https://kevin.gtfkd.com/vuln/{cve_id}/mitre')
data = response.json()
print(data)
    

Fetch Recent Vulnerabilities By Days

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)