宇恒一号官网

This commit is contained in:
whm
2026-03-17 00:59:32 +08:00
commit eb56519df7
105 changed files with 10783 additions and 0 deletions

11
scripts/kill-ports.ps1 Normal file
View File

@@ -0,0 +1,11 @@
# Kill processes on ports 8080/3000/3001
$ports = @(8080, 3000, 3001)
foreach ($p in $ports) {
$conn = Get-NetTCPConnection -LocalPort $p -ErrorAction SilentlyContinue
if ($conn) {
$conn | ForEach-Object {
Stop-Process -Id $_.OwningProcess -Force -ErrorAction SilentlyContinue
}
Write-Host "Port $p released"
}
}

30
scripts/ssh-tunnel.ps1 Normal file
View File

@@ -0,0 +1,30 @@
# SSH 隧道 - 使用 Posh-SSH 自动输入密码
# 首次运行需安装: Install-Module Posh-SSH -Scope CurrentUser
$hostName = "www.yuxindazhineng.com"
$port = 2223
$user = "yxd"
$password = "yuxindazn001"
$localPort = 27017
$remotePort = 27017
if (-not (Get-Module -ListAvailable -Name Posh-SSH)) {
Write-Host "正在安装 Posh-SSH 模块(仅需一次)..."
Install-Module Posh-SSH -Scope CurrentUser -Force
}
$secPass = ConvertTo-SecureString $password -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($user, $secPass)
Write-Host "正在建立 SSH 隧道..."
$session = New-SSHSession -ComputerName $hostName -Port $port -Credential $cred -AcceptKey -Force
if (-not $session) {
Write-Host "SSH 连接失败"
pause
exit 1
}
$forward = New-SSHLocalPortForward -Index 0 -LocalAddress 127.0.0.1 -LocalPort $localPort -RemoteAddress localhost -RemotePort $remotePort
Write-Host "SSH 隧道已建立 (localhost:$localPort -> 远程:$remotePort)"
Write-Host "保持此窗口打开,关闭即断开"
pause