1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 """This address space overlays a pagefile into the physical address space.
20
21 This essentially implements the --pagefile parameter. Note that for images taken
22 with winpmem there is no need to specify the pagefile specifically since it is
23 already detected by the Elf64CoreDump class.
24 """
25
26 __author__ = "Michael Cohen <scudette@gmail.com>"
27
28 from rekall import addrspace
29 from rekall import config
30 from rekall import session
31
32
33 config.DeclareOption(
34 "--pagefile", type="ArrayStringParser", default=[],
35 help="A pagefile to load into the image.")
36
37
38 -class PagefilePhysicalAddressSpace(addrspace.RunBasedAddressSpace):
39 __image = True
40 name = "pagefile"
41 order = 200
42
43 - def __init__(self, **kwargs):
44 super(PagefilePhysicalAddressSpace, self).__init__(**kwargs)
45 pagefile_names = self.session.GetParameter("pagefile")
46
47 self.as_assert(pagefile_names, "Pagefile not specified")
48 self.as_assert(self.base.__class__ is not self.__class__)
49
50
51 for run in self.base.get_mappings():
52 self.add_run(run.start, run.start, run.length, self.base)
53
54 vaddr = self.base.end() + 0x10000
55
56
57 load_as = self.session.plugins.load_as(session=session.Session())
58 for pagefile_name in pagefile_names:
59 pagefile_as = load_as.GuessAddressSpace(filename=pagefile_name)
60
61 if pagefile_as:
62 self.pagefile_offset = vaddr
63 vaddr += pagefile_as.end()
64 self.pagefile_end = vaddr
65 self.add_run(vaddr, 0, pagefile_as.end(), pagefile_as)
66