Add remote agent distribution: install scripts + binaries
- agent.ps1: Windows one-line install script (irm u-claw.org/agent.ps1 | iex) - agent.sh: macOS/Linux install script (curl -fsSL u-claw.org/agent.sh | bash) - downloads/: agent binaries for Windows, macOS, Linux - vercel.json: add Content-Type headers for binary downloads
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,6 +16,7 @@ social-assets/
|
||||
.download-cache/
|
||||
*.dmg
|
||||
*.exe
|
||||
!website/downloads/agent.exe
|
||||
*.blockmap
|
||||
builder-debug.yml
|
||||
|
||||
|
||||
25
vercel.json
25
vercel.json
@@ -1,3 +1,26 @@
|
||||
{
|
||||
"outputDirectory": "website"
|
||||
"outputDirectory": "website",
|
||||
"headers": [
|
||||
{
|
||||
"source": "/downloads/agent.exe",
|
||||
"headers": [
|
||||
{ "key": "Content-Type", "value": "application/octet-stream" },
|
||||
{ "key": "Content-Disposition", "value": "attachment; filename=agent.exe" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"source": "/downloads/agent",
|
||||
"headers": [
|
||||
{ "key": "Content-Type", "value": "application/octet-stream" },
|
||||
{ "key": "Content-Disposition", "value": "attachment; filename=agent" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"source": "/downloads/agent-linux",
|
||||
"headers": [
|
||||
{ "key": "Content-Type", "value": "application/octet-stream" },
|
||||
{ "key": "Content-Disposition", "value": "attachment; filename=agent-linux" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
108
website/agent.ps1
Normal file
108
website/agent.ps1
Normal file
@@ -0,0 +1,108 @@
|
||||
# ============================================================
|
||||
# U-Claw Remote Agent (Windows)
|
||||
# Usage: irm https://u-claw.org/agent.ps1 | iex
|
||||
# ============================================================
|
||||
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
try { chcp 65001 | Out-Null } catch {}
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force -ErrorAction SilentlyContinue
|
||||
|
||||
$RELAY_SERVER = "ws://47.107.130.152:8900"
|
||||
$DOWNLOAD_URL = "https://u-claw.org/downloads/agent.exe"
|
||||
$AGENT_DIR = "$env:TEMP\uclaw"
|
||||
$AGENT_PATH = "$AGENT_DIR\agent.exe"
|
||||
$TOKEN = "remote-agent-secret"
|
||||
$TIMEOUT_HOURS = 2
|
||||
|
||||
Clear-Host
|
||||
Write-Host ""
|
||||
Write-Host " ==========================================" -ForegroundColor Cyan
|
||||
Write-Host " U-Claw Remote Agent" -ForegroundColor Cyan
|
||||
Write-Host " ==========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# ---- Safety notice ----
|
||||
Write-Host " ! This script will:" -ForegroundColor Yellow
|
||||
Write-Host " 1. Download a lightweight remote agent (~8MB)" -ForegroundColor DarkGray
|
||||
Write-Host " 2. Connect to U-Claw relay server" -ForegroundColor DarkGray
|
||||
Write-Host " 3. Allow remote command execution for support" -ForegroundColor DarkGray
|
||||
Write-Host " 4. Close this window to disconnect anytime" -ForegroundColor DarkGray
|
||||
Write-Host ""
|
||||
$confirm = Read-Host " Continue? (y/N)"
|
||||
if ($confirm -ne "y" -and $confirm -ne "Y") {
|
||||
Write-Host " Cancelled." -ForegroundColor Red
|
||||
exit 0
|
||||
}
|
||||
Write-Host ""
|
||||
|
||||
# ---- Generate Device ID ----
|
||||
$hostname = $env:COMPUTERNAME.ToLower()
|
||||
$rand = -join ((97..122) + (48..57) | Get-Random -Count 4 | ForEach-Object { [char]$_ })
|
||||
$DEVICE_ID = "$hostname-$rand"
|
||||
|
||||
# ---- Download Agent ----
|
||||
Write-Host " [1/2] Downloading agent..." -ForegroundColor White
|
||||
try {
|
||||
if (!(Test-Path $AGENT_DIR)) { New-Item -ItemType Directory -Path $AGENT_DIR -Force | Out-Null }
|
||||
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
Invoke-WebRequest -Uri $DOWNLOAD_URL -OutFile $AGENT_PATH -UseBasicParsing
|
||||
$ProgressPreference = 'Continue'
|
||||
|
||||
if (!(Test-Path $AGENT_PATH)) { throw "Download failed" }
|
||||
Write-Host " [OK] Download complete" -ForegroundColor Green
|
||||
} catch {
|
||||
Write-Host " [FAIL] Download failed: $_" -ForegroundColor Red
|
||||
Write-Host " Please check your network and try again." -ForegroundColor Yellow
|
||||
Read-Host " Press Enter to exit"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# ---- Run Agent ----
|
||||
Write-Host " [2/2] Connecting..." -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host " ==========================================" -ForegroundColor Green
|
||||
Write-Host " Connected! Send this ID to support:" -ForegroundColor Green
|
||||
Write-Host " ==========================================" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host " +------------------------------------------+" -ForegroundColor Cyan
|
||||
Write-Host " | Device ID: $DEVICE_ID" -ForegroundColor Cyan
|
||||
Write-Host " | Hostname: $env:COMPUTERNAME" -ForegroundColor Cyan
|
||||
Write-Host " +------------------------------------------+" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host " * Close this window to disconnect" -ForegroundColor DarkGray
|
||||
Write-Host " * Auto-disconnect after $TIMEOUT_HOURS hours" -ForegroundColor DarkGray
|
||||
Write-Host ""
|
||||
|
||||
# Run agent with timeout
|
||||
$agentProcess = Start-Process -FilePath $AGENT_PATH `
|
||||
-ArgumentList "-server", $RELAY_SERVER, "-token", $TOKEN, "-id", $DEVICE_ID `
|
||||
-NoNewWindow -PassThru
|
||||
|
||||
# Auto-timeout
|
||||
$timeoutMs = $TIMEOUT_HOURS * 3600 * 1000
|
||||
$sw = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
|
||||
try {
|
||||
while (!$agentProcess.HasExited) {
|
||||
if ($sw.ElapsedMilliseconds -ge $timeoutMs) {
|
||||
Write-Host ""
|
||||
Write-Host " [!] Session timed out after $TIMEOUT_HOURS hours" -ForegroundColor Yellow
|
||||
$agentProcess.Kill()
|
||||
break
|
||||
}
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
} catch {
|
||||
# User closed window or Ctrl+C
|
||||
} finally {
|
||||
if (!$agentProcess.HasExited) {
|
||||
try { $agentProcess.Kill() } catch {}
|
||||
}
|
||||
# Cleanup
|
||||
try { Remove-Item -Path $AGENT_DIR -Recurse -Force -ErrorAction SilentlyContinue } catch {}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host " Disconnected. You can close this window." -ForegroundColor Yellow
|
||||
Read-Host " Press Enter to exit"
|
||||
92
website/agent.sh
Normal file
92
website/agent.sh
Normal file
@@ -0,0 +1,92 @@
|
||||
#!/bin/bash
|
||||
# ============================================================
|
||||
# U-Claw Remote Agent (macOS / Linux)
|
||||
# Usage: curl -fsSL https://u-claw.org/agent.sh | bash
|
||||
# ============================================================
|
||||
|
||||
set -e
|
||||
|
||||
RELAY_SERVER="ws://47.107.130.152:8900"
|
||||
TOKEN="remote-agent-secret"
|
||||
TIMEOUT_HOURS=2
|
||||
AGENT_DIR="/tmp/uclaw"
|
||||
AGENT_PATH="$AGENT_DIR/agent"
|
||||
|
||||
# Detect OS
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
case "$OS" in
|
||||
darwin) DOWNLOAD_URL="https://u-claw.org/downloads/agent" ;;
|
||||
linux) DOWNLOAD_URL="https://u-claw.org/downloads/agent-linux" ;;
|
||||
*) echo " [FAIL] Unsupported OS: $OS"; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Generate device ID
|
||||
HOSTNAME_SHORT=$(hostname -s 2>/dev/null || hostname | cut -d. -f1)
|
||||
HOSTNAME_LOWER=$(echo "$HOSTNAME_SHORT" | tr '[:upper:]' '[:lower:]')
|
||||
RAND=$(cat /dev/urandom | LC_ALL=C tr -dc 'a-z0-9' | head -c 4)
|
||||
DEVICE_ID="${HOSTNAME_LOWER}-${RAND}"
|
||||
|
||||
clear
|
||||
echo ""
|
||||
echo " =========================================="
|
||||
echo " U-Claw Remote Agent"
|
||||
echo " =========================================="
|
||||
echo ""
|
||||
echo " ! This script will:"
|
||||
echo " 1. Download a lightweight remote agent (~8MB)"
|
||||
echo " 2. Connect to U-Claw relay server"
|
||||
echo " 3. Allow remote command execution for support"
|
||||
echo " 4. Press Ctrl+C or close terminal to disconnect"
|
||||
echo ""
|
||||
printf " Continue? (y/N) "
|
||||
read -r confirm
|
||||
if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
|
||||
echo " Cancelled."
|
||||
exit 0
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Download agent
|
||||
echo " [1/2] Downloading agent..."
|
||||
mkdir -p "$AGENT_DIR"
|
||||
if command -v curl &>/dev/null; then
|
||||
curl -fsSL -o "$AGENT_PATH" "$DOWNLOAD_URL"
|
||||
elif command -v wget &>/dev/null; then
|
||||
wget -q -O "$AGENT_PATH" "$DOWNLOAD_URL"
|
||||
else
|
||||
echo " [FAIL] Neither curl nor wget found"
|
||||
exit 1
|
||||
fi
|
||||
chmod +x "$AGENT_PATH"
|
||||
echo " [OK] Download complete"
|
||||
|
||||
# Cleanup on exit
|
||||
cleanup() {
|
||||
echo ""
|
||||
echo " Disconnected."
|
||||
rm -rf "$AGENT_DIR" 2>/dev/null
|
||||
exit 0
|
||||
}
|
||||
trap cleanup INT TERM EXIT
|
||||
|
||||
# Run agent
|
||||
echo " [2/2] Connecting..."
|
||||
echo ""
|
||||
echo " =========================================="
|
||||
echo " Connected! Send this ID to support:"
|
||||
echo " =========================================="
|
||||
echo ""
|
||||
echo " +------------------------------------------+"
|
||||
echo " | Device ID: $DEVICE_ID"
|
||||
echo " | Hostname: $(hostname)"
|
||||
echo " +------------------------------------------+"
|
||||
echo ""
|
||||
echo " * Press Ctrl+C or close terminal to disconnect"
|
||||
echo " * Auto-disconnect after ${TIMEOUT_HOURS} hours"
|
||||
echo ""
|
||||
|
||||
# Run with timeout
|
||||
timeout "${TIMEOUT_HOURS}h" "$AGENT_PATH" \
|
||||
-server "$RELAY_SERVER" \
|
||||
-token "$TOKEN" \
|
||||
-id "$DEVICE_ID" 2>/dev/null || true
|
||||
BIN
website/downloads/agent
Executable file
BIN
website/downloads/agent
Executable file
Binary file not shown.
BIN
website/downloads/agent-linux
Executable file
BIN
website/downloads/agent-linux
Executable file
Binary file not shown.
BIN
website/downloads/agent.exe
Executable file
BIN
website/downloads/agent.exe
Executable file
Binary file not shown.
Reference in New Issue
Block a user