MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / ai_correlate

Function ai_correlate

cli/main.py:783–827  ·  view source on GitHub ↗

Correlate findings and identify attack chains.

(
    target: str = typer.Argument(..., help="Target to analyze"),
)

Source from the content-addressed store, hash-verified

781 copilot = SecurityCopilot(provider=provider, model=model, base_url=base_url)
782 copilot.load_scan_results(results)
783
784 summary = run_async(copilot.get_executive_summary())
785 console.print()
786 console.print(Panel(summary, title="[bold blue]Executive Summary[/bold blue]", border_style="blue"))
787
788 except Exception as e:
789 console.print(f"[red]Error: {e}[/red]")
790 if "ollama" in provider.lower():
791 console.print("[dim]Make sure Ollama is running: ollama serve[/dim]")
792
793
794@ai_app.command("correlate")
795def ai_correlate(
796 target: str = typer.Argument(..., help="Target to analyze"),
797):
798 """Correlate findings and identify attack chains."""
799 setup_logging()
800
801 console.print(f"[bold]Finding Correlation:[/bold] {target}")
802
803 results = _collect_scan_results(target, ["dns", "headers", "tech", "ssl", "ports", "dirs"])
804
805 from modules.ai import FindingCorrelator
806
807 correlator = FindingCorrelator()
808 report = correlator.correlate(results)
809
810 # Display risk summary
811 risk = report.risk_summary
812 risk_colors = {"CRITICAL": "red", "HIGH": "red", "MEDIUM": "yellow", "LOW": "blue", "MINIMAL": "green"}
813 risk_color = risk_colors.get(risk.get("risk_level", ""), "white")
814
815 console.print()
816 console.print(Panel(
817 f"[{risk_color}]Risk Score: {risk.get('overall_score', 0)}/100\n"
818 f"Risk Level: {risk.get('risk_level', 'Unknown')}[/{risk_color}]\n\n"
819 f"Total Findings: {report.total_findings}\n"
820 f"Unique Findings: {report.unique_findings}\n"
821 f"High Priority: {risk.get('high_priority_findings', 0)}\n"
822 f"Attack Chains: {risk.get('attack_chains_identified', 0)}",
823 title="[bold]Risk Summary[/bold]"
824 ))
825
826 # Display attack chains
827 if report.attack_chains:
828 console.print()
829 console.print("[bold red]Attack Chains Identified:[/bold red]")
830 for chain in report.attack_chains:

Callers

nothing calls this directly

Calls 5

correlateMethod · 0.95
setup_loggingFunction · 0.90
FindingCorrelatorClass · 0.90
_collect_scan_resultsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected