Exemple #1
0
 def __init__(self, address):
     if address != const.NULL_PTR:
         self.ip_object_object = IPCObject(address)
         self.ip_messages = utils.get_8_byte_at(
             address + const.IPCPortOffsets.IP_MSG.value)
         self.data = utils.get_8_byte_at(address +
                                         const.IPCPortOffsets.DATA.value)
         self.kdata = utils.get_8_byte_at(address +
                                          const.IPCPortOffsets.KDATA.value)
         self.kdata2 = utils.get_8_byte_at(
             address + const.IPCPortOffsets.KDATA2.value)
         self.ip_context = utils.get_8_byte_at(
             address + const.IPCPortOffsets.IP_CTXT.value)
         four_byte_data = utils.get_4_byte_at(
             address + const.IPCPortOffsets.IP_SPREQ.value)
         self.ip_sprequests = (four_byte_data & (1 << 0))
         self.ip_spimportant = (four_byte_data & (1 << 1))
         self.ip_impdonation = (four_byte_data & (1 << 2))
         self.ip_tempowner = (four_byte_data & (1 << 3))
         self.ip_guarded = (four_byte_data & (1 << 4))
         self.ip_strict_guard = (four_byte_data & (1 << 5))
         self.ip_specialreply = (four_byte_data & (1 << 6))
         self.ip_sync_link_state = (four_byte_data & (0x000001ff))
         self.ip_impcount = (four_byte_data & (0xfffffe00))
         self.ip_mscount = utils.get_4_byte_at(
             address + const.IPCPortOffsets.IP_MSCNT.value)
         self.ip_srights = utils.get_4_byte_at(
             address + const.IPCPortOffsets.IP_SRIGHTS.value)
         self.ip_sorights = utils.get_4_byte_at(
             address + const.IPCPortOffsets.IP_SORIGHTS.value)
Exemple #2
0
 def __init__(self, address):
     if address != const.NULL_PTR:
         self.is_table = utils.get_8_byte_at(
             address + const.IPCSpaceOffsets.IS_TABLE.value)
         self.is_table_size = utils.get_4_byte_at(
             address + const.IPCSpaceOffsets.IS_TABLE_SIZE.value)
         self.is_table_free = utils.get_4_byte_at(
             address + const.IPCSpaceOffsets.IS_TABLE_FREE.value)
     else:
         raise gdb.GdbError(f"Null pointer for {__name__}")
 def __init__(self, address):
     if address != const.NULL_PTR:
         self.is_table = utils.get_8_byte_at(
             address + const.IPCSpaceOffsets.IS_TABLE.value)
         self.is_table_size = utils.get_4_byte_at(
             address + const.IPCSpaceOffsets.IS_TABLE_SIZE.value)
         self.is_table_free = utils.get_4_byte_at(
             address + const.IPCSpaceOffsets.IS_TABLE_FREE.value)
         self.initialized = True
     else:
         self.initialized = False
Exemple #4
0
 def __init__(self, address):
     if address != const.NULL_PTR:
         self.io_bits = utils.get_4_byte_at(
             address)  # parse it from ipc_object
         self.io_references = utils.get_4_byte_at(
             address + const.IPCObjectOffsets.IO_REFS.value)
         self.io_lock_data_1 = utils.get_8_byte_at(
             address + const.IPCObjectOffsets.IO_LOCK_DATA.value)
         self.io_lock_data_2 = utils.get_8_byte_at(
             address + const.IPCObjectOffsets.IO_LOCK_DATA.value +
             0x08)  # next
     else:
         raise gdb.GdbError(f"Wrong pointer to IPC Object {address}")
 def __init__(self, address):
     if address != const.NULL_PTR:
         self.io_bits = utils.get_4_byte_at(
             address)  # parse it from ipc_object
         self.io_references = utils.get_4_byte_at(
             address + const.IPCObjectOffsets.IO_REFS.value)
         self.io_lock_data_1 = utils.get_8_byte_at(
             address + const.IPCObjectOffsets.IO_LOCK_DATA.value)
         self.io_lock_data_2 = utils.get_8_byte_at(
             address + const.IPCObjectOffsets.IO_LOCK_DATA.value +
             0x08)  # next
         self.initialized = True
     else:
         self.initialized = False
