Package rekall :: Package plugins :: Package windows :: Package malware :: Module impscan :: Class ImpScan
[frames] | no frames]

Class ImpScan

source code


Scan for calls to imported functions.

Nested Classes
  __metaclass__
Automatic Plugin Registration through metaclasses. (Inherited from rekall.plugin.Command)
  top_level_class
A command can be run from the rekall command line. (Inherited from rekall.plugin.Command)
Instance Methods
 
__init__(self, base=None, size=None, kernel=None, **kwargs)
Scans the imports from a module.
source code
 
call_scan(self, addr_space, base_address, size_to_read)
Locate calls in a block of code.
source code
 
find_process_imports(self, task) source code
 
find_kernel_import(self) source code
 
render(self, renderer)
Produce results on the renderer given.
source code
 
__iter__(self)
Make plugins that define collect iterable, as convenience. (Inherited from rekall.plugin.Command)
source code
 
__repr__(self)
repr(x) (Inherited from rekall.plugin.Command)
source code
 
__str__(self)
Render into a string using the text renderer. (Inherited from rekall.plugin.Command)
source code
 
collect(self)
Collect data that will be passed to renderer.table_row. (Inherited from rekall.plugin.TypedProfileCommand)
source code
 
collect_as_dicts(self) (Inherited from rekall.plugin.TypedProfileCommand) source code
 
column_types(self)
Returns instances for each column definition. (Inherited from rekall.plugin.TypedProfileCommand)
source code
 
filter_processes(self)
Filters eprocess list using pids lists. (Inherited from rekall.plugins.windows.common.WinProcessFilter)
source code
 
get_column(self, name) (Inherited from rekall.plugin.TypedProfileCommand) source code
 
get_column_type(self, name) (Inherited from rekall.plugin.TypedProfileCommand) source code
 
get_plugin(self, name, **kwargs)
Returns an instance of the named plugin. (Inherited from rekall.plugin.Command)
source code
 
getkeys(self) (Inherited from rekall.plugin.TypedProfileCommand) source code
 
list_eprocess(self)
List processes using chosen methods. (Inherited from rekall.plugins.windows.common.WinProcessFilter)
source code
 
list_from_eprocess(self) (Inherited from rekall.plugins.windows.common.WinProcessFilter) source code
 
reflect(self, member) (Inherited from rekall.plugin.TypedProfileCommand) source code
 
virtual_process_from_physical_offset(self, physical_offset)
Tries to return an eprocess in virtual space from a physical offset. (Inherited from rekall.plugins.windows.common.WinProcessFilter)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods
 
args(cls, parser)
Declare the command line args we need.
source code
 
GetActiveClasses(cls, session)
Return only the active commands based on config. (Inherited from rekall.plugin.Command)
source code
 
GetPrototype(cls, session)
Return an instance of this plugin with suitable default arguments. (Inherited from rekall.plugin.Command)
source code
 
ImplementationByClass(self, name) source code
 
ImplementationByName(self, name) source code
 
