diff --git a/helper.py b/helper.py index b007fb2..9ac3636 100644 --- a/helper.py +++ b/helper.py @@ -13,7 +13,7 @@ from observer import observer logger = logging.getLogger("Helper") -SHC_VERIFY_SLEEP = 0.1 +SHC_VERIFY_SLEEP = 0.2 def write_webproject(project_name, settings): @@ -141,15 +141,18 @@ def round_up_to_multiple_of_8(x): def ui_string_decode(data): + res = "" try: if len(data) > 32: - return "Data with len {}".format(len(data)) + res = "Data with len {}".format(len(data)) elif b"\x00\x00" in data: - return "(utf16) " + data.decode("utf-16le") + res = "(utf16) " + data.decode("utf-16le") else: - return "(utf8) " + data.decode("utf-8") + res = "(utf8) " + data.decode("utf-8") except Exception as e: - logger.warning("ui_string_decode: {}".format(e)) + res = "(bytes) " + data.hex() + + return res def ascii_to_hex_bytes(ascii_bytes): diff --git a/model/injectable.py b/model/injectable.py index 7b68881..90718c0 100644 --- a/model/injectable.py +++ b/model/injectable.py @@ -77,6 +77,7 @@ class Injectable(): # Data Reuse def add_datareuse_fixup(self, fixup: DataReuseEntry): + logger.info("---( Add datareuse: {}".format(fixup.string_ref)) self.reusedata_fixups.append(fixup) def get_all_reusedata_fixups(self) -> List[DataReuseEntry]: diff --git a/phases/injector.py b/phases/injector.py index c4b467f..4e6b724 100644 --- a/phases/injector.py +++ b/phases/injector.py @@ -257,7 +257,7 @@ class Injector(): # insert data logger.info("---( DataReuseFixups: Inject the data") for datareuse_fixup in reusedata_fixups: - logger.debug(" Handling DataReuse Fixup: {} (.code: {})".format( + logger.info(" Handling DataReuse Fixup: {} (.code: {})".format( datareuse_fixup.string_ref, datareuse_fixup.in_code)) if datareuse_fixup.in_code: # .text @@ -281,6 +281,7 @@ class Injector(): data_rva = hole_rva[0] self.superpe.pe.set_bytes_at_rva(data_rva, var_data) datareuse_fixup.addr = data_rva + self.injectable.superpe.get_image_base() + ## logging.info(" Add to .rdata at 0x{:X} ({}): {}: {}".format( datareuse_fixup.addr, data_rva, datareuse_fixup.string_ref, ui_string_decode(var_data)))