Exemple #6
0
    def __init__(self, address):
        if address != const.NULL_PTR:
            self.address = address
            self.ie_object = utils.get_8_byte_at(address)
            self.ie_bits = utils.get_4_byte_at(
                address + const.IPCEntryOffsets.IE_BITS.value)
            self.ie_index = utils.get_4_byte_at(
                address + const.IPCEntryOffsets.IE_INDEX.value)
            self.index = utils.get_4_byte_at(address +
                                             const.IPCEntryOffsets.INDEX.value)

            if self.ie_object:
                self.ie_object_object = IPCObject(self.ie_object)
        else:
            raise gdb.GdbError(f"Wrong pointer to IPC Entry {address}")
Exemple #7
0
 def print_zones(self):
     zone_arr_addr = StructZone.get_zone_array()
     max_zones_addr = StructZone.get_max_zones()
     max_zones = utils.get_4_byte_at(max_zones_addr)
     struct_size = StructZone.get_struct_size()
     out = "Printing zones info:\n"
     out += f"zone_arr_addr: 0x{zone_arr_addr:016x}\n"
     out += f"max_zones: {max_zones}\n"
     gdb.write(out)
     for i in range(max_zones):
         zone_addr = zone_arr_addr + (struct_size * i)
         zone = StructZone(zone_addr)
         if (not zone.is_valid()):
             continue
         out = f"Valid zone at 0x{zone_addr:016x} at index {i}\n"
         out += f"        zone_name: {zone.zone_name}\n"
         out += f"        elem_size: {zone.elem_size}\n"
         out += f"        index: {zone.index}\n"
         out += f"        flags: 0x{zone.flags:08x}\n"
         out += f"        sum_count: {zone.sum_count}\n"
         out += f"        page_count: {zone.page_count}\n"
         out += f"        alloc_size: 0x{zone.alloc_size:016x}\n"
         out += f"        max_size: 0x{zone.max_size:016x}\n"
         out += f"        cur_size: 0x{zone.cur_size:016x}\n"
         gdb.write(out)
    def __init__(self, address):
        if address != const.NULL_PTR:
            self.address = address
            self.ie_object = utils.get_8_byte_at(address)
            self.ie_bits = utils.get_4_byte_at(
                address + const.IPCEntryOffsets.IE_BITS.value)
            self.ie_index = utils.get_4_byte_at(
                address + const.IPCEntryOffsets.IE_INDEX.value)
            self.index = utils.get_4_byte_at(address +
                                             const.IPCEntryOffsets.INDEX.value)

            if self.ie_object:
                self.ie_object_object = IPCObject(self.ie_object)
            self.initialized = True
        else:
            self.initialized = False
Exemple #9
0
 def __init__(self, addr):
     # TODO: support more versions
     self.offsets = StructZone.struct_offsets_16B92
     self.globals = StructZone.zone_globals_16B92
     self.addr = addr
     self.cur_size = utils.get_8_byte_at(addr + self.offsets["cur_size"])
     self.max_size = utils.get_8_byte_at(addr + self.offsets["max_size"])
     self.elem_size = utils.get_8_byte_at(addr + self.offsets["elem_size"])
     self.alloc_size = utils.get_8_byte_at(addr +
                                           self.offsets["alloc_size"])
     self.page_count = utils.get_8_byte_at(addr +
                                           self.offsets["page_count"])
     self.sum_count = utils.get_8_byte_at(addr + self.offsets["sum_count"])
     self.flags = utils.get_4_byte_at(addr + self.offsets["flags"])
     self.index = utils.get_4_byte_at(addr + self.offsets["index"])
     name_ptr = utils.get_8_byte_at(addr + self.offsets["zone_name"])
     self.zone_name = utils.get_string_at(name_ptr)