is_active(cls, session)
Checks we are active. (Inherited from rekall.plugin.ProfileCommand)
source code
Class Variables
  FORWARDED_IMPORTS = {'RtlAllocateHeap': 'kernel32.dll!HeapAllo...
  CALL_RULE = {'mnemonic': 'CALL', 'operands': [{'address': '$ad...
  JMP_RULE = {'mnemonic': 'JMP', 'operands': [{'address': '$addr...
  METHODS = ['PsActiveProcessHead', 'CSRSS', 'PspCidTable', 'Ses... (Inherited from rekall.plugins.windows.common.WinProcessFilter)
  PHYSICAL_AS_REQUIRED = True (Inherited from rekall.plugin.PhysicalASMixin)
  PROFILE_REQUIRED = True (Inherited from rekall.plugin.ProfileCommand)
  ROW_OPTIONS = set(['annotation', 'depth', 'hex_width', 'highli... (Inherited from rekall.plugin.TypedProfileCommand)
  classes = {'AFF4Acquire': <class 'rekall.plugins.tools.aff4acq... (Inherited from rekall.plugin.Command)
  classes_by_name = {None: [<class 'rekall.plugins.tools.ipython... (Inherited from rekall.plugin.Command)
  error_status = None
hash(x) (Inherited from rekall.plugin.Command)
  interactive = False (Inherited from rekall.plugin.Command)
  mode = 'mode_windows_memory'
hash(x) (Inherited from rekall.plugins.windows.common.AbstractWindowsCommandPlugin)
  plugin_args = None
hash(x) (Inherited from rekall.plugin.ArgsParserMixin)
  plugin_feature = 'Command' (Inherited from rekall.plugin.Command)
  producer = False (Inherited from rekall.plugin.Command)
  table_header = None
hash(x) (Inherited from rekall.plugin.TypedProfileCommand)
  table_options = {} (Inherited from rekall.plugin.TypedProfileCommand)
Properties
  filtering_requested (Inherited from rekall.plugins.windows.common.WinProcessFilter)
  name (Inherited from rekall.plugin.Command)

Inherited from object: __class__

Method Details

args(cls, parser)
Class Method

source code 

Declare the command line args we need.

Overrides: plugin.Command.args

__init__(self, base=None, size=None, kernel=None, **kwargs)
(Constructor)

source code 
Scans the imports from a module.

Often when dumping a PE executable from memory the import address tables
are over written. This makes it hard to resolve function names when
disassembling the binary.

This plugin enumerates all dlls in the process address space and
examines their export address tables. It then disassembles the
executable code for calls to external functions. We attempt to resolve
the names of the calls using the known exported functions we gathered in
step 1.

This technique can be used for a process, or the kernel itself. In the
former case, we examine dlls, while in the later case we examine kernel
modules using the modules plugin.

Args:

  base: Start disassembling at this address - this is normally the base
    address of the dll or module we care about. If omitted we use the
    kernel base (if in kernel mode) or the main executable (if in
    process mode).

  size: Disassemble this many bytes from the address space. If omitted
    we use the module which starts at base.

  kernel: The mode to use. If set, we operate in kernel mode.

Overrides: object.__init__

call_scan(self, addr_space, base_address, size_to_read)

source code 

Locate calls in a block of code.

Disassemble a block of data and yield possible calls to imported functions. We're looking for instructions such as these:

x86: CALL DWORD [0x1000400] JMP DWORD [0x1000400]

x64: CALL QWORD [RIP+0x989d]

On x86, the 0x1000400 address is an entry in the IAT or call table. It stores a DWORD which is the location of the API function being called.

On x64, the 0x989d is a relative offset from the current instruction (RIP).

So we simply disassemble the entire code section of the executable looking for calls, then we collect all the targets of the calls.

Parameters:
  • addr_space - an AS to scan with
  • base_address - memory base address
  • data - buffer of data found at base_address

render(self, renderer)

source code 
Produce results on the renderer given.

Each plugin should implement this method to produce output on the
renderer. The framework will initialize the plugin and provide it with
some kind of renderer to write output on. The plugin should not assume
that the renderer is actually TextRenderer, only that the methods
defined in the BaseRenderer exist.

Args:
  renderer: A renderer based at rekall.ui.renderer.BaseRenderer.

Overrides: plugin.Command.render
(inherited documentation)

ImplementationByClass(self, name)
Class Method

source code 
Overrides: plugin.Command.ImplementationByClass

ImplementationByName(self, name)
Class Method

source code 
Overrides: plugin.Command.ImplementationByName

Class Variable Details

FORWARDED_IMPORTS

Value:
{'RtlAllocateHeap': 'kernel32.dll!HeapAlloc',
 'RtlDeleteCriticalSection': 'kernel32.dll!DeleteCriticalSection',
 'RtlEnterCriticalSection': 'kernel32.dll!EnterCriticalSection',
 'RtlFreeHeap': 'kernel32.dll!HeapFree',
 'RtlGetLastWin32Error': 'kernel32.dll!GetLastError',
 'RtlLeaveCriticalSection': 'kernel32.dll!LeaveCriticalSection',
 'RtlReAllocateHeap': 'kernel32.dll!HeapReAlloc',
 'RtlRestoreLastWin32Error': 'kernel32.dll!SetLastError',
...

CALL_RULE

Value:
{'mnemonic': 'CALL',
 'operands': [{'address': '$address',
               'target': '$target',
               'type': 'MEM'}]}

JMP_RULE

Value:
{'mnemonic': 'JMP',
 'operands': [{'address': '$address',
               'target': '$target',
               'type': 'MEM'}]}