def test_read_classlist_data_const_segment(self) -> None: # Given a binary which stores the __objc_classlist section in the __DATA_CONST segment binary_with_data_classlist = MachoParser(TestMachoBinary.CLASSLIST_DATA_CONST).get_arm64_slice() assert binary_with_data_classlist # If I read the __objc_classlist pointer section locations, entries = binary_with_data_classlist.read_pointer_section("__objc_classlist") correct_locations = [0x100008098, 0x1000080A0, 0x1000080A8] correct_entries = [0x10000D3C0, 0x10000D438, 0x10000D488] # Then I get the correct data assert sorted(locations) == sorted(correct_locations) assert sorted(entries) == sorted(correct_entries)
def test_read_classlist_data_segment(self) -> None: # Given a binary which stores the __objc_classlist section in the __DATA segment binary_with_data_classlist = MachoParser(TestMachoBinary.THIN_PATH).get_arm64_slice() assert binary_with_data_classlist # If I read the __objc_classlist pointer section locations, entries = binary_with_data_classlist.read_pointer_section("__objc_classlist") correct_locations = [0x100008178, 0x100008180, 0x100008188, 0x100008190] correct_entries = [0x100009120, 0x100009170, 0x1000091E8, 0x100009238] # Then I get the correct data assert sorted(locations) == sorted(correct_locations) assert sorted(entries) == sorted(correct_entries)