/usr/lib/python2.7/dist-packages/rekall/interactive.py is in python-rekall-core 1.6.0+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import inspect
from rekall import ipython_support
# Load all the plugins to register them.
from rekall import plugins # pylint: disable=unused-import
from rekall import utils
from rekall import session
IPython = utils.ConditionalImport("IPython")
def ImportEnvironment(**kwargs):
"""Initialize a caller's environment.
Creates a new interactive environment and installs it into the caller's
local namespace. After this call the usual rekall interactive environment
will be added in the caller's local namespace.
For example:
from rekall import interactive
interactive.ImportEnvironment()
# Update the filename, load profile etc.
rekal filename="xpimage.dd"
# Run the pslist command rendering to stdout.
print pslist()
"""
isession = session.InteractiveSession(use_config_file=True, **kwargs)
stack = inspect.stack()
# pylint: disable=protected-access
isession._locals = stack[1][0].f_locals
isession._prepare_local_namespace()
# For IPython fix up the completion.
try:
shell = IPython.get_ipython()
if shell:
shell.Completer.matchers.insert(
0,
lambda x: ipython_support.RekallCompleter(shell.Completer, x))
shell.Completer.merge_completions = False
except Exception as e:
print(e)
return isession
|