mirror of
https://github.com/dobin/SuperMega
synced 2026-06-02 17:27:10 +00:00
refactor: wrong logging. -> logger.
This commit is contained in:
+2
-2
@@ -13,7 +13,7 @@ class Payload():
|
||||
|
||||
|
||||
def init(self) -> bool:
|
||||
logging.info("-[ Payload: {}".format(self.payload_path))
|
||||
logger.info("-[ Payload: {}".format(self.payload_path))
|
||||
if not os.path.exists(self.payload_path):
|
||||
logger.error("Payload file does not exist: {}".format(self.payload_path))
|
||||
return False
|
||||
@@ -21,6 +21,6 @@ class Payload():
|
||||
with open(self.payload_path, 'rb') as f:
|
||||
self.payload_data = f.read()
|
||||
|
||||
logging.info(" Size: {} bytes".format(len(self.payload_data)))
|
||||
logger.info(" Size: {} bytes".format(len(self.payload_data)))
|
||||
return True
|
||||
|
||||
|
||||
+1
-1
@@ -344,7 +344,7 @@ class SuperPe():
|
||||
if string_off == None:
|
||||
raise Exception("Strings not found in .rdata section, abort")
|
||||
if string_off < 128:
|
||||
logging.debug("weird: Strings in .rdata section at offset {} < 100".format(string_off))
|
||||
logger.debug("weird: Strings in .rdata section at offset {} < 100".format(string_off))
|
||||
string_off = 128
|
||||
rm.add_range(section.virt_addr, section.virt_addr + string_off)
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ def asm_to_shellcode(asm_in: FilePath, build_exe: FilePath) -> bytes:
|
||||
if not os.path.isfile(build_exe):
|
||||
raise Exception("Compiling failed")
|
||||
code = extract_code_from_exe_file(build_exe)
|
||||
logging.info(" Carrier Size: {}".format(
|
||||
logger.info(" Carrier Size: {}".format(
|
||||
len(code)
|
||||
))
|
||||
return code
|
||||
|
||||
+2
-2
@@ -284,7 +284,7 @@ class Injector():
|
||||
if payload_rva == None:
|
||||
raise Exception("DataReuseFixup: payload_rva is None")
|
||||
datareuse_fixup.addr = payload_rva + self.injectable.superpe.get_image_base()
|
||||
logging.debug(" Add to .text at 0x{:X} ({}): {} with size {}".format(
|
||||
logger.debug(" Add to .text at 0x{:X} ({}): {} with size {}".format(
|
||||
datareuse_fixup.addr, payload_rva, datareuse_fixup.string_ref, len(datareuse_fixup.data)))
|
||||
|
||||
else: # .rdata
|
||||
@@ -301,7 +301,7 @@ class Injector():
|
||||
self.superpe.pe.set_bytes_at_rva(data_rva, var_data)
|
||||
datareuse_fixup.addr = data_rva + self.injectable.superpe.get_image_base()
|
||||
##
|
||||
logging.debug(" Add to .rdata at 0x{:X} ({}): {}: {}".format(
|
||||
logger.debug(" Add to .rdata at 0x{:X} ({}): {}: {}".format(
|
||||
datareuse_fixup.addr, data_rva, datareuse_fixup.string_ref, ui_string_decode(var_data)))
|
||||
|
||||
# replace the placeholder in .text with a LEA instruction to the data we written above
|
||||
|
||||
+2
-2
@@ -104,11 +104,11 @@ def create_c_from_template(settings: Settings, payload_len: int):
|
||||
max_alloc_count = 256
|
||||
if sir_alloc_count > max_alloc_count:
|
||||
# if too large, compiler will add a __checkstk dependency
|
||||
logging.warning("Too large sir allocation count {}, setting to max {}".format(
|
||||
logger.warning("Too large sir allocation count {}, setting to max {}".format(
|
||||
sir_alloc_count, max_alloc_count
|
||||
))
|
||||
sir_alloc_count = max_alloc_count
|
||||
logging.debug("-( AntiEmulation settings: iterations: {} allocs: {}".format(
|
||||
logger.debug("-( AntiEmulation settings: iterations: {} allocs: {}".format(
|
||||
sir_iteration_count, sir_alloc_count)
|
||||
)
|
||||
plugin_antiemualation = file.read()
|
||||
|
||||
@@ -11,7 +11,7 @@ logger = logging.getLogger("Sender")
|
||||
|
||||
def scannerDetectsBytes(data: bytes, filename: str, useBrotli=True, verify=False, no_exec=False):
|
||||
if config.get("avred_server") == "":
|
||||
logging.error("No AVRed server configured, aborting")
|
||||
logger.error("No AVRed server configured, aborting")
|
||||
return
|
||||
params = { 'filename': filename, 'brotli': useBrotli, 'verify': verify, 'no_exec' : no_exec}
|
||||
|
||||
@@ -30,7 +30,7 @@ def scannerDetectsBytes(data: bytes, filename: str, useBrotli=True, verify=False
|
||||
|
||||
# basically internal server error, e.g. AMSI not working
|
||||
if res.status_code != 200:
|
||||
logging.error("Error Code {}: {}".format(res.status_code, res.text))
|
||||
logger.error("Error Code {}: {}".format(res.status_code, res.text))
|
||||
raise Exception("Server error, aborting")
|
||||
|
||||
return jsonRes
|
||||
|
||||
+4
-4
@@ -204,10 +204,10 @@ def start_real(settings: Settings) -> bool:
|
||||
# CHECK if all are available in infectable, or abort (early check)
|
||||
functions = project.injectable.get_unresolved_iat()
|
||||
if len(functions) != 0 and settings.fix_missing_iat == False:
|
||||
logging.error("IAT entries not found in infectable: {}".format(", ".join(functions)))
|
||||
logging.error("The carrier depends on these functions, but they are not available in the infectable exe.")
|
||||
logging.error("Use another infectable exe, or update the carrier to not depend on these functions.")
|
||||
logging.error(" or dont use --no-fix-iat")
|
||||
logger.error("IAT entries not found in infectable: {}".format(", ".join(functions)))
|
||||
logger.error("The carrier depends on these functions, but they are not available in the infectable exe.")
|
||||
logger.error("Use another infectable exe, or update the carrier to not depend on these functions.")
|
||||
logger.error(" or dont use --no-fix-iat")
|
||||
return False
|
||||
|
||||
# ASSEMBLE: Assemble .asm to .shc (ASM -> SHC)
|
||||
|
||||
Reference in New Issue
Block a user