Implemented switch to agent interaction mode.

This commit is contained in:
Jakob Friedl
2025-05-18 12:51:26 +02:00
parent 56f8994069
commit 0a98d11df2
13 changed files with 279 additions and 211 deletions

View File

@@ -1,4 +1,5 @@
import terminal, strformat, strutils, tables
import ./commands
import ../[types, globals, utils]
import ../db/database
@@ -84,12 +85,27 @@ proc agentKill*(cq: Conquest, name: string) =
cq.writeLine(fgYellow, styleBright, "[+] ", resetStyle, "Terminated agent ", fgYellow, styleBright, name.toUpperAscii, resetStyle, ".")
# Switch to interact mode
proc agentInteract*(cq: Conquest, args: varargs[string]) =
proc agentInteract*(cq: Conquest, name: string) =
cq.setIndicator("[AGENT] (username@hostname)> ")
cq.setStatusBar(@[("[mode]", "interact"), ("[username]", "X"), ("[hostname]", "4"), ("[ip]", "127.0.0.1"), ("[domain]", "domain.local")])
# Verify that agent exists
if not cq.dbAgentExists(name.toUpperAscii):
cq.writeLine(fgRed, styleBright, fmt"[-] Agent {name.toUpperAscii} does not exist.")
return
var command: string = cq.readLine()
let agent = cq.agents[name.toUpperAscii]
var command: string = ""
# Change prompt indicator to show agent interaction
cq.setIndicator(fmt"[{agent.name}]> ")
cq.setStatusBar(@[("[mode]", "interact"), ("[username]", fmt"{agent.username}"), ("[hostname]", fmt"{agent.hostname}"), ("[ip]", fmt"{agent.ip}"), ("[domain]", fmt"{agent.domain}")])
cq.writeLine(fgYellow, "[+] ", resetStyle, fmt"Started interacting with agent ", fgYellow, agent.name, resetStyle, ". Type 'help' to list available commands.\n")
cq.interactAgent = agent
while command != "exit":
command = cq.readLine()
cq.withOutput(handleAgentCommand, command)
cq.interactAgent = nil
#[
Agent API