1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 __author__ = "Michael Cohen <scudette@google.com>"
24
25 import os
26 import site
27
28 from rekall import constants
29 from rekall import plugin
30 from rekall import kb
31 from rekall import testlib
32 from rekall.plugins import core
33 from rekall.ui import text as text_renderer
34
35 try:
36 from rekall import ipython_support
37 except ImportError:
38 ipython_support = None
42 """Launch the ipython session for post 0.12 versions.
43
44 Returns:
45 False if we failed to use IPython. True if the session was run and exited.
46 """
47 if ipython_support:
48
49
50 user_session.PrepareLocalNamespace()
51
52 return ipython_support.Shell(user_session)
53
56 """Launch the rekall session using the native python interpreter.
57
58 Returns:
59 False if we failed to use IPython. True if the session was run and exited.
60 """
61
62 import code
63
64
65 try:
66 import rlcompleter, readline
67 readline.parse_and_bind("tab: complete")
68 except ImportError:
69 pass
70
71
72 user_session.PrepareLocalNamespace()
73 code.interact(banner=constants.BANNER, local=user_session.locals)
74
77 """Base class for all session management plugins."""
78 interactive = True
79
80 @classmethod
81 - def args(cls, parser):
86
87 - def __init__(self, session_id=None, **kwargs):
92
95 """List the sessions available."""
96 __name = "slist"
97
103
106 """Changes the current session to the session with session_id."""
107 __name = "sswitch"
108
115
118 """Creates a new session by cloning the current one."""
119 __name = "snew"
120
129
132 """Delete a session."""
133 __name = "sdel"
134
143
146 """Modifies parameters of the current analysis session.
147
148 Any session parameters can be set here. For example:
149
150 smod colors="no", paging_limit=10, pager="less"
151
152 """
153 __name = "smod"
154
155 interactive = True
156
157 @classmethod
158 - def args(cls, parser):
159 super(SessionMod, cls).args(parser)
160
161 parser.add_argument("--filename",
162 help="The name of the image file to analyze.")
163
164 parser.add_argument("--profile", default=None,
165 help="The name of the profile to load.")
166
167 parser.add_argument("--pager", default=None,
168 help="The name of a program to page output "
169 "(e.g. notepad or less).")
170
174
181
188 """A More useful default help function."""
189 HELP_MESSAGE = """Welocome to Rekall Memory Forensics.
190
191 To get started:
192
193 - Initialize the Rekall session using the rekall plugin. e.g.:
194
195 Win7SP1x64:pmem 13:36:23> rekall filename=r"\\\\.\\pmem", profile="Win7SP1x64", pager="notepad"
196
197 - Select a plugin to run by tying it in. e.g.:
198
199 Win7SP1x64:pmem 13:39:26> plugins.pslist
200
201 - You can complete any command by tapping Tab twice. Useful completions include:
202 - File names on disk.
203 - Plugin names.
204 - Plugin parameters.
205
206 - Adding a ? after any plugin will print help about this plugin.
207
208 - You can get help on any module or object by typing:
209
210 help object
211
212 Some interesting topics to get you started, explaining some rekall specific
213 concepts:
214
215 help addrspace - The address space.
216 help obj - The rekall objects.
217 help profile - What are Profiles?
218 """
219
220 - def __call__(self, item=None, **kwargs):
225
226 site._Helper = RekallHelper
230 """If no paging_limit specified, calculate it from cursors."""
231 name = "paging_limit"
232
234 if text_renderer.curses:
235 return text_renderer.curses.tigetnum("lines")
236
237 return int(os.environ.get("ROWS", 50))
238
258
262