# ============================================================ # NxusLab Tech Toolkit - Bootstrapper # Uso curto: irm https://toolkit.nxuslab.com | iex # Observacao: baixa, valida SHA256 e executa o modulo principal. # ============================================================ $ErrorActionPreference = "Stop" $BaseUrl = "https://toolkit.nxuslab.com" $PayloadUrl = "$BaseUrl/payload/nxuslab-diagnostico.ps1" $HashUrl = "$BaseUrl/payload/nxuslab-diagnostico.sha256" $VersionUrl = "$BaseUrl/version.txt" function Write-NxusHeader { Clear-Host Write-Host "=========================================================================================" -ForegroundColor Cyan Write-Host "" Write-Host " N X U S L A B T E C H T O O L K I T" -ForegroundColor Cyan Write-Host " Inicializador seguro" -ForegroundColor White Write-Host "" Write-Host "=========================================================================================" -ForegroundColor Cyan Write-Host "" } function Test-PowerShellEnvironment { $major = $PSVersionTable.PSVersion.Major if ($major -lt 5) { throw "PowerShell antigo detectado. Versao minima recomendada: 5.1." } if ($ExecutionContext.SessionState.LanguageMode -ne "FullLanguage") { throw "PowerShell nao esta em FullLanguage Mode. A execucao foi bloqueada por politica do ambiente." } try { [void][System.Math]::Sqrt(144) } catch { throw "Falha ao usar recursos .NET necessarios para executar o toolkit." } } function Get-RemoteText { param([string]$Uri) return (Invoke-RestMethod -Uri $Uri -UseBasicParsing).ToString().Trim() } Write-NxusHeader Write-Host "Iniciando NxusLab Tech Toolkit..." -ForegroundColor Yellow Write-Host "" try { Test-PowerShellEnvironment try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch {} $versao = "N/D" try { $versao = Get-RemoteText -Uri $VersionUrl } catch {} $tempDir = Join-Path $env:TEMP "NxusLabToolkit" if (-not (Test-Path $tempDir)) { New-Item -Path $tempDir -ItemType Directory -Force | Out-Null } $payloadFile = Join-Path $tempDir "nxuslab-diagnostico.ps1" Write-Host "Versao disponivel: $versao" -ForegroundColor DarkGray Write-Host "Baixando modulo principal..." -ForegroundColor Yellow Invoke-WebRequest -Uri $PayloadUrl -OutFile $payloadFile -UseBasicParsing Write-Host "Validando integridade SHA256..." -ForegroundColor Yellow $expectedHash = (Get-RemoteText -Uri $HashUrl).ToUpper() $currentHash = (Get-FileHash -Path $payloadFile -Algorithm SHA256).Hash.ToUpper() if ($expectedHash -ne $currentHash) { Write-Host "" Write-Host "ERRO: o arquivo baixado nao bate com o hash publicado." -ForegroundColor Red Write-Host "Esperado: $expectedHash" -ForegroundColor Yellow Write-Host "Atual: $currentHash" -ForegroundColor Yellow Write-Host "" throw "Validacao de integridade falhou. Execucao cancelada." } Write-Host "Integridade confirmada." -ForegroundColor Green Start-Sleep -Milliseconds 700 powershell.exe -NoProfile -ExecutionPolicy Bypass -File $payloadFile } catch { Write-Host "" Write-Host "Falha ao iniciar o NxusLab Tech Toolkit." -ForegroundColor Red Write-Host $_.Exception.Message -ForegroundColor Yellow Write-Host "" Read-Host "Pressione ENTER para sair" | Out-Null }