From 120de6778dc7ad35724d7f522f9f4af6fcef06a8 Mon Sep 17 00:00:00 2001 From: Marmeus Date: Tue, 17 Mar 2026 13:07:58 +0000 Subject: [PATCH] Added hash of payload when built sucessfull --- Payload_Type/cazalla/cazalla/agent_functions/builder.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Payload_Type/cazalla/cazalla/agent_functions/builder.py b/Payload_Type/cazalla/cazalla/agent_functions/builder.py index eb134ed..c5e86c5 100644 --- a/Payload_Type/cazalla/cazalla/agent_functions/builder.py +++ b/Payload_Type/cazalla/cazalla/agent_functions/builder.py @@ -7,6 +7,7 @@ from mythic_container.MythicRPC import * import json from distutils.dir_util import copy_tree,remove_tree import asyncio +import hashlib import string, random, os, subprocess @@ -358,11 +359,15 @@ class CazallaAgent(PayloadType): resp.build_message = f"Compilation failed: {compile_errors}" return resp + # Obtain the MD5 and SHA256 of the compiled payload + md5_hash = hashlib.md5(open(filename, "rb").read()).hexdigest() + sha256_hash = hashlib.sha256(open(filename, "rb").read()).hexdigest() + debug_info = f" (DEBUG: {debug_level}/{debug_output})" if debug_level != "none" else "" await SendMythicRPCPayloadUpdatebuildStep(MythicRPCPayloadUpdateBuildStepMessage( PayloadUUID=self.uuid, StepName="Compiling", - StepStdout=f"Successfully compiled cazalla{debug_info}\nCommand: {command}\nTarget: {make_target}\nFlags: {make_flags}\nOutput: {output_filename}", + StepStdout=f"Successfully compiled cazalla{debug_info}\nCommand: {command}\nTarget: {make_target}\nFlags: {make_flags}\nOutput: {output_filename}\nMD5: {md5_hash}\nSHA256: {sha256_hash}", StepSuccess=True ))