dynamic_string(offset) -> bytes Fetches an enumerated string from the ``DT_STRTAB`` table. Arguments: offset(int): String index Returns: :class:`str`: String from the table as raw bytes.
(self, offset)
| 1664 | return tag.entry.d_val |
| 1665 | |
| 1666 | def dynamic_string(self, offset): |
| 1667 | """dynamic_string(offset) -> bytes |
| 1668 | |
| 1669 | Fetches an enumerated string from the ``DT_STRTAB`` table. |
| 1670 | |
| 1671 | Arguments: |
| 1672 | offset(int): String index |
| 1673 | |
| 1674 | Returns: |
| 1675 | :class:`str`: String from the table as raw bytes. |
| 1676 | """ |
| 1677 | dt_strtab = self.dynamic_by_tag('DT_STRTAB') |
| 1678 | |
| 1679 | if not dt_strtab: |
| 1680 | return None |
| 1681 | |
| 1682 | address = dt_strtab.entry.d_ptr + offset |
| 1683 | string = b'' |
| 1684 | while b'\x00' not in string: |
| 1685 | string += self.read(address, 1) |
| 1686 | address += 1 |
| 1687 | return string.rstrip(b'\x00') |
| 1688 | |
| 1689 | |
| 1690 |
no test coverage detected