gongxiangp2/scripts/check-frp-servers.ps1

95 lines
4.0 KiB
PowerShell

# Check FRP server tunnel service status
# Check for binary files or systemd services
$frpServer1 = "180.97.221.140" # FRP Server 1 (for s3.1080p.hk)
$frpServer2 = "103.118.245.6" # FRP Server 2 (for s3.yydd.ai)
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Check FRP Server Tunnel Service Status" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Check Server 1: 180.97.221.140
Write-Host "Server 1: $frpServer1 (for s3.1080p.hk)" -ForegroundColor Yellow
Write-Host ""
# Check FRP service port
Write-Host "1. Check FRP control port (7001)..." -ForegroundColor Cyan
$port7001 = Test-NetConnection -ComputerName $frpServer1 -Port 7001 -WarningAction SilentlyContinue
if ($port7001.TcpTestSucceeded) {
Write-Host " [OK] Port 7001 is accessible" -ForegroundColor Green
} else {
Write-Host " [FAIL] Port 7001 not accessible (firewall or service not running)" -ForegroundColor Red
}
# Check HTTP/HTTPS ports
Write-Host "2. Check HTTP port (80)..." -ForegroundColor Cyan
$port80 = Test-NetConnection -ComputerName $frpServer1 -Port 80 -WarningAction SilentlyContinue
if ($port80.TcpTestSucceeded) {
Write-Host " [OK] Port 80 is accessible" -ForegroundColor Green
} else {
Write-Host " [WARN] Port 80 not accessible" -ForegroundColor Yellow
}
Write-Host "3. Check HTTPS port (443)..." -ForegroundColor Cyan
$port443 = Test-NetConnection -ComputerName $frpServer1 -Port 443 -WarningAction SilentlyContinue
if ($port443.TcpTestSucceeded) {
Write-Host " [OK] Port 443 is accessible" -ForegroundColor Green
} else {
Write-Host " [WARN] Port 443 not accessible" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Check Server 2: 103.118.245.6
Write-Host "Server 2: $frpServer2 (for s3.yydd.ai)" -ForegroundColor Yellow
Write-Host ""
# Check HTTPS port
Write-Host "1. Check HTTPS port (443)..." -ForegroundColor Cyan
$port443_2 = Test-NetConnection -ComputerName $frpServer2 -Port 443 -WarningAction SilentlyContinue
if ($port443_2.TcpTestSucceeded) {
Write-Host " [OK] Port 443 is accessible" -ForegroundColor Green
# Test FRP identifier
Write-Host "2. Check FRP service identifier..." -ForegroundColor Cyan
try {
$response = Invoke-WebRequest -Uri "https://$frpServer2/" -SkipCertificateCheck -TimeoutSec 5 -ErrorAction Stop
if ($response.Content -match "frp") {
Write-Host " [OK] Confirmed FRP service" -ForegroundColor Green
$contentPreview = $response.Content.Substring(0, [Math]::Min(200, $response.Content.Length))
Write-Host " Response preview: $contentPreview" -ForegroundColor Gray
}
} catch {
Write-Host " [WARN] Cannot get response: $($_.Exception.Message)" -ForegroundColor Yellow
}
} else {
Write-Host " [FAIL] Port 443 not accessible" -ForegroundColor Red
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Note: To check FRP service configuration on servers (systemd services, binary files, etc.)," -ForegroundColor Yellow
Write-Host " SSH to the servers and run:" -ForegroundColor Yellow
Write-Host ""
Write-Host " # Check systemd services" -ForegroundColor Cyan
Write-Host " systemctl status frps" -ForegroundColor White
Write-Host " systemctl status frpc" -ForegroundColor White
Write-Host ""
Write-Host " # Check processes" -ForegroundColor Cyan
Write-Host " ps aux | grep frp" -ForegroundColor White
Write-Host ""
Write-Host " # Check binary file locations" -ForegroundColor Cyan
Write-Host " which frps" -ForegroundColor White
Write-Host " which frpc" -ForegroundColor White
Write-Host " find /usr/local/bin /opt /root -name '*frp*' -type f 2>/dev/null" -ForegroundColor White
Write-Host ""
Write-Host " # Check config files" -ForegroundColor Cyan
Write-Host " find /etc /root -name '*frp*.toml' -o -name '*frp*.ini' 2>/dev/null" -ForegroundColor White
Write-Host ""