Reworked logging system to work with new GUI.

This commit is contained in:
Jakob Friedl
2025-10-02 13:51:04 +02:00
parent ab48bc5795
commit d02808a6d3
5 changed files with 46 additions and 27 deletions

View File

@@ -186,7 +186,7 @@ proc handleAgentCommand*(component: ConsoleComponent, connection: WsConnection,
command = getCommandByName(parsedArgs[0])
task = createTask(component.agent.agentId, component.agent.listenerId, command, parsedArgs[1..^1])
connection.sendAgentTask(component.agent.agentId, task)
connection.sendAgentTask(component.agent.agentId, input, task)
component.addItem(LOG_INFO, fmt"Tasked agent to {command.description.toLowerAscii()} ({Uuid.toString(task.taskId)})")
except CatchableError:

View File

@@ -48,12 +48,13 @@ proc sendAgentBuild*(connection: WsConnection, buildInformation: AgentBuildInfor
)
connection.ws.sendEvent(event, connection.sessionKey)
proc sendAgentTask*(connection: WsConnection, agentId: string, task: Task) =
proc sendAgentTask*(connection: WsConnection, agentId: string, command: string, task: Task) =
let event = Event(
eventType: CLIENT_AGENT_TASK,
timestamp: now().toTime().toUnix(),
data: %*{
"agentId": agentId,
"command": command,
"task": task
}
)