Improved logging format.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import terminal, strformat, strutils, tables, times, system, parsetoml
|
||||
|
||||
import ./[task, logger]
|
||||
import ./task
|
||||
import ../utils
|
||||
import ../db/database
|
||||
import ../../common/types
|
||||
@@ -49,7 +49,7 @@ proc agentList*(cq: Conquest, listener: string) =
|
||||
else:
|
||||
# Check if listener exists
|
||||
if not cq.dbListenerExists(listener.toUpperAscii):
|
||||
cq.writeLine(fgRed, styleBright, fmt"[-] Listener {listener.toUpperAscii} does not exist.")
|
||||
cq.writeLine(fgRed, styleBright, fmt"[ - ] Listener {listener.toUpperAscii} does not exist.")
|
||||
return
|
||||
|
||||
cq.drawTable(cq.dbGetAllAgentsByListener(listener.toUpperAscii))
|
||||
@@ -59,7 +59,7 @@ proc agentList*(cq: Conquest, listener: string) =
|
||||
proc agentInfo*(cq: Conquest, name: string) =
|
||||
# Check if agent supplied via -n parameter exists in database
|
||||
if not cq.dbAgentExists(name.toUpperAscii):
|
||||
cq.writeLine(fgRed, styleBright, fmt"[-] Agent {name.toUpperAscii} does not exist.")
|
||||
cq.writeLine(fgRed, styleBright, fmt"[ - ] Agent {name.toUpperAscii} does not exist.")
|
||||
return
|
||||
|
||||
let agent = cq.agents[name.toUpperAscii]
|
||||
@@ -87,7 +87,7 @@ proc agentKill*(cq: Conquest, name: string) =
|
||||
|
||||
# Check if agent supplied via -n parameter exists in database
|
||||
if not cq.dbAgentExists(name.toUpperAscii):
|
||||
cq.writeLine(fgRed, styleBright, fmt"[-] Agent {name.toUpperAscii} does not exist.")
|
||||
cq.writeLine(fgRed, styleBright, fmt"[ - ] Agent {name.toUpperAscii} does not exist.")
|
||||
return
|
||||
|
||||
# TODO: Stop the process of the agent on the target system
|
||||
@@ -96,30 +96,29 @@ proc agentKill*(cq: Conquest, name: string) =
|
||||
|
||||
# Remove the agent from the database
|
||||
if not cq.dbDeleteAgentByName(name.toUpperAscii):
|
||||
cq.writeLine(fgRed, styleBright, "[-] Failed to terminate agent: ", getCurrentExceptionMsg())
|
||||
cq.writeLine(fgRed, styleBright, "[ - ] Failed to terminate agent: ", getCurrentExceptionMsg())
|
||||
return
|
||||
|
||||
cq.delAgent(name)
|
||||
cq.writeLine(fgYellow, styleBright, "[+] ", resetStyle, "Terminated agent ", fgYellow, styleBright, name.toUpperAscii, resetStyle, ".")
|
||||
cq.writeLine(fgYellow, styleBright, "[ + ] ", resetStyle, "Terminated agent ", fgYellow, styleBright, name.toUpperAscii, resetStyle, ".")
|
||||
|
||||
# Switch to interact mode
|
||||
proc agentInteract*(cq: Conquest, name: string) =
|
||||
|
||||
# Verify that agent exists
|
||||
if not cq.dbAgentExists(name.toUpperAscii):
|
||||
cq.writeLine(fgRed, styleBright, fmt"[-] Agent {name.toUpperAscii} does not exist.")
|
||||
cq.writeLine(fgRed, styleBright, fmt"[ - ] Agent {name.toUpperAscii} does not exist.")
|
||||
return
|
||||
|
||||
let agent = cq.agents[name.toUpperAscii]
|
||||
var command: string = ""
|
||||
|
||||
# Change prompt indicator to show agent interaction
|
||||
cq.interactAgent = agent
|
||||
cq.setIndicator(fmt"[{agent.agentId}]> ")
|
||||
cq.setStatusBar(@[("[mode]", "interact"), ("[username]", fmt"{agent.username}"), ("[hostname]", fmt"{agent.hostname}"), ("[ip]", fmt"{agent.ip}"), ("[domain]", fmt"{agent.domain}")])
|
||||
cq.writeLine(fgYellow, styleBright, "[+] ", resetStyle, fmt"Started interacting with agent ", fgYellow, styleBright, agent.agentId, resetStyle, ". Type 'help' to list available commands.\n")
|
||||
cq.interactAgent = agent
|
||||
|
||||
cq.log(fmt"Started interacting with agent {agent.agentId}.")
|
||||
|
||||
cq.writeLine(fgBlack, styleBright, fmt"[{getTimestamp()}] ", fgYellow, "[ + ] ", resetStyle, fmt"Started interacting with agent ", fgYellow, styleBright, agent.agentId, resetStyle, ". Type 'help' to list available commands.\n")
|
||||
|
||||
while command.replace(" ", "") != "back":
|
||||
command = cq.readLine()
|
||||
|
||||
Reference in New Issue
Block a user