/usr/lib/python2.7/dist-packages/rekall/plugins/common/pfn.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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | # Rekall Memory Forensics
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
class PhysicalAddressContext(object):
"""A lazy evaluator for context information around physical addresses."""
def __init__(self, session, address):
self.session = session
self.address = address
def summary(self):
rammap_plugin = self.session.plugins.rammap(
start=self.address, end=self.address+1)
for row in rammap_plugin.collect():
return row
def __str__(self):
rammap_plugin = self.session.plugins.rammap(
start=self.address, end=self.address+1)
if rammap_plugin != None:
return rammap_plugin.summary()[0]
return "Phys: %#x" % self.address
class VADMapMixin(object):
"""A plugin to display information about virtual address pages."""
name = "vadmap"
__args = [
dict(name="start", default=0, type="IntParser",
help="Start reading from this page."),
dict(name="end", default=2**63, type="IntParser",
help="Stop reading at this offset."),
]
def FormatMetadata(self, type, metadata, offset=None):
result = ""
if not metadata:
result = "Invalid PTE "
if "filename" in metadata:
result += "%s " % metadata["filename"]
if "number" in metadata:
result = "PF %s " % metadata["number"]
if type == "Valid" or type == "Transition":
result += "PhysAS "
if offset:
result += "@ %#x " % offset
if "ProtoType" in metadata:
result += "(P) "
return result
def GeneratePageMetatadata(self, task):
"""A Generator of vaddr, metadata for each page."""
_ = task
return []
def render_metadata(self, renderer, old_metadata, old_vaddr, type,
offset, length, old_offset):
comment = self.FormatMetadata(
type, old_metadata, offset=old_offset)
if self.plugin_args.verbosity < 5:
renderer.table_row(old_vaddr, length, type, comment)
else:
renderer.table_row(old_vaddr, old_offset, length, type, comment)
def render(self, renderer):
for task in self.filter_processes():
renderer.section()
renderer.format("Pid: {0} {1}\n", task.pid, task.name)
headers = [
('Virt Addr', 'virt_addr', '[addrpad]'),
('Offset', 'offset', '[addrpad]'),
('Length', 'length', '[addr]'),
('Type', 'type', '20s'),
('Comments', 'comments', "")]
if self.plugin_args.verbosity < 5:
headers.pop(1)
renderer.table_header(headers)
with self.session.plugins.cc() as cc:
cc.SwitchProcessContext(task)
old_offset = 0
old_vaddr = 0
length = 0x1000
old_metadata = {}
for vaddr, metadata in self.GeneratePageMetatadata(task):
# Remove the offset so we can merge on identical
# metadata (offset will change for each page).
offset = metadata.pop("offset", None)
# Coalesce similar rows.
if ((offset is None or old_offset is None or
self.plugin_args.verbosity < 5 or
offset == old_offset + length) and
metadata == old_metadata and
vaddr == old_vaddr + length):
length += 0x1000
continue
type = old_metadata.get("type", None)
if type:
self.render_metadata(renderer, old_metadata, old_vaddr,
type, offset, length, old_offset)
old_metadata = metadata
old_vaddr = vaddr
old_offset = offset
length = 0x1000
if old_metadata:
self.render_metadata(renderer, old_metadata, old_vaddr,
type, offset, length, old_offset)
|