# ZeroBanana license tool - installer for Windows # # irm https://zerobanana.store/loader | iex # # Read first, then run: irm https://zerobanana.store/loader # # What this script does (and nothing else): # 1. downloads ZeroBanana-Lizenz.exe and SHA256SUMS from zerobanana.store # 2. verifies the SHA-256 checksum (aborts on mismatch) # 3. checks the Authenticode signature (aborts on an invalid signature) # 4. copies the tool to %LOCALAPPDATA%\ZeroBanana (no admin rights) # 5. adds a Start menu shortcut and starts the tool # It does not change any security settings (Defender, SmartScreen, execution policy). # # Uninstall: delete the folder %LOCALAPPDATA%\ZeroBanana and the Start menu shortcut # "ZeroBanana License". # # Server: zerobanana.store & { $ErrorActionPreference = 'Stop' Set-StrictMode -Version 2.0 $ProgressPreference = 'SilentlyContinue' # speeds up Invoke-WebRequest in PowerShell 5.1 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # Only allow our own hosts (prod / test). $allowed = @('zerobanana.store', 'www.zerobanana.store', 'test.zerobanana.store') $hostName = 'zerobanana.store' if ($allowed -notcontains $hostName) { $hostName = 'zerobanana.store' } $base = "https://$hostName/download" $isTest = $hostName -like 'test.*' $file = 'ZeroBanana-Lizenz.exe' $appName = if ($isTest) { 'ZeroBanana License (TEST)' } else { 'ZeroBanana License' } $installDir = Join-Path $env:LOCALAPPDATA ($(if ($isTest) { 'ZeroBanana-Test' } else { 'ZeroBanana' })) $target = Join-Path $installDir $file function Say([string]$msg, [string]$color = 'Gray') { Write-Host " $msg" -ForegroundColor $color } Write-Host '' Write-Host " $appName - setup" -ForegroundColor Yellow if ($isTest) { Say 'TEST ENVIRONMENT (test.zerobanana.store)' 'Red' } Write-Host '' if (-not [Environment]::Is64BitOperatingSystem) { throw 'Requires 64-bit Windows (Windows 10/11).' } $tmp = Join-Path ([IO.Path]::GetTempPath()) ("zerobanana-" + [Guid]::NewGuid().ToString('N')) New-Item -ItemType Directory -Path $tmp | Out-Null try { Say "Downloading $file ..." $dl = Join-Path $tmp $file Invoke-WebRequest -UseBasicParsing -Uri "$base/$file" -OutFile $dl $sums = (Invoke-WebRequest -UseBasicParsing -Uri "$base/SHA256SUMS").Content if ($sums -is [byte[]]) { $sums = [Text.Encoding]::UTF8.GetString($sums) } $line = ($sums -split "`n") | Where-Object { $_.Trim().EndsWith($file) } | Select-Object -First 1 if (-not $line) { throw 'No checksum found for the tool - aborting.' } $expected = ($line.Trim() -split '\s+')[0].ToLowerInvariant() $actual = (Get-FileHash -Path $dl -Algorithm SHA256).Hash.ToLowerInvariant() if ($expected -ne $actual) { throw "Checksum mismatch (expected $expected, got $actual) - aborting." } Say "SHA-256 ok: $actual" 'Green' $sig = Get-AuthenticodeSignature -FilePath $dl switch ($sig.Status) { 'Valid' { Say ("Signature ok: " + $sig.SignerCertificate.Subject) 'Green' } 'NotSigned' { Say 'Note: the tool is not digitally signed (yet). Windows SmartScreen may warn on first start.' 'Yellow' } default { throw "Invalid signature ($($sig.Status)) - aborting." } } # Stop a running instance so the file can be replaced (only our own path). Get-Process -ErrorAction SilentlyContinue | Where-Object { $_.Path -and ($_.Path -ieq $target) } | ForEach-Object { Say 'Stopping running license tool ...'; $_ | Stop-Process -Force; Start-Sleep -Milliseconds 500 } New-Item -ItemType Directory -Path $installDir -Force | Out-Null Copy-Item -Path $dl -Destination $target -Force Say "Installed to $target" 'Green' $programs = [Environment]::GetFolderPath('Programs') if ($programs) { # Shortcut from older installers (German name) - replaced by the English one. $oldName = if ($isTest) { 'ZeroBanana Lizenz (TEST)' } else { 'ZeroBanana Lizenz' } Remove-Item -LiteralPath (Join-Path $programs "$oldName.lnk") -Force -ErrorAction SilentlyContinue $startMenu = Join-Path $programs "$appName.lnk" $shell = New-Object -ComObject WScript.Shell $lnk = $shell.CreateShortcut($startMenu) $lnk.TargetPath = $target $lnk.WorkingDirectory = $installDir $lnk.Description = $appName $lnk.Save() Say 'Start menu entry created.' 'Green' } else { Say "No Start menu folder found - shortcut skipped. Start: $target" 'Yellow' } } finally { Remove-Item -Path $tmp -Recurse -Force -ErrorAction SilentlyContinue } Write-Host '' Say "Starting $appName ..." 'Yellow' Start-Process -FilePath $target -WorkingDirectory $installDir Say 'Done. Create an account in the tool (any email address) and redeem your voucher key.' 'Green' Write-Host '' }