Updated directory structure.

This commit is contained in:
Jakob Friedl
2025-10-03 12:44:28 +02:00
parent ae09e4e7e3
commit b39a0e70e2
18 changed files with 79 additions and 26 deletions

View File

@@ -0,0 +1,61 @@
import whisky
import times, tables, json, base64
import ../../common/[types, utils, serialize, event]
export sendHeartbeat, recvEvent
#[
Client -> Server
]#
proc sendPublicKey*(connection: WsConnection, publicKey: Key) =
let event = Event(
eventType: CLIENT_KEY_EXCHANGE,
timestamp: now().toTime().toUnix(),
data: %*{
"publicKey": encode(Bytes.toString(publicKey))
}
)
connection.ws.sendEvent(event, connection.sessionKey)
proc sendStartListener*(connection: WsConnection, listener: UIListener) =
let event = Event(
eventType: CLIENT_LISTENER_START,
timestamp: now().toTime().toUnix(),
data: %listener
)
connection.ws.sendEvent(event, connection.sessionKey)
proc sendStopListener*(connection: WsConnection, listenerId: string) =
let event = Event(
eventType: CLIENT_LISTENER_STOP,
timestamp: now().toTime().toUnix(),
data: %*{
"listenerId": listenerId
}
)
connection.ws.sendEvent(event, connection.sessionKey)
proc sendAgentBuild*(connection: WsConnection, buildInformation: AgentBuildInformation) =
let event = Event(
eventType: CLIENT_AGENT_BUILD,
timestamp: now().toTime().toUnix(),
data: %*{
"listenerId": buildInformation.listenerId,
"sleepDelay": buildInformation.sleepDelay,
"sleepTechnique": cast[uint8](buildInformation.sleepTechnique),
"spoofStack": buildInformation.spoofStack,
"modules": buildInformation.modules
}
)
connection.ws.sendEvent(event, connection.sessionKey)
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
}
)
connection.ws.sendEvent(event, connection.sessionKey)