diff options
| author | Jon Palmisciano <jp@jonpalmisc.com> | 2021-06-02 16:38:01 -0400 |
|---|---|---|
| committer | Jon Palmisciano <jp@jonpalmisc.com> | 2021-06-12 12:57:02 -0400 |
| commit | c36c2f555fae8b5a707193e8d5a0d0a0697e9451 (patch) | |
| tree | deb4a06ce97a2a552cf66af1ee2d87a769636bfa /python | |
| parent | 38563222ee1c4ae4b5e9287277f04ec3cb4bd896 (diff) | |
Function: Added `BNGetFunctionILVariables()` / `get_il_vars()` method
Diffstat (limited to 'python')
| -rw-r--r-- | python/function.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/python/function.py b/python/function.py index 0ec6142d..b350046f 100644 --- a/python/function.py +++ b/python/function.py @@ -25,6 +25,7 @@ import traceback import ctypes import numbers import string +from typing import List # Binary Ninja components import binaryninja @@ -1934,6 +1935,23 @@ class Function(object): core.BNFreeVariableNameAndTypeList(v, count.value) return result + def get_il_vars(self, il_type: FunctionGraphType) -> List[Variable]: + """ + Get a (read-only) list of the variables used in the given IL. Only + accepts ``MediumLevelILFunctionGraph`` or ``HighLevelILFunctionGraph`` + for ``il_type``, otherwise nothing will be returned. + """ + + count = ctypes.c_ulonglong() + v = core.BNGetFunctionILVariables(self.handle, il_type, count) + + result = [] + for i in range(0, count.value): + result.append(Variable(self, v[i].type, v[i].index, v[i].storage)) + + core.BNFreeVariableList(v, count.value) + return result + @property def indirect_branches(self): """List of indirect branches (read-only)""" |
