Implemented initial version of logging system. Log formatting and content needs to be reworked.

This commit is contained in:
Jakob Friedl
2025-08-20 12:55:09 +02:00
parent 24208f3b4b
commit f69adc53a2
10 changed files with 139 additions and 74 deletions

View File

@@ -1,5 +1,6 @@
import times, strformat, terminal, tables, sequtils, strutils
import ./logger
import ../utils
import ../protocol/parser
import ../../modules/manager
@@ -56,6 +57,7 @@ proc handleAgentCommand*(cq: Conquest, input: string) =
let date: string = now().format("dd-MM-yyyy HH:mm:ss")
cq.writeLine(fgBlue, styleBright, fmt"[{date}] ", fgYellow, fmt"[{cq.interactAgent.agentId}] ", resetStyle, styleBright, input)
cq.log(fmt"Agent command received: {input}")
# Convert user input into sequence of string arguments
let parsedArgs = parseInput(input)
@@ -78,8 +80,8 @@ proc handleAgentCommand*(cq: Conquest, input: string) =
# Add task to queue
cq.interactAgent.tasks.add(task)
cq.writeLine(fgBlack, styleBright, fmt"[{date}] [*] ", resetStyle, fmt"Tasked agent to {command.description.toLowerAscii()}")
cq.info(fgBlack, styleBright, fmt"[{date}] [*] ", resetStyle, fmt"Tasked agent to {command.description.toLowerAscii()}")
except CatchableError:
cq.writeLine(fgRed, styleBright, fmt"[-] {getCurrentExceptionMsg()}" & "\n")
cq.error(getCurrentExceptionMsg() & "\n")
return