diff options
| author | serpilliere <devnull@localhost> | 2012-12-17 22:58:40 +0100 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2012-12-17 22:58:40 +0100 |
| commit | 04356144a51fc007998f03aeca95e7d34b0db8a0 (patch) | |
| tree | fc7f9a753861a6ffea4b7f1015254f8834187fba | |
| parent | c2c6d796c11bddf96d45fac97438b4e2279ac684 (diff) | |
| download | miasm-04356144a51fc007998f03aeca95e7d34b0db8a0.tar.gz miasm-04356144a51fc007998f03aeca95e7d34b0db8a0.zip | |
pe_helper: add get_sectioname
| -rw-r--r-- | miasm/tools/pe_helper.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/miasm/tools/pe_helper.py b/miasm/tools/pe_helper.py index 9c600165..f8955eb1 100644 --- a/miasm/tools/pe_helper.py +++ b/miasm/tools/pe_helper.py @@ -79,6 +79,16 @@ def func_from_import(pe_name, func): return e, found +def get_sectionname(e, offset): + section = e.getsectionbyvad(offset) + if section == None: + return None + if isinstance(e, elf_init.ELF): + return section.sh.name + elif isinstance(e, pe_init.PE): + return section.name + else: + raise ValueError("TODO") def is_rva_in_code_section(e, rva): s = e.getsectionbyrva(rva) |