Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /SHAdd0WTAka_Zen-Ai-Pentest /scripts /api_autonomous.py
| #!/usr/bin/env python3 | |
| """Autonomer Scan uber API""" | |
| 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("AUTONOMER SCAN UBER API") | |
| print("=" * 60) | |
| # Scan erstellen (autonom) | |
| r = requests.post( | |
| f"{BASE}/api/v1/scans", | |
| headers=headers, | |
| json={ | |
| "target": "scanme.nmap.org", | |
| "scan_type": "full", | |
| "modules": ["recon", "vuln_scan"], | |
| }, | |
| timeout=60, | |
| ) | |
| scan = r.json() | |
| print("\nScan erstellt:") | |
| print(f" ID: {scan['id']}") | |
| print(f" Status: {scan['status']}") | |
| print(f" Target: {scan['target']}") | |
| print(f" Type: {scan['scan_type']}") | |
| # Auf Ergebnisse warten | |
| print("\nWarte auf Scan...") | |
| for i in range(5): | |
| 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 | |
| # Ergebnisse holen | |
| results = requests.get(f"{BASE}/api/v1/scans/{scan['id']}/results", headers=headers, timeout=30).json() | |
| print("\nErgebnisse:") | |
| print(f" Findings: {len(results.get('findings', []))}") | |
| print("\n" + "=" * 60) | |
| print("AUTONOMER SCAN COMPLETE") | |
| print("=" * 60) | |
Xet Storage Details
- Size:
- 1.69 kB
- Xet hash:
- 83b96503d8c5890ae45d9df556a00775a5227ecd0f60365cd7415ff685cd2d92
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.