21 lines
912 B
PowerShell
21 lines
912 B
PowerShell
$ErrorActionPreference = "Stop"
|
|
$projectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
Set-Location -LiteralPath $projectRoot
|
|
|
|
$existingListener = Get-NetTCPConnection -LocalPort 5760 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
|
if ($existingListener) {
|
|
$existingProcess = Get-CimInstance Win32_Process -Filter "ProcessId=$($existingListener.OwningProcess)" -ErrorAction SilentlyContinue
|
|
Write-Host ""
|
|
Write-Host "The simulator is already LISTENING on tcp:127.0.0.1:5760." -ForegroundColor Green
|
|
Write-Host "Process: $($existingListener.OwningProcess) $($existingProcess.Name)"
|
|
Write-Host "Leave that simulator running and select 'Simulator (TCP 5760)' in SUB Control."
|
|
Write-Host ""
|
|
exit 0
|
|
}
|
|
|
|
if (Test-Path -LiteralPath ".venv\Scripts\python.exe") {
|
|
& .venv\Scripts\python.exe -u fc_spoofer.py @args
|
|
} else {
|
|
& python -u fc_spoofer.py @args
|
|
}
|