import requests
import time
API_KEY = "nr_live_xxxxxxxxxxxx"
BASE = "https://api.netreconapp.com/api/v1"
headers = {"X-API-Key": API_KEY}
scan = requests.post(f"{BASE}/scans/start", headers=headers, json={
"target": "192.168.1.0/24",
"profile": "normal"
}).json()
print(f"Scan started: {scan['id']}")
while True:
status = requests.get(f"{BASE}/scans/{scan['id']}", headers=headers).json()
print(f"Progress: {status['progress_percent']}%")
if status["status"] in ("completed", "failed"):
break
time.sleep(10)
result = requests.get(f"{BASE}/scans/{scan['id']}/result", headers=headers).json()
print(f"Devices found: {result['devices_found']}")