daqc's picture
Upload 36 files
52b089b verified
raw
history blame
1.59 kB
"""MCP tools for vulnerability search and report generation."""
from smolagents import Tool
import json
import os
from datetime import datetime
from gradio_mcp import tool
from scripts.cvedb_tool import CVEDBTool
from scripts.nvd_tool import NvdTool
from scripts.kevin_tool import KevinTool
from scripts.epss_tool import EpsTool
from scripts.report_generator import ReportGeneratorTool
# Instancias de las herramientas existentes
cvedb_tool = CVEDBTool()
nvd_tool = NvdTool()
kevin_tool = KevinTool()
epss_tool = EpsTool()
report_tool = ReportGeneratorTool()
@tool
def search_cvedb(search_type: str, identifier: str) -> str:
"""Search for vulnerabilities in CVEDB by CVE or product."""
return cvedb_tool.forward(search_type, identifier)
@tool
def search_nvd(search_type: str, identifier: str, exact_match: bool = False) -> str:
"""Search for vulnerabilities in NVD by CVE or keyword."""
return nvd_tool.forward(search_type, identifier, exact_match)
@tool
def search_kevin(search_type: str, identifier: str) -> str:
"""Search for known exploited vulnerabilities (KEV) by CVE or keyword."""
return kevin_tool.forward(search_type, identifier)
@tool
def search_epss(cve_id: str, date: str) -> str:
"""Search for EPSS score for a specific CVE."""
return epss_tool.forward(cve_id, date)
@tool
def generate_vulnerability_report(vulnerability_data: str, report_type: str) -> str:
"""Generate an interactive HTML vulnerability report from JSON data."""
return report_tool.forward(vulnerability_data, report_type)