Загрузка данных


$path = "C:\Users\vbelopukhov\Downloads\resp.bin"

try {
    $bytes = [System.IO.File]::ReadAllBytes($path)
    Write-Host "Успешно прочитано байт: $($bytes.Length)" -ForegroundColor Green
} catch {
    Write-Host "ОШИБКА при чтении файла:" -ForegroundColor Red
    Write-Host $_.Exception.Message -ForegroundColor Red
    return
}

$text = [System.Text.Encoding]::Latin1.GetString($bytes)

foreach ($pattern in @("<%@", "Stack trace:", ".getFile")) {
    $idx = $text.IndexOf($pattern)
    if ($idx -ge 0) {
        Write-Host "Найдено '$pattern' на offset $idx" -ForegroundColor Green
        $start = [Math]::Max(0, $idx - 100)
        $len = [Math]::Min(300, $text.Length - $start)
        Write-Host "--- Контекст ---"
        Write-Host $text.Substring($start, $len)
        Write-Host "----------------"
    } else {
        Write-Host "'$pattern' НЕ найдено" -ForegroundColor Yellow
    }
}