$path = "$env:LOCALAPPDATA\NektoMeme\audio-bridge-app.exe"
# Читаем файл в ISO-8859-1 (1 байт = 1 символ, без потерь данных)
$bytes = [System.IO.File]::ReadAllBytes($path)
$text = [System.Text.Encoding]::GetEncoding("ISO-8859-1").GetString($bytes)
# Поиск: от первого упоминания var app / const app / function до конца JS фрагмента
# Если тегов script/html нет, ищем до первого бинарного разделителя или NUL-байта
$pattern = '(?s)(var\s+app\b|const\s+app\b|\(function\(\)\{).+'
if ($text -match '(?s)(var\s+app[\s\S]*?)(?=\x00{2,}|</script>|</html>|$)') {
$foundText = $matches[1]
# Конвертируем обратно в честный UTF-8
$foundBytes = [System.Text.Encoding]::GetEncoding("ISO-8859-1").GetBytes($foundText)
$utf8Text = [System.Text.Encoding]::UTF8.GetString($foundBytes)
$utf8Text | Out-File -FilePath "$env:USERPROFILE\Desktop\app.js" -Encoding utf8
Write-Host "✔ JS успешно найден и сохранен на Рабочий стол!" -ForegroundColor Green
} else {
Write-Host "✘ Все еще не найден. Переходим к дампу строк." -ForegroundColor Red
}