@echo off chcp 65001 >nul echo. echo ========================================= echo DR Network - DR Wi-Fi Analyzer Agente echo ========================================= echo. REM Verifica Python python --version >nul 2>&1 if errorlevel 1 goto try_python3 set PYTHON=python goto check_python_ok :try_python3 python3 --version >nul 2>&1 if errorlevel 1 goto no_python set PYTHON=python3 goto check_python_ok :no_python echo [ERRO] Python nao encontrado. echo Baixe em: https://www.python.org/downloads/ echo Marque "Add Python to PATH" na instalacao. pause exit /b 1 :check_python_ok for /f "tokens=2" %%v in ('%PYTHON% --version 2^>^&1') do set PYVER=%%v echo [OK] Python %PYVER% REM ── Dependencias de diagnostico (idempotente + nao-fatal) ── REM Instala nmap, speedtest e iperf3. Instala so o que faltar; se algo REM falhar, o instalador segue (diagnostico degrada sem quebrar). set DIR=%~dp0 echo. echo Verificando dependencias de diagnostico (nmap, speedtest, iperf3)... REM mtr: no Windows usa-se 'tracert' nativo (sem instalar) echo [OK] mtr: usa tracert nativo do Windows REM winget disponivel? (nativo no Win10/11) winget --version >nul 2>&1 if errorlevel 1 ( echo [OPC] winget nao encontrado - instale manualmente: echo nmap: https://nmap.org/download.html echo speedtest: https://www.speedtest.net/apps/cli goto deps_iperf ) where nmap >nul 2>&1 if errorlevel 1 ( echo Instalando nmap... winget install -e --id Insecure.Nmap --accept-source-agreements --accept-package-agreements >nul 2>&1 && echo [OK] nmap instalado || echo [OPC] nmap falhou - seguindo ) else ( echo [OK] nmap disponivel ) where speedtest >nul 2>&1 if errorlevel 1 ( echo Instalando speedtest ^(Ookla^)... winget install -e --id Ookla.Speedtest.CLI --accept-source-agreements --accept-package-agreements >nul 2>&1 && echo [OK] speedtest instalado || echo [OPC] speedtest falhou - seguindo ) else ( echo [OK] speedtest disponivel ) :deps_iperf REM iperf3: sem pacote winget oficial - baixa o zip de iperf.fr p/ a pasta do agente where iperf3 >nul 2>&1 if not errorlevel 1 ( echo [OK] iperf3 disponivel goto deps_done ) if exist "%DIR%iperf3.exe" ( echo [OK] iperf3 disponivel ^(pasta do agente^) goto deps_done ) echo Baixando iperf3 ^(iperf.fr^)... set "IPERF_URL=https://iperf.fr/download/windows/iperf-3.17.1_64.zip" powershell -NoProfile -Command "try { Invoke-WebRequest -Uri '%IPERF_URL%' -OutFile '%DIR%iperf3.zip' -UseBasicParsing; Expand-Archive -Path '%DIR%iperf3.zip' -DestinationPath '%DIR%iperf3_tmp' -Force; Get-ChildItem -Recurse '%DIR%iperf3_tmp' -Include iperf3.exe,*.dll | ForEach-Object { Copy-Item $_.FullName -Destination '%DIR%' -Force }; Remove-Item '%DIR%iperf3.zip','%DIR%iperf3_tmp' -Recurse -Force; Write-Host '[OK] iperf3 baixado' } catch { Write-Host '[OPC] download iperf3 falhou - baixe manual em https://iperf.fr/iperf-download.php' }" :deps_done REM Cria run_agent.bat na mesma pasta set DIR=%~dp0 ( echo @echo off echo cd /d "%DIR%" echo %PYTHON% "%DIR%drwifi_agent.py" %%* ) > "%DIR%run_agent.bat" echo [OK] run_agent.bat criado echo. echo ========================================= echo Instalacao concluida! echo. echo 1. Painel -- Agentes -- Novo agente -- copie o codigo echo. echo 2. Registrar (1a vez): echo %PYTHON% drwifi_agent.py --server http://SEU_SERVIDOR --enroll-code XXXX echo. echo 3. Rodar continuamente: echo %PYTHON% drwifi_agent.py --server http://SEU_SERVIDOR echo (ou: run_agent.bat --server http://SEU_SERVIDOR) echo ========================================= echo. pause