@echo off setlocal EnableExtensions EnableDelayedExpansion set _token=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx set _crpt_host=https://cdn.crpt.ru REM set _crpt_host=https://markirovka.sandbox.crptech.ru set _this_script_dir=%~dp0 set _curl="%_this_script_dir%curl.exe" set _jq="%_this_script_dir%jq.exe" set _ca_certfile="%_this_script_dir%cacert.pem" REM set _tls_security=--insecure set _tls_security=--cacert %_ca_certfile% set _silent=--silent REM set _silent= set _write-out1= set _write-out1=--write-out ^"^ crpt host: %%{urle.host}\n^ crpt host ip: %%{remote_ip}\n^ exit code: %%{exitcode}\n^ error msg: [%%{errormsg}]\n^ ssl verify result: %%{ssl_verify_result}\n^ http code: %%{http_code}\n^ time: %%{time_total} sec\n^ speed: %%{speed_download} byte/sec\n^ " set _write-out2= set _write-out2=--write-out ^"\n\n^ crpt host: %%{urle.host}\n^ crpt host ip: %%{remote_ip}\n^ exit code: %%{exitcode}\n^ error msg: [%%{errormsg}]\n^ ssl verify result: %%{ssl_verify_result}\n^ http code: %%{http_code}\n^ time: %%{time_total} sec\n^ speed: %%{speed_download} byte/sec\n^ " echo *** Запрос списка CDN-площадок echo. set _temp_dir=%TEMP%\%RANDOM%%RANDOM%%RANDOM%%RANDOM%%RANDOM%\ md "%_temp_dir%" set _crpt-output_file="%_temp_dir%crpt-output" set _crpt-header_file="%_temp_dir%crpt-header" set _crpt-hosts_file="%_temp_dir%crpt-hosts" del /f /q %_crpt-output_file% > nul 2>&1 %_curl% -X GET "%_crpt_host%/api/v4/true-api/cdn/info" -H "Content-Type: application/json" -H "X-API-KEY: %_token%" %_tls_security% %_silent% --dump-header %_crpt-header_file% --output %_crpt-output_file% %_write-out1% if exist %_crpt-output_file% ( echo. echo Результат запроса: %_jq% ".code?" !_crpt-output_file! echo. echo Описание результата запроса: %_jq% ".description?" !_crpt-output_file! echo. echo Список CDN-площадок: %_jq% ".hosts[]? | .host?" !_crpt-output_file! > !_crpt-hosts_file! %_jq% ".hosts[]? | .host?" !_crpt-output_file! for /f %%i in (!_crpt-hosts_file!) do set _file_size=%%~zi if !_file_size! gtr 0 ( for /f "usebackq tokens=*" %%i in (!_crpt-hosts_file!) do ( set _cdn=%%~i echo. echo. echo. echo. echo. echo Получение состояния CDN-площадки "!_cdn!" echo. %_curl% -X GET "!_cdn!/api/v4/true-api/cdn/health/check" -H "Content-Type: application/json" -H "X-API-KEY: %_token%" %_tls_security% %_write-out2% ) ) ) rd /s /q "%_temp_dir%" echo. & echo. & echo. & echo. & echo. & pause & exit /b 0