File size: 1,594 Bytes
52b089b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
"""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) |