diff options
| author | Peter LaFosse <peter@vector35.com> | 2021-10-11 17:02:19 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2021-10-11 17:02:19 -0400 |
| commit | 6d5e5927b93954c579c027a2b7d3cd1885db95a7 (patch) | |
| tree | 97c2e06bd4caba5aad939654c63f9bcf53c01225 /python/binaryview.py | |
| parent | f170d865f9939b18f90c849edd84e8fb5178790e (diff) | |
Allow get_functions_by_name to get functions which start with 'sub_'
Diffstat (limited to 'python/binaryview.py')
| -rw-r--r-- | python/binaryview.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index d13f7506..65a005b7 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -3550,8 +3550,8 @@ class BinaryView: :rtype: list(Function) :Example: - >>> bv.get_function_by_name("main") - <func: x86_64@0x1587> + >>> bv.get_functions_by_name("main") + [<func: x86_64@0x1587>] >>> """ if ordered_filter == []: @@ -3561,8 +3561,11 @@ class BinaryView: if plat == None: plat = self.platform fns = [] - for sym in self.get_symbols_by_name(name, ordered_filter=ordered_filter): - for fn in self.get_functions_at(sym.address): + addresses = [sym.address for sym in self.get_symbols_by_name(name, ordered_filter=ordered_filter)] + if len(addresses) == 0 and name.startswith("sub_"): + addresses = [int(name[4:], 16)] + for address in addresses: + for fn in self.get_functions_at(address): if fn.platform == plat: fns.append(fn) return fns |
