Started porting over command input & task output to the ImGui client.

This commit is contained in:
Jakob Friedl
2025-09-27 17:45:52 +02:00
parent 5472019d78
commit 13a245ebf2
8 changed files with 37 additions and 44 deletions

View File

@@ -3,6 +3,7 @@ import strformat, strutils, times
import imguin/[cimgui, glfw_opengl, simple]
import ../utils/[appImGui, colors]
import ../../common/[types]
import ../websocket
const MAX_INPUT_LENGTH = 512
type
@@ -270,6 +271,7 @@ proc draw*(component: ConsoleComponent, ws: WebSocket) =
component.addItem(LOG_COMMAND, command)
# Send command to team server
ws.sendAgentCommand(component.agent.agentId, command)
# Add command to console history
component.history.add(command)

View File

@@ -1,10 +1,10 @@
import whisky
import strutils
import imguin/[cimgui, glfw_opengl, simple]
import ../utils/appImGui
import ../../common/[types, utils]
import ./modals/[startListener, generatePayload]
import ../websocket
import whisky
type
ListenersTableComponent* = ref object of RootObj

View File

@@ -1,6 +1,5 @@
import whisky
import times, tables, json
import ./views/[sessions, listeners, console, eventlog]
import ../common/[types, utils, serialize, event]
export sendHeartbeat, recvEvent
@@ -39,26 +38,13 @@ proc sendAgentBuild*(ws: WebSocket, buildInformation: AgentBuildInformation) =
)
ws.sendEvent(event)
# proc sendAgentCommand*(ws: WebSocket, agentId: string, command: string) =
# var packer = Packer.init()
# packer.add(cast[uint8](CLIENT_AGENT_COMMAND))
# packer.add(string.toUuid(agentId))
# packer.addDataWithLengthPrefix(string.toBytes(command))
# let data = packer.pack()
# ws.send(Bytes.toString(data), BinaryMessage)
# proc sendAgentBuild*(ws: WebSocket, listenerId: string, sleepDelay: int, sleepMask: SleepObfuscationTechnique, spoofStack: bool, modules: uint32) =
# var packer = Packer.init()
# packer.add(cast[uint8](CLIENT_AGENT_BUILD))
# packer.add(string.toUuid(listenerId))
# packer.add(cast[uint32](sleepDelay))
# packer.add(cast[uint8](sleepMask))
# packer.add(cast[uint8](spoofStack))
# packer.add(modules)
# let data = packer.pack()
# ws.send(Bytes.toString(data), BinaryMessage)
proc sendAgentCommand*(ws: WebSocket, agentId: string, command: string) =
let event = Event(
eventType: CLIENT_AGENT_COMMAND,
timestamp: now().toTime().toUnix(),
data: %*{
"agentId": agentId,
"command": command
}
)
ws.sendEvent(event)