Example usage.
()
| 17 | ) |
| 18 | |
| 19 | def main(): |
| 20 | """Example usage.""" |
| 21 | |
| 22 | # Load configuration |
| 23 | config = ConfigLoader.load("config/config.yaml") |
| 24 | |
| 25 | # Initialize AI Provider |
| 26 | ai_manager = AIProviderManager(config) |
| 27 | ai_manager.set_provider("openai") # or "claude", "grok", "ollama" |
| 28 | |
| 29 | # Configure scan |
| 30 | target_url = "https://example.com" |
| 31 | |
| 32 | # Initialize Scanner |
| 33 | scanner = ScannerEngine( |
| 34 | target_url=target_url, |
| 35 | config=config, |
| 36 | ai_manager=ai_manager, |
| 37 | depth=2, |
| 38 | threads=5, |
| 39 | verbose=True |
| 40 | ) |
| 41 | |
| 42 | print(f"[*] Starting scan on {target_url}") |
| 43 | |
| 44 | # Run scan |
| 45 | results = scanner.scan( |
| 46 | enable_recon=True, |
| 47 | full_scan=True |
| 48 | ) |
| 49 | |
| 50 | print(f"[+] Scan complete!") |
| 51 | print(f"[+] Found {len(results['vulnerabilities'])} vulnerabilities") |
| 52 | |
| 53 | # Generate report |
| 54 | report_gen = ReportGenerator(config) |
| 55 | |
| 56 | # Generate HTML report |
| 57 | report_gen.generate( |
| 58 | results=results, |
| 59 | output_path="reports/scan_report.html", |
| 60 | format="html" |
| 61 | ) |
| 62 | |
| 63 | print(f"[+] Report saved to: reports/scan_report.html") |
| 64 | |
| 65 | # Print summary |
| 66 | severity_counts = results['severity_summary'] |
| 67 | print("\n=== Vulnerability Summary ===") |
| 68 | print(f"Critical: {severity_counts.get('critical', 0)}") |
| 69 | print(f"High: {severity_counts.get('high', 0)}") |
| 70 | print(f"Medium: {severity_counts.get('medium', 0)}") |
| 71 | print(f"Low: {severity_counts.get('low', 0)}") |
| 72 | |
| 73 | |
| 74 | if __name__ == "__main__": |
no test coverage detected