From 27e48f8d5b9ab4508abc81cea302cf2d718e8b6b Mon Sep 17 00:00:00 2001 From: Nicolas Kruse Date: Wed, 2 Apr 2025 21:46:18 +0200 Subject: [PATCH] .data_hex properties fixed --- src/pelfy/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pelfy/__init__.py b/src/pelfy/__init__.py index 874bc8a..9df2940 100644 --- a/src/pelfy/__init__.py +++ b/src/pelfy/__init__.py @@ -82,7 +82,7 @@ class elf_symbol(): def data_hex(self) -> str: """Returns the binary data the symbol is pointing to as hex string. """ - return ' '.join(f'{d:02X}' for d in self.read_data()) + return ' '.join(f'{d:02X}' for d in self.data) @property def relocations(self) -> 'relocation_list': @@ -170,8 +170,7 @@ class elf_section(): def data_hex(self) -> str: """Returns the binary data from the section as hex string. """ - data = self.file.read_bytes(self['sh_offset'], self['sh_size']) - return ' '.join(f'{d:02X}' for d in data) + return ' '.join(f'{d:02X}' for d in self.data) def __getitem__(self, key: str | int) -> int: if isinstance(key, str):