# ntcp installer for Windows (PowerShell). # # Usage (Run as Administrator): # irm 3kr.org/install.ps1 | iex # # Direct (raw GitHub): # irm https://raw.githubusercontent.com/muslu/nettransfer/main/install.ps1 | iex # # Override the binary URL via: # $env:NTCP_BIN_URL = "https://example.com/ntcp-windows-amd64.exe" # irm 3kr.org/install.ps1 | iex $ErrorActionPreference = "Stop" function Step($msg) { Write-Host " -> $msg" -ForegroundColor Cyan } function Ok($msg) { Write-Host " $([char]0x2713) $msg" -ForegroundColor Green } function Warn($msg) { Write-Host " ! $msg" -ForegroundColor Yellow } function Fail($msg) { Write-Host " X $msg" -ForegroundColor Red; exit 1 } $banner = @" ### ## ######## ###### ###### #### # ## ## ## ## ## ## ## ### ## ## ###### ## #### ## ## ## ## ### ## ###### ## "@ Write-Host $banner -ForegroundColor Cyan Write-Host " secure resumable file transfer`n" -ForegroundColor DarkGray if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Fail "ntcp installer must run as Administrator." } # Detect arch $arch = if ([Environment]::Is64BitOperatingSystem) { if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "amd64" } } else { "386" } # GitHub Releases host the per-platform binaries. CI publishes them on every # `v*` tag. The `latest/download/` path always resolves to the most recent. $baseUrl = if ($env:NTCP_BASE_URL) { $env:NTCP_BASE_URL } else { "https://github.com/muslu/nettransfer/releases/latest/download" } $binUrl = if ($env:NTCP_BIN_URL) { $env:NTCP_BIN_URL } else { "$baseUrl/ntcp-windows-$arch.exe" } $installDir = "$env:ProgramFiles\ntcp" $dest = Join-Path $installDir "ntcp.exe" New-Item -ItemType Directory -Force -Path $installDir | Out-Null Step "detected windows/$arch" Step "downloading $binUrl" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $ProgressPreference = 'Continue' Invoke-WebRequest -Uri $binUrl -OutFile $dest -UseBasicParsing Ok "installed binary at $dest" Step "registering service and generating first token" & $dest install Write-Host "" Write-Host " +-- Token modu secimi" -ForegroundColor Cyan Write-Host " | " -ForegroundColor Cyan -NoNewline Write-Host "ntcp init" -ForegroundColor Green Write-Host " | " -ForegroundColor Cyan -NoNewline; Write-Host "[1] " -ForegroundColor White -NoNewline; Write-Host "Kalici - token suresiz gecerli" Write-Host " | " -ForegroundColor Cyan -NoNewline; Write-Host "[2] " -ForegroundColor White -NoNewline; Write-Host "Sureli - TTL ile otomatik gecersiz (1h, 24h, 7d)" Write-Host " | " -ForegroundColor Cyan Write-Host " | " -ForegroundColor Cyan -NoNewline; Write-Host "not: " -ForegroundColor DarkGray -NoNewline; Write-Host "atlanirsa kurulumdaki token kalici olarak saklanir." Write-Host " +--" -ForegroundColor Cyan Write-Host "" Write-Host " i " -ForegroundColor Blue -NoNewline Write-Host "Daha fazla bilgi: " -NoNewline Write-Host "https://github.com/muslu/nettransfer" -ForegroundColor DarkGray Write-Host ""