Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save VinayakTiwari1103/68facb0ca277f5556c20c35afa4b40ee to your computer and use it in GitHub Desktop.

Select an option

Save VinayakTiwari1103/68facb0ca277f5556c20c35afa4b40ee to your computer and use it in GitHub Desktop.
import requests
class OSSFuzzResults:
"""A class for accessing OSS-Fuzz historical results and crash reports."""
BASE_URL = "https://oss-fuzz.com/api/v1/reports"
@staticmethod
def get_crash_reports(project_name, start_date, end_date):
"""
Fetches crash reports for a given OSS-Fuzz project within a specified date range.
Args:
project_name (str): The OSS-Fuzz project name.
start_date (str): The start date (YYYY-MM-DD).
end_date (str): The end date (YYYY-MM-DD).
Returns:
dict: A JSON object containing crash report details.
"""
params = {"project": project_name, "start_date": start_date, "end_date": end_date}
response = requests.get(OSSFuzzResults.BASE_URL, params=params)
if response.status_code == 200:
return response.json()
else:
return {"error": f"Failed to fetch reports for {project_name}. Status: {response.status_code}"}
# Usage Example
crash_reports = OSSFuzzResults.get_crash_reports("example_project", "2024-01-01", "2024-03-01")
print(crash_reports)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment