about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm/tools/pe_helper.py10
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)