immense / immense/Remotely

API/Scripting/ExecuteCommand - working but no result

Open
#672 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
5.1k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
I get no result object from "API/Scripting/ExecuteCommand". It seems to timeout after 30 seconds and I get a 404 exception.

To Reproduce

$server = "http://xxx.xxx.xx:5000"
$headers = @{ Authorization = "Basic $([System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("xxx:xxx")))" }

$g = Invoke-WebRequest -Uri "$server/api/Devices" -Method Get -Headers $headers -ContentType "application/json" -UseBasicParsing -ErrorAction Stop
($g.Content | ConvertFrom-Json) | Select-Object organizationID, id, deviceName, osDescription | Out-GridView -OutputMode Multiple | % {
    $d = $_
    $p = Invoke-WebRequest -Uri "$server/API/Scripting/ExecuteCommand/PSCore/$($d.id)" -Method Post -Headers $headers -Body "Get-Culture"  -ContentType "application/json" -UseBasicParsing -ErrorAction Stop
}

$g = Invoke-WebRequest -Uri "$server/API/ScriptResults" -Method Get -Headers $headers -ContentType "text/plain" -UseBasicParsing -OutFile "$env:TEMP\r.json"  -UseBasicParsing -ErrorAction Stop
(Get-Content  "$env:TEMP\r.json" | ConvertFrom-Json) | Out-GridView -OutputMode Multiple

Remotely Version
Version: 2023.06.24.1218 (docker preview)

Expected Behavior
Get a result similar to the one from API/ScriptResults

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the API/Scripting/ExecuteCommand/PSCore/{device id} endpoint and compare its behavior with API/ScriptResults. Reproduce the PowerShell request using the supplied example; done means ExecuteCommand returns a result without the 30-second timeout or 404 exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.