Skip to content

Commit

Permalink
Remove testing DUApp
Browse files Browse the repository at this point in the history
  • Loading branch information
sledgeh4w committed Aug 18, 2023
1 parent 210453c commit cf2ef39
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
Binary file not shown.
Binary file added examples/ios/.DS_Store
Binary file not shown.
7 changes: 1 addition & 6 deletions src/chomper/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,6 @@ def _process_relocation(self, binary: lief.MachO.Binary, module_base: int):
cross-references."""
symbols_map = self._get_symbols_map()

# for relocation in binary.relocations:
# if relocation.type == 1:
# addr = self.emu.read_pointer(module_base + relocation.address)
# self.emu.write_pointer(module_base + relocation.address, module_base + addr)

blocks: List[Tuple[int, int]] = []

begin = None
Expand Down Expand Up @@ -435,7 +430,7 @@ def load_module(
module_name = os.path.basename(module_file)
self.emu.logger.info(f"Load module '{module_name}'.")

binary: lief.MachO.Binary = lief.parse(module_file) # type: ignore
binary: lief.MachO.Binary = lief.parse(module_file) # type: ignore

base = self._get_load_base()
size = self._map_segments(binary, base)
Expand Down
30 changes: 15 additions & 15 deletions tests/test_emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,21 +375,21 @@ def test_emulate_libtiny_v73021_arm64(

assert zlib.crc32(result) == 4192995551

def test_emulate_duapp_v581(self, emu_ios, sample_str):
duapp = emu_ios.load_module(os.path.join(ios_arm64_path, "DUApp"))

a1 = emu_ios.create_string("ios")
a2 = emu_ios.create_string(sample_str)
a3 = len(sample_str)
a4 = emu_ios.create_string(str(uuid.uuid4()))
a5 = emu_ios.create_buffer(8)
a6 = emu_ios.create_buffer(8)
a7 = emu_ios.create_string("com.siwuai.duapp")

emu_ios.call_address(duapp.base + 0x109322118, a1, a2, a3, a4, a5, a6, a7)
result = emu_ios.read_string(emu_ios.read_address(a5))

assert re.match(r"\w{32}\.[\w=]+\.", result)
# def test_emulate_duapp_v581(self, emu_ios, sample_str):
# duapp = emu_ios.load_module(os.path.join(ios_arm64_path, "DUApp"))
#
# a1 = emu_ios.create_string("ios")
# a2 = emu_ios.create_string(sample_str)
# a3 = len(sample_str)
# a4 = emu_ios.create_string(str(uuid.uuid4()))
# a5 = emu_ios.create_buffer(8)
# a6 = emu_ios.create_buffer(8)
# a7 = emu_ios.create_string("com.siwuai.duapp")
#
# emu_ios.call_address(duapp.base + 0x109322118, a1, a2, a3, a4, a5, a6, a7)
# result = emu_ios.read_string(emu_ios.read_address(a5))
#
# assert re.match(r"\w{32}\.[\w=]+\.", result)


class TestExceptions:
Expand Down

0 comments on commit cf2ef39

Please sign in to comment.