Search for exploits using searchsploit.
(
query: str = typer.Argument(..., help="Search query (service, product, CVE)"),
verbose: bool = typer.Option(False, "--verbose", "-v"),
)
| 487 | display_result(result) |
| 488 | |
| 489 | |
| 490 | # ============== Exploit Commands ============== |
| 491 | |
| 492 | @exploit_app.command("search") |
| 493 | def exploit_search( |
| 494 | query: str = typer.Argument(..., help="Search query (service, product, CVE)"), |
| 495 | verbose: bool = typer.Option(False, "--verbose", "-v"), |
| 496 | ): |
| 497 | """Search for exploits using searchsploit.""" |
| 498 | setup_logging(debug=verbose) |
| 499 | from modules.exploit import SearchSploit |
| 500 | |
| 501 | console.print(f"[bold]Exploit Search:[/bold] {query}") |
| 502 | |
| 503 | searcher = SearchSploit() |
| 504 | |
| 505 | if not searcher.searchsploit_available: |
| 506 | console.print("[bold red]Error:[/bold red] searchsploit is not installed.") |
| 507 | console.print("[dim]Install it with: apt install exploitdb[/dim]") |
| 508 | raise typer.Exit(1) |
| 509 | |
| 510 | results = run_async(searcher.search(query)) |
| 511 | |
| 512 | if results: |
| 513 | table = Table(title="Exploits Found") |
| 514 | table.add_column("ID", style="cyan") |
| 515 | table.add_column("Title", style="white") |
| 516 | table.add_column("Type", style="yellow") |
| 517 | table.add_column("Platform", style="green") |
| 518 | |
| 519 | for r in results[:20]: |
| 520 | table.add_row( |
| 521 | str(r.get("EDB-ID", "")), |
| 522 | r.get("Title", "")[:60], |
| 523 | r.get("Type", ""), |
| 524 | r.get("Platform", ""), |
| 525 | ) |
| 526 | |
| 527 | console.print(table) |
| 528 | console.print(f"[dim]Showing {min(20, len(results))} of {len(results)} results[/dim]") |
| 529 | else: |
nothing calls this directly
no test coverage detected