diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/commonil.py | 7 | ||||
| -rw-r--r-- | python/highlevelil.py | 6 | ||||
| -rw-r--r-- | python/lowlevelil.py | 18 | ||||
| -rw-r--r-- | python/mediumlevelil.py | 22 | ||||
| -rw-r--r-- | python/types.py | 4 | ||||
| -rw-r--r-- | python/variable.py | 2 |
6 files changed, 36 insertions, 23 deletions
diff --git a/python/commonil.py b/python/commonil.py index 35884bf1..9e9f6fea 100644 --- a/python/commonil.py +++ b/python/commonil.py @@ -115,7 +115,12 @@ class Syscall(Call): @dataclass(frozen=True, repr=False, eq=False) -class Tailcall(Call): +class Localcall(Call): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class Tailcall(Localcall): pass @dataclass(frozen=True, repr=False, eq=False) diff --git a/python/highlevelil.py b/python/highlevelil.py index f98ecaf4..b813c2ec 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -38,7 +38,7 @@ from . import highlight from . import flowgraph from . import variable from .interaction import show_graph_report -from .commonil import (BaseILInstruction, Call, Tailcall, Syscall, Comparison, Signed, UnaryOperation, BinaryOperation, +from .commonil import (BaseILInstruction, Tailcall, Syscall, Localcall, Comparison, Signed, UnaryOperation, BinaryOperation, SSA, Phi, Loop, ControlFlow, Memory, Constant, Arithmetic, DoublePrecision, Terminal, FloatingPoint) @@ -1585,7 +1585,7 @@ class HighLevelILLowPart(HighLevelILUnaryBase, Arithmetic): @dataclass(frozen=True, repr=False, eq=False) -class HighLevelILCall(HighLevelILInstruction, Call): +class HighLevelILCall(HighLevelILInstruction, Localcall): @property def dest(self) -> HighLevelILInstruction: @@ -1601,7 +1601,7 @@ class HighLevelILCall(HighLevelILInstruction, Call): @dataclass(frozen=True, repr=False, eq=False) -class HighLevelILCallSsa(HighLevelILInstruction, Call, SSA): +class HighLevelILCallSsa(HighLevelILInstruction, Localcall, SSA): @property def dest(self) -> HighLevelILInstruction: diff --git a/python/lowlevelil.py b/python/lowlevelil.py index cda851d0..e255b431 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -36,8 +36,8 @@ from . import binaryview from . import architecture from . import types from .interaction import show_graph_report -from .commonil import (BaseILInstruction, Constant, BinaryOperation, UnaryOperation, Comparison, SSA, - Phi, FloatingPoint, ControlFlow, Terminal, Call, StackOperation, Return, +from .commonil import (BaseILInstruction, Constant, BinaryOperation, Tailcall, UnaryOperation, Comparison, SSA, + Phi, FloatingPoint, ControlFlow, Terminal, Syscall, Localcall, StackOperation, Return, Signed, Arithmetic, Carry, DoublePrecision, Memory, Load, Store, RegisterStack, SetReg) ExpressionIndex = NewType('ExpressionIndex', int) @@ -1076,7 +1076,7 @@ class LowLevelILNoret(LowLevelILInstruction, Terminal): @dataclass(frozen=True, repr=False, eq=False) -class LowLevelILSyscall(LowLevelILInstruction, Call): +class LowLevelILSyscall(LowLevelILInstruction, Syscall): pass @@ -1133,7 +1133,7 @@ class LowLevelILJump(LowLevelILInstruction, Terminal): @dataclass(frozen=True, repr=False, eq=False) -class LowLevelILCall(LowLevelILInstruction, Call): +class LowLevelILCall(LowLevelILInstruction, Localcall): @property def dest(self) -> LowLevelILInstruction: @@ -1145,7 +1145,7 @@ class LowLevelILCall(LowLevelILInstruction, Call): @dataclass(frozen=True, repr=False, eq=False) -class LowLevelILTailcall(LowLevelILInstruction, Call): +class LowLevelILTailcall(LowLevelILInstruction, Tailcall): @property def dest(self) -> LowLevelILInstruction: @@ -2192,7 +2192,7 @@ class LowLevelILRrc(LowLevelILCarryBase): @dataclass(frozen=True, repr=False, eq=False) -class LowLevelILCallStackAdjust(LowLevelILInstruction, Call): +class LowLevelILCallStackAdjust(LowLevelILInstruction, Localcall): @property def dest(self) -> LowLevelILInstruction: @@ -2371,7 +2371,7 @@ class LowLevelILRegStackFreeRelSsa(LowLevelILInstruction, RegisterStack, SSA): @dataclass(frozen=True, repr=False, eq=False) -class LowLevelILSyscallSsa(LowLevelILInstruction, Call, SSA): +class LowLevelILSyscallSsa(LowLevelILInstruction, Syscall, SSA): @property def output(self) -> LowLevelILInstruction: @@ -2415,7 +2415,7 @@ class LowLevelILSetRegStackRelSsa(LowLevelILInstruction, RegisterStack, SSA): @dataclass(frozen=True, repr=False, eq=False) -class LowLevelILCallSsa(LowLevelILInstruction, Call, SSA): +class LowLevelILCallSsa(LowLevelILInstruction, Localcall, SSA): @property def output(self) -> LowLevelILInstruction: @@ -2439,7 +2439,7 @@ class LowLevelILCallSsa(LowLevelILInstruction, Call, SSA): @dataclass(frozen=True, repr=False, eq=False) -class LowLevelILTailcallSsa(LowLevelILInstruction, Call, SSA, Terminal): +class LowLevelILTailcallSsa(LowLevelILInstruction, Tailcall, SSA, Terminal): @property def output(self) -> LowLevelILInstruction: diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index d7903fb2..a1652cd4 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -26,7 +26,7 @@ from dataclasses import dataclass # Binary Ninja components from . import _binaryninjacore as core -from .enums import MediumLevelILOperation, ILBranchDependence, DataFlowQueryOption, FunctionGraphType +from .enums import MediumLevelILOperation, ILBranchDependence, DataFlowQueryOption, FunctionGraphType, DeadStoreElimination from . import basicblock from . import function from . import types @@ -38,7 +38,7 @@ from . import architecture from . import binaryview from .interaction import show_graph_report from .commonil import (BaseILInstruction, Constant, BinaryOperation, UnaryOperation, Comparison, SSA, - Phi, FloatingPoint, ControlFlow, Terminal, Call, Syscall, Tailcall, Return, + Phi, FloatingPoint, ControlFlow, Terminal, Call, Localcall, Syscall, Tailcall, Return, Signed, Arithmetic, Carry, DoublePrecision, Memory, Load, Store, RegisterStack, SetVar) TokenList = List['function.InstructionTextToken'] @@ -77,7 +77,15 @@ class SSAVariable: @property def type(self) -> 'types.Type': return self.var.type - + + @property + def function(self) -> 'function.Function': + return self.var.function + + @property + def dead_store_elimination(self) -> DeadStoreElimination: + return self.var.dead_store_elimination + class MediumLevelILLabel: def __init__(self, handle:Optional[core.BNMediumLevelILLabel]=None): @@ -2115,7 +2123,7 @@ class MediumLevelILRrc(MediumLevelILCarryBase): @dataclass(frozen=True, repr=False, eq=False) -class MediumLevelILCall(MediumLevelILCallBase): +class MediumLevelILCall(MediumLevelILCallBase, Localcall): @property def output(self) -> List[variable.Variable]: @@ -2183,7 +2191,7 @@ class MediumLevelILTailcallUntyped(MediumLevelILCallBase, Tailcall): @dataclass(frozen=True, repr=False, eq=False) -class MediumLevelILCallSsa(MediumLevelILCallBase, SSA): +class MediumLevelILCallSsa(MediumLevelILCallBase, Localcall, SSA): @property def output(self) -> List[SSAVariable]: @@ -2215,7 +2223,7 @@ class MediumLevelILCallSsa(MediumLevelILCallBase, SSA): @dataclass(frozen=True, repr=False, eq=False) -class MediumLevelILCallUntypedSsa(MediumLevelILCallBase, SSA): +class MediumLevelILCallUntypedSsa(MediumLevelILCallBase, Localcall, SSA): @property def output(self) -> List[SSAVariable]: @@ -2365,7 +2373,7 @@ class MediumLevelILStoreSsa(MediumLevelILInstruction, Store, SSA): @dataclass(frozen=True, repr=False, eq=False) -class MediumLevelILCallUntyped(MediumLevelILCallBase): +class MediumLevelILCallUntyped(MediumLevelILCallBase, Localcall): @property def output(self) -> List[variable.Variable]: diff --git a/python/types.py b/python/types.py index 2af6a537..ac5d75f8 100644 --- a/python/types.py +++ b/python/types.py @@ -19,7 +19,7 @@ # IN THE SOFTWARE. import ctypes -from typing import Generator, List, Union, Mapping, Tuple, Optional +from typing import Generator, List, Union, Mapping, Tuple, Optional, Iterable from dataclasses import dataclass import uuid from abc import abstractmethod @@ -36,7 +36,7 @@ from . import binaryview from . import platform as _platform from . import typelibrary -QualifiedNameType = Union[List[str], str, 'QualifiedName', List[bytes]] +QualifiedNameType = Union[Iterable[Union[str, bytes]], str, 'QualifiedName'] BoolWithConfidenceType = Union[bool, 'BoolWithConfidence'] SizeWithConfidenceType = Union[int, 'SizeWithConfidence'] OffsetWithConfidenceType = Union[int, 'OffsetWithConfidence'] diff --git a/python/variable.py b/python/variable.py index a13dbc59..3862d95b 100644 --- a/python/variable.py +++ b/python/variable.py @@ -752,7 +752,7 @@ class Variable(CoreVariable): core.BNFreeILInstructionList(versions) @property - def dead_store_elimination(self): + def dead_store_elimination(self) -> DeadStoreElimination: return DeadStoreElimination(core.BNGetFunctionVariableDeadStoreElimination(self._function.handle, self.to_BNVariable())) @dead_store_elimination.setter |
