class documentation

class TaintResultView(_Generic[_ResultType]):

View In Hierarchy

The abstract class from which any result view is derived.

It contains implementation of all functionalities used by TaintAccessView, TaintStateView and TaintWarningView

Method __init__ Undocumented
Method __repr__ Undocumented
Method all Yields all results in the view
Method available Yields the results that are currently available in the view.
Method filter_by_context_range Filter the result view such that the results are between from_context and to_context.
Method take_n Filter the result view such as to get at most take_n results
Property status Property: the current status of this view instance, with regards to whether results are available to fetch.
Method _compare_context Undocumented
Method _context_from_id Undocumented
Method _data_id Undocumented
Method _data_result Undocumented
Method _result Undocumented
Instance Variable _remaining_result Undocumented
Instance Variable _rvn_taint_query Undocumented
Instance Variable _status Undocumented
Instance Variable _taint_data Undocumented
Instance Variable _trace Undocumented
def __init__(self, trace, taint_data, fetch_count):

Undocumented

Parameters
trace:_TraceUndocumented
taint_data:_TaintDataUndocumented
fetch_count:intUndocumented
def __repr__(self):

Undocumented

def all(self):

Yields all results in the view

Warning

This method is a blocking method, it blocks until all results are available.

If this method is called multiple times on the same view instance, the first call will return all the results, and later calls will not return any result.

Calling this method after calling the available method on the same view instance will only yield the results that were not produced by the previous call to the available method.

Examples

>>> # taint [ds:0xffffd001ea0d6040; 8] in all the trace
>>> taint = tainter.simple_taint("[0xffffd001ea0d6040; 8]")
>>> changes = taint.accesses(changes_only=True)
>>> for change in changes.all():
...     print(change)
Taint change at #20 movaps xmmword ptr [rbp], xmm1
Tainted memories:
[phy:0x1bdb4040; 8] : [tag0,]

Information

Returns
_Iterator[_ResultType]A generator of taint results.
def available(self):

Yields the results that are currently available in the view.

This method won't block even if all results were not produced yet by the taint: it will simply yield the results available to the taint at the time of the call, and then return.

Note that each successive call to this method on the same instance will only yield the results that were produced since the last call.

Examples

>>> # taint [ds:0xfffff658987; 8] in all the trace
>>> taint = tainter.simple_taint("[0xfffff658987; 8]")
>>> changes = taint.accesses(changes_only=True)
>>> for change in changes.available():
...     print(change.transition.id)
21
27
52
>>> for change in changes.available():
...     print(change.transition.id)
87
101
>>> # Note that you can restart iteration by constructing a news changes view
>>> changes = taint.accesses(changes_only=True)
>>> for change in changes.available():
...     print(change.transition.id)
21
27
52
87
101

Information

Returns
_Iterator[_ResultType]A generator of available taint results.
def filter_by_context_range(self, from_context, to_context=None):

Filter the result view such that the results are between from_context and to_context.

If to_context is None then results will be only for from_context

Examples

>>> # taint rax in all the trace
>>> taint = tainter.simple_taint("rax")
>>> # create a change view and filter result between context(100) and context(1000)
>>> changes = taint.accesses(changes_only=True).filter_by_context_range(trace.context_after(100),
...                                                                     trace.context_after(1000))
>>> # create a state view and filter result for context(100) only
>>> states = taint.states().filter_by_context_range(trace.context_after(100))
>>> next(states.all())
TaintState(context=Context before #101)

Warning

Do not call this method on view instances where you already called all or available

Information

Parameters
from_context:_Contextreven2.trace.Context the beginning context
to_context:_Optional[_Context]reven2.trace.Context the ending context
Returns
TaintResultView[_ResultType]self.
def take_n(self, take_n):

Filter the result view such as to get at most take_n results

Warning

Do not call this method on view instances where you already called all or available

Examples

>>> # taint rax in all the trace
>>> taint = tainter.simple_taint("rax")
>>> # create a change view of all results and take only 3 results from them
>>> changes = taint.accesses(changes_only=True).take_n(3)
>>> for change in changes:
...     print(change.transition)
#7 mov qword ptr [rbp - 0x50], rax
#20 movaps xmmword ptr [rbp], xmm1
#27 lea rax, [rip + 0x3120]

Information

Parameters
take_n:intinteger number of requested results
Returns
TaintResultView[_ResultType]self.
@property
status: TaintResultStatus =

Property: the current status of this view instance, with regards to whether results are available to fetch.

Examples

>>> # taint rax in all the trace
>>> taint = tainter.simple_taint("rax")
>>> # create a change view of all results
>>> changes = taint.accesses(changes_only=True)
>>> changes.status
TaintResultStatus.Waiting
>>> for change in changes.all():
...     pass
>>> changes.status
TaintResultStatus.Exhausted

Information

def _compare_context(self, lhs_context, rhs_context):

Undocumented

Parameters
lhs_context:intUndocumented
rhs_context:intUndocumented
Returns
boolUndocumented
def _context_from_id(self, id):

Undocumented

Parameters
id:intUndocumented
Returns
intUndocumented
@_abc.abstractmethod
def _data_id(self, data):

Undocumented

@_abc.abstractmethod
def _data_result(self, data):

Undocumented

Returns
_ResultTypeUndocumented
@_abc.abstractmethod
def _result(self):

Undocumented

_remaining_result =

Undocumented

_rvn_taint_query =

Undocumented

_status =

Undocumented

_taint_data =

Undocumented

_trace =

Undocumented