class Binary(object):
Light modelisation of a binary file.
It provides useful information such as the guest filesytem path or the list of available symbols.
Must not be directly constructed but retrieved through the following examples. Using an instance of Binary
directly constructed could lead to an AssertionError
.
>>> # From a Transition >>> transition.context_before().ossi.location().binary # from the context before the transition >>> transition.context_after().ossi.location().binary # from the context after the transition
>>> # From a Context >>> context.location().binary
>>> # From a Symbol >>> symbol.binary
Method | __init__ |
Undocumented |
Property | path |
Property: The path to the binary in the guest filesystem. |
Property | filename |
Property: The filename of the binary (including the extension). |
Property | name |
Property: The filename of the binary without the extension. |
Method | symbols |
Get a generator over symbols of the binary. |
Method | __str__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __eq__ |
Undocumented |
Method | __ne__ |
Undocumented |
Instance Variable | _datasource |
Undocumented |
Instance Variable | _id |
Undocumented |
Property: The path to the binary in the guest filesystem.
Using / as file separator.
>>> binary.path 'c:/windows/system32/ntoskrnl.exe'
Returns | A string . |
Property: The filename of the binary (including the extension).
>>> binary.path 'c:/windows/system32/ntoskrnl.exe' >>> binary.filename 'ntoskrnl.exe'
Returns | A string . |
Property: The filename of the binary without the extension.
>>> binary.path 'c:/windows/system32/ntoskrnl.exe' >>> binary.name 'ntoskrnl'
Returns | A string . |
Get a generator over symbols of the binary.
Symbols can be filtered by their name:
They are fetched from the binary file itself and its related debug file, if any.
It depends on the OSSI feature. If unavailable, an exception will be raised.
If the binary file is not accessible from the provided filesystem, no symbols will be returned.
>>> for symbol in binary.symbols(): >>> print(symbol) 'toto' 'tata'
>>> for symbol in binary.symbols('toto'): >>> print(symbol) 'toto'
Parameters | pattern | a regular expression used to compare symbols. |
case_sensitive | Whether the symbols comparison is case sensitive or not. | |
Returns | A generator on the binary's Symbol s . | |
Raises | RuntimeError | if OSSI feature is unavailable. |