mirror of
https://github.com/dobin/SuperMega
synced 2026-06-02 17:27:10 +00:00
fix: small anoying bugs
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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]:
|
||||
|
||||
+2
-1
@@ -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)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user