26 lines
767 B
PowerShell
26 lines
767 B
PowerShell
$password = "peATjCBUn2Js"
|
||
$command = "ls -lh /app/uploads/"
|
||
|
||
# 使用plink (PuTTY的命令行版本)
|
||
# 如果没有plink,使用expect脚本
|
||
$expectScript = @"
|
||
spawn ssh -o StrictHostKeyChecking=no root@103.118.245.6 $command
|
||
expect "password:"
|
||
send "$password\r"
|
||
expect eof
|
||
"@
|
||
|
||
# 保存到临时文件
|
||
$tempExpect = Join-Path $env:TEMP "ssh-external.exp"
|
||
$expectScript | Out-File -FilePath $tempExpect -Encoding ASCII
|
||
|
||
# 通过WSL或Git Bash执行
|
||
if (Get-Command wsl -ErrorAction SilentlyContinue) {
|
||
$tempExpectWSL = $tempExpect -replace '\\', '/' -replace 'C:', '/mnt/c'
|
||
wsl expect $tempExpectWSL
|
||
} else {
|
||
Write-Host "请手动SSH到 103.118.245.6 并检查 /app/uploads/ 目录"
|
||
Write-Host "用户名: root"
|
||
Write-Host "密码: $password"
|
||
}
|