if ($ExecutionContext.SessionState.LanguageMode.value__ -ne 0) { $ExecutionContext.SessionState.LanguageMode Write-Host "Windows PowerShell is not running in Full Language Mode." return } function Check3rdAV { $avList = Get-CimInstance -Namespace root\SecurityCenter2 -Class AntiVirusProduct | Where-Object { $_.displayName -notlike '*windows*' } | Select-Object -ExpandProperty displayName if ($avList) { Write-Host '3rd party Antivirus might be blocking the script - ' -ForegroundColor White -BackgroundColor Blue -NoNewline Write-Host " $($avList -join ', ')" -ForegroundColor DarkRed -BackgroundColor White } } function CheckFile { param ([string]$FilePath) if (-not (Test-Path $FilePath)) { Check3rdAV Write-Host "Failed to create file in temp folder, aborting!" throw } } [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # Menu Clear-Host Write-Host "===== Menu =====" -ForegroundColor Cyan Write-Host "1 - MAS_AIO" Write-Host "2 - Office" Write-Host "3 - Windows" Write-Host "================" -ForegroundColor Cyan $choice = Read-Host "Enter choice" switch ($choice) { '1' { $SelectedURL = 'https://tech.navazi.net/MAS_AIO.cmd' } '2' { $SelectedURL = 'https://tech.navazi.net/OFFICE.cmd' } '3' { $SelectedURL = 'https://tech.navazi.net/WINDOWS.cmd' } default { Write-Host "Invalid choice" -ForegroundColor Red; return } } # Download as raw bytes try { $response = Invoke-WebRequest -Uri $SelectedURL -UseBasicParsing $stream = $response.RawContentStream } catch { Check3rdAV Write-Host "Failed to retrieve file from $SelectedURL, aborting!" return } # Check for AutoRun registry $paths = "HKCU:\SOFTWARE\Microsoft\Command Processor", "HKLM:\SOFTWARE\Microsoft\Command Processor" foreach ($path in $paths) { if (Get-ItemProperty -Path $path -Name "Autorun" -ErrorAction SilentlyContinue) { Write-Warning "Autorun registry found, CMD may crash! `nManually run:`nRemove-ItemProperty -Path '$path' -Name 'Autorun'" } } # Save file $rand = [Guid]::NewGuid().Guid $isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544') $FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\SCRIPTRUN_$rand.cmd" } else { "$env:USERPROFILE\AppData\Local\Temp\SCRIPTRUN_$rand.cmd" } $fs = [System.IO.File]::Open($FilePath, 'Create', 'Write') $stream.CopyTo($fs) $fs.Close() CheckFile $FilePath # Run $env:ComSpec = "$env:SystemRoot\system32\cmd.exe" Start-Process -FilePath $env:ComSpec -ArgumentList "/c """"$FilePath"" $args""" -Wait CheckFile $FilePath # Cleanup $FilePaths = @( "$env:SystemRoot\Temp\SCRIPTRUN*.cmd", "$env:USERPROFILE\AppData\Local\Temp\SCRIPTRUN*.cmd" ) foreach ($FilePath in $FilePaths) { Get-Item $FilePath -ErrorAction SilentlyContinue | Remove-Item -ErrorAction SilentlyContinue }