Remove claw push and payloads directory with related docs
This commit is contained in:
@@ -15,7 +15,6 @@ Commands:
|
||||
list List all hosts
|
||||
ssh <host> SSH into a host
|
||||
run <host> <script> Run a script on a host (from scripts\)
|
||||
push <host> <file/dir> Push file/dir to host (from payloads\)
|
||||
key add <name> <pem> Register a PEM key into keys\
|
||||
key list List all registered keys
|
||||
|
||||
@@ -23,7 +22,6 @@ Examples:
|
||||
claw list
|
||||
claw ssh my-server
|
||||
claw run my-server hello.sh
|
||||
claw push my-server my-app
|
||||
claw key add my-server C:\Users\me\Downloads\key.pem
|
||||
"@
|
||||
}
|
||||
@@ -66,7 +64,6 @@ function Parse-Yaml($Path) {
|
||||
function Load-Host($Name) {
|
||||
$HostFile = Join-Path $ClawRoot "hosts\$Name.yml"
|
||||
if (-not (Test-Path $HostFile)) {
|
||||
# fallback: try without .yml extension (old format)
|
||||
$HostFile = Join-Path $ClawRoot "hosts\$Name"
|
||||
if (-not (Test-Path $HostFile)) {
|
||||
Write-Host "ERROR: host '$Name' not found (hosts\$Name.yml)" -ForegroundColor Red
|
||||
@@ -99,7 +96,6 @@ function Load-Host($Name) {
|
||||
Write-Host "ERROR: key file not found: $HostKey" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
# Fix Windows permissions (SSH requires key NOT readable by other users)
|
||||
icacls $HostKey /inheritance:r /grant "${env:USERNAME}:(R)" 2>$null | Out-Null
|
||||
}
|
||||
}
|
||||
@@ -167,29 +163,6 @@ function Invoke-Run($Name, $Script) {
|
||||
(Get-Content $sp -Raw) | & ssh @sa "$HostUser@$HostIP" "tr -d '\r' | bash -s"
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# Push files to host
|
||||
# ============================================================
|
||||
function Invoke-Push($Name, $Target) {
|
||||
Load-Host $Name
|
||||
$src = Join-Path $ClawRoot "payloads\$Target"
|
||||
if (-not (Test-Path $src)) {
|
||||
Write-Host "ERROR: '$Target' not found (payloads\$Target)" -ForegroundColor Red
|
||||
Write-Host "Available payloads:" -ForegroundColor Yellow
|
||||
Get-ChildItem (Join-Path $ClawRoot "payloads") | ForEach-Object { Write-Host " $($_.Name)" }
|
||||
exit 1
|
||||
}
|
||||
|
||||
$sca = @("-o", "StrictHostKeyChecking=accept-new")
|
||||
if ($HostPort) { $sca += "-P"; $sca += $HostPort }
|
||||
if ($HostKey) { $sca += "-i"; $sca += $HostKey }
|
||||
if (Test-Path $src -PathType Container) { $sca += "-r" }
|
||||
|
||||
Write-Host ">>> Pushing $Target -> $Name`:$HostUser@$HostIP`:/tmp/" -ForegroundColor Green
|
||||
& scp @sca $src "$HostUser@$HostIP`:/tmp/"
|
||||
Write-Host ">>> Done. Files at /tmp/$Target" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# Key management
|
||||
# ============================================================
|
||||
@@ -234,7 +207,6 @@ switch ($Command) {
|
||||
"list" { Write-Host "Hosts:" -ForegroundColor Yellow; List-Hosts }
|
||||
"ssh" { Invoke-Ssh $Arg1 }
|
||||
"run" { Invoke-Run $Arg1 $Arg2 }
|
||||
"push" { Invoke-Push $Arg1 $Arg2 }
|
||||
"key" { Invoke-Key $Arg1 $Arg2 $Arg3 }
|
||||
{ $_ -in @("-h", "--help", "help", "", $null) } { Usage }
|
||||
default { Write-Host "Unknown command: $Command" -ForegroundColor Red; Usage; exit 1 }
|
||||
|
||||
Reference in New Issue
Block a user