Exemple #10
0
 def __init__(self, address):
     if address != const.NULL_PTR:
         self.bsd_pid = utils.get_4_byte_at(
             address + const.BSDInfoOffsets.PID_IN_BSD_INFO.value)
         self.bsd_name = utils.get_string_at(
             address + const.BSDInfoOffsets.NAME_INBSD_INFO.value)
     else:
         raise gdb.GdbError(f"Null pointer in {__name__}")
    def __init__(self, address):
        if address != const.NULL_PTR:
            address += 0x08  # skip arm_state_hdr_t ash at arm_saved_state
            self._x0 = utils.get_8_byte_at(address)
            self._x1 = utils.get_8_byte_at(address + 0x08)
            self._x2 = utils.get_8_byte_at(address + 0x10)
            self._x3 = utils.get_8_byte_at(address + 0x18)
            self._x4 = utils.get_8_byte_at(address + 0x20)
            self._x5 = utils.get_8_byte_at(address + 0x28)
            self._x6 = utils.get_8_byte_at(address + 0x30)
            self._x7 = utils.get_8_byte_at(address + 0x38)
            self._x8 = utils.get_8_byte_at(address + 0x40)
            self._x9 = utils.get_8_byte_at(address + 0x48)
            self._x10 = utils.get_8_byte_at(address + 0x50)
            self._x11 = utils.get_8_byte_at(address + 0x58)
            self._x12 = utils.get_8_byte_at(address + 0x60)
            self._x13 = utils.get_8_byte_at(address + 0x68)
            self._x14 = utils.get_8_byte_at(address + 0x70)
            self._x15 = utils.get_8_byte_at(address + 0x78)
            self._x16 = utils.get_8_byte_at(address + 0x80)
            self._x17 = utils.get_8_byte_at(address + 0x88)
            self._x18 = utils.get_8_byte_at(address + 0x90)
            self._x19 = utils.get_8_byte_at(address + 0x98)
            self._x20 = utils.get_8_byte_at(address + 0xa0)
            self._x21 = utils.get_8_byte_at(address + 0xa8)
            self._x22 = utils.get_8_byte_at(address + 0xb0)
            self._x23 = utils.get_8_byte_at(address + 0xb8)
            self._x24 = utils.get_8_byte_at(address + 0xc0)
            self._x25 = utils.get_8_byte_at(address + 0xc8)
            self._x26 = utils.get_8_byte_at(address + 0xd0)
            self._x27 = utils.get_8_byte_at(address + 0xd8)
            self._x28 = utils.get_8_byte_at(address + 0xe0)
            self._fp = utils.get_8_byte_at(address + 0xe8)
            self._lr = utils.get_8_byte_at(address + 0xf0)
            self.sp = utils.get_8_byte_at(address + 0xf8)
            self.pc = utils.get_8_byte_at(address + 0x100)
            self._cpsr = utils.get_4_byte_at(address + 0x108)
            self._reserved = utils.get_4_byte_at(address + 0x10c)
            self._far = utils.get_8_byte_at(address + 0x110)
            self._esr = utils.get_4_byte_at(address + 0x118)
            self._exception = utils.get_4_byte_at(address + 0x11c)

            self.initialized = True
        else:
            self.initialized = False
 def __init__(self, address):
     if address != const.NULL_PTR:
         self.bsd_pid = utils.get_4_byte_at(
             address + const.BSDInfoOffsets.PID_IN_BSD_INFO.value)
         self.bsd_name = utils.get_string_at(
             address + const.BSDInfoOffsets.NAME_INBSD_INFO.value)
         self.initialized = True
     else:
         self.initialized = False