mirror of
https://github.com/dobin/SuperMega
synced 2026-06-03 01:27:11 +00:00
fix: small bugfixes
This commit is contained in:
@@ -170,13 +170,15 @@ def round_up_to_multiple_of_8(x):
|
|||||||
|
|
||||||
|
|
||||||
def ui_string_decode(data):
|
def ui_string_decode(data):
|
||||||
if len(data) > 32:
|
try:
|
||||||
return "Data with len {}".format(len(data))
|
if len(data) > 32:
|
||||||
elif b"\x00\x00" in data:
|
return "Data with len {}".format(len(data))
|
||||||
return "(utf16) " + data.decode("utf-16le")
|
elif b"\x00\x00" in data:
|
||||||
else:
|
return "(utf16) " + data.decode("utf-16le")
|
||||||
return "(utf8) " + data.decode("utf-8")
|
else:
|
||||||
|
return "(utf8) " + data.decode("utf-8")
|
||||||
|
except Exception as e:
|
||||||
|
logger.warn("ui_string_decode: {}".format(e))
|
||||||
|
|
||||||
def ascii_to_hex_bytes(ascii_bytes):
|
def ascii_to_hex_bytes(ascii_bytes):
|
||||||
hex_escaped = ''.join(f'\\x{byte:02x}' for byte in ascii_bytes)
|
hex_escaped = ''.join(f'\\x{byte:02x}' for byte in ascii_bytes)
|
||||||
|
|||||||
+1
-1
@@ -269,7 +269,7 @@ class SuperPe():
|
|||||||
if self.pe.DIRECTORY_ENTRY_EXPORT.symbols == 0:
|
if self.pe.DIRECTORY_ENTRY_EXPORT.symbols == 0:
|
||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn("No exports found")
|
logger.warn("get_exports_full(): No exports found in PE")
|
||||||
return []
|
return []
|
||||||
res = []
|
res = []
|
||||||
for e in self.pe.DIRECTORY_ENTRY_EXPORT.symbols:
|
for e in self.pe.DIRECTORY_ENTRY_EXPORT.symbols:
|
||||||
|
|||||||
@@ -180,6 +180,9 @@ def convert_asm_db_to_bytes(line: str) -> bytes:
|
|||||||
value += str.encode(part.split('\'')[1])
|
value += str.encode(part.split('\'')[1])
|
||||||
elif part.endswith('H') or part.endswith('H,'):
|
elif part.endswith('H') or part.endswith('H,'):
|
||||||
hex = part.split('H')[0]
|
hex = part.split('H')[0]
|
||||||
|
if len(hex) == 3:
|
||||||
|
# 09cH,
|
||||||
|
hex = hex[1:]
|
||||||
value += bytes.fromhex(hex)
|
value += bytes.fromhex(hex)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ def inject_exe(main_shc: bytes, settings: Settings, carrier: Carrier):
|
|||||||
shellcode_len = len(main_shc)
|
shellcode_len = len(main_shc)
|
||||||
code_sect_size = carrier.superpe.get_code_section().Misc_VirtualSize
|
code_sect_size = carrier.superpe.get_code_section().Misc_VirtualSize
|
||||||
if shellcode_len + CODE_INJECT_SIZE_CHECK_ADD > code_sect_size:
|
if shellcode_len + CODE_INJECT_SIZE_CHECK_ADD > code_sect_size:
|
||||||
raise Exception("Error: Shellcode size {}+{} too small for target code section {}".format(
|
raise Exception("Error: Shellcode size {}+{} too big for target code section {}".format(
|
||||||
shellcode_len, CODE_INJECT_SIZE_CHECK_ADD, code_sect_size
|
shellcode_len, CODE_INJECT_SIZE_CHECK_ADD, code_sect_size
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user