Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /SHAdd0WTAka_Zen-Ai-Pentest /scripts /scan_live_demo.py
| #!/usr/bin/env python3 | |
| """Live Scan Demo - Mit Auth""" | |
| import os | |
| import time | |
| import requests | |
| BASE = os.environ.get("API_BASE_URL", "http://localhost:8000") | |
| API_USER = os.environ.get("API_USERNAME", "admin") | |
| API_PASS = os.environ.get("API_PASSWORD", "") | |
| if not API_PASS: | |
| print("WARNING: Using default password. Set API_PASSWORD env var for production.") | |
| API_PASS = "admin" | |
| # Login | |
| login = requests.post(f"{BASE}/auth/login", json={"username": API_USER, "password": API_PASS}, timeout=30) | |
| token = login.json()["access_token"] | |
| headers = {"Authorization": f"Bearer {token}"} | |
| print("=" * 60) | |
| print("LIVE SCAN DEMO") | |
| print("=" * 60) | |
| # 1. Scan starten | |
| print("\n[1] Starte Scan auf scanme.nmap.org...") | |
| scan = requests.post( | |
| f"{BASE}/api/v1/scans", | |
| headers=headers, | |
| json={ | |
| "target": "scanme.nmap.org", | |
| "scan_type": "network", | |
| "modules": ["recon"], | |
| }, | |
| timeout=60, | |
| ).json() | |
| scan_id = scan["id"] | |
| print(f" Scan ID: {scan_id}") | |
| print(f" Status: {scan['status']}") | |
| # 2. Status beobachten | |
| print("\n[2] Warte auf Scan...") | |
| for i in range(10): | |
| time.sleep(1) | |
| status = requests.get(f"{BASE}/api/v1/scans/{scan_id}", headers=headers, timeout=30).json() | |
| print(f" Status: {status['status']} | Progress: {status.get('progress', 0)}%") | |
| if status["status"] in ["completed", "failed"]: | |
| break | |
| # 3. Ergebnisse holen | |
| print("\n[3] Hole Ergebnisse...") | |
| results = requests.get(f"{BASE}/api/v1/scans/{scan_id}/results", headers=headers, timeout=30).json() | |
| print(f" Findings: {len(results.get('findings', []))}") | |
| # 4. Alle Scans anzeigen | |
| print("\n[4] Alle Scans:") | |
| scans = requests.get(f"{BASE}/api/v1/scans", headers=headers, timeout=30).json() | |
| for s in scans[-3:]: | |
| print(f" - {s['target']}: {s['status']} ({s.get('findings_count', 0)} findings)") | |
| print("\n" + "=" * 60) | |
| print("SCAN DEMO ABGESCHLOSSEN!") | |
| print("=" * 60) | |
Xet Storage Details
- Size:
- 1.9 kB
- Xet hash:
- 07050cff67c2fe98c93edde7966d0fb4ce1089ea2ea54fb3d1545e2607dce6f0
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.