SolverBot: - Inject active project path into agent system prompts so agents know which directory to scope file operations to GuruRMM: - Bump agent version to 0.6.0 - Add serde aliases for PowerShell/ClaudeTask command types - Add typed CommandType enum on server for proper serialization - Support claude_task command type in send_command API Dataforth: - Fix SCP space-escaping in Sync-FromNAS.ps1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
47 lines
1.8 KiB
Python
47 lines
1.8 KiB
Python
import requests, json, time, sys
|
|
|
|
# Auth
|
|
token_r = requests.post('http://172.16.3.30:3001/api/auth/login', json={
|
|
'email': 'claude-api@azcomputerguru.com',
|
|
'password': 'ClaudeAPI2026!@#'
|
|
})
|
|
token = token_r.json()['token']
|
|
headers = {'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json'}
|
|
agent_id = 'd28a1c90-47d7-448f-a287-197bc8892234'
|
|
|
|
def send_cmd(cmd, timeout=120, wait=20):
|
|
r = requests.post(
|
|
'http://172.16.3.30:3001/api/agents/' + agent_id + '/command',
|
|
headers=headers,
|
|
json={'command_type': 'powershell', 'command': cmd, 'timeout_seconds': timeout}
|
|
)
|
|
data = r.json()
|
|
print('Sent:', data.get('status', 'error'), data.get('message', ''))
|
|
cmd_id = data['command_id']
|
|
time.sleep(wait)
|
|
r2 = requests.get('http://172.16.3.30:3001/api/commands/' + cmd_id, headers=headers)
|
|
d = r2.json()
|
|
print('Status:', d['status'])
|
|
print('stdout:', d.get('stdout', ''))
|
|
stderr = d.get('stderr', '') or ''
|
|
if stderr:
|
|
print('stderr:', stderr[:500])
|
|
print('exit_code:', d.get('exit_code'))
|
|
return d
|
|
|
|
# First, check what transfer tools are available on AD2
|
|
print("=== Checking available tools ===")
|
|
d = send_cmd("Get-Command scp,ssh,curl -ErrorAction SilentlyContinue | Select-Object Name,Source | Format-Table -AutoSize", wait=10)
|
|
|
|
print("\n=== Trying SCP from AD2 to RMM server ===")
|
|
# Use scp with StrictHostKeyChecking=no for automated transfer
|
|
cmd = (
|
|
"scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL "
|
|
"guru@172.16.3.30:/tmp/gururmm-agent-new.exe C:/Temp/gururmm-agent-new.exe 2>&1; "
|
|
"if (Test-Path C:/Temp/gururmm-agent-new.exe) { "
|
|
" $f = Get-Item C:/Temp/gururmm-agent-new.exe; "
|
|
" Write-Output ('File size: ' + $f.Length.ToString() + ' bytes') "
|
|
"} else { Write-Output 'File not found after SCP' }"
|
|
)
|
|
d = send_cmd(cmd, wait=30)
|