Run scans and get AI-powered analysis.
(
target: str = typer.Argument(..., help="Target to analyze"),
provider: str = typer.Option("anthropic", "--provider", "-p", help="LLM provider (anthropic/openai/ollama/qwen/llama3/mistral)"),
model: Optional[str] = typer.Option(None, "--model", "-m", help="Model name"),
base_url: Optional[str] = typer.Option(None, "--base-url", "-b", help="Base URL for ollama or custom API"),
quick: bool = typer.Option(False, "--quick", "-q", help="Quick scan (fewer modules)"),
)
| 660 | |
| 661 | console.print() |
| 662 | console.print("[bold]Usage Examples:[/bold]") |
| 663 | console.print(" secsuite ai analyze example.com -p ollama -m qwen2.5") |
| 664 | console.print(" secsuite ai analyze example.com -p ollama/llama3.2") |
| 665 | console.print(" secsuite ai analyze example.com -p qwen") |
| 666 | console.print(" secsuite ai analyze example.com -p mistral") |
| 667 | console.print(" secsuite ai ask 'What is XSS?' -p ollama -m mistral") |
| 668 | |
| 669 | |
| 670 | @ai_app.command("analyze") |
| 671 | def ai_analyze( |
| 672 | target: str = typer.Argument(..., help="Target to analyze"), |
| 673 | provider: str = typer.Option("anthropic", "--provider", "-p", help="LLM provider (anthropic/openai/ollama/qwen/llama3/mistral)"), |
| 674 | model: str | None = typer.Option(None, "--model", "-m", help="Model name"), |
| 675 | base_url: str | None = typer.Option(None, "--base-url", "-b", help="Base URL for ollama or custom API"), |
| 676 | quick: bool = typer.Option(False, "--quick", "-q", help="Quick scan (fewer modules)"), |
| 677 | ): |
| 678 | """Run scans and get AI-powered analysis.""" |
| 679 | setup_logging() |
| 680 | |
| 681 | console.print(f"[bold]AI Security Analysis:[/bold] {target}") |
| 682 | console.print() |
| 683 | |
| 684 | # Determine which modules to run |
| 685 | if quick: |
| 686 | modules = ["dns", "headers", "tech", "ssl"] |
| 687 | else: |
| 688 | modules = ["dns", "whois", "headers", "tech", "ports", "ssl", "dirs"] |
| 689 | |
| 690 | console.print("[cyan]Running security scans...[/cyan]") |
| 691 | results = _collect_scan_results(target, modules) |
| 692 | |
| 693 | if not results: |
| 694 | console.print("[red]No scan results collected[/red]") |
| 695 | return |
| 696 | |
| 697 | console.print(f"[green]Collected {len(results)} scan results[/green]") |
| 698 | console.print() |
| 699 | |
| 700 | # Run AI analysis |
| 701 | console.print("[cyan]Running AI analysis...[/cyan]") |
| 702 | try: |
| 703 | from modules.ai import SecurityCopilot |
| 704 | |
| 705 | copilot = SecurityCopilot(provider=provider, model=model, base_url=base_url) |
| 706 | copilot.load_scan_results(results) |
| 707 | |
| 708 | analysis = run_async(copilot.analyze()) |
| 709 | |
| 710 | console.print() |
| 711 | console.print(Panel(analysis, title="[bold magenta]AI Security Analysis[/bold magenta]", border_style="magenta")) |
| 712 | |
| 713 | except ValueError as e: |
| 714 | console.print(f"[red]Configuration error: {e}[/red]") |
| 715 | console.print("[dim]For cloud: Set SECSUITE_ANTHROPIC_API_KEY or SECSUITE_OPENAI_API_KEY[/dim]") |
| 716 | console.print("[dim]For local: Use -p ollama -m <model> (requires Ollama running)[/dim]") |
nothing calls this directly
no test coverage detected