This file is indexed.

/usr/lib/python2.7/dist-packages/rekall/plugins/modes.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Rekall Memory Forensics
# Copyright 2016 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
#

"""Declares all the modes Rekall can be in.

The Rekall session can exist in several modes at the same time. Modes are just
simple True/False flags that represent certain aspects of the Rekall
session. For example, a session may be in "mode_image" if it is dealing with an
image.

Plugins can then activate depending on the current mode vector. For example, a
plugin may declare that it is active if all these modes are set
"mode_image,mode_windows_memory" Which means it is only active if a windows
memory image is used.
"""


from rekall import kb

from rekall.plugins.filesystems import ntfs
from rekall.plugins.filesystems import tsk


class NTFSMode(kb.ParameterHook):
    name = "mode_ntfs"

    def calculate(self):
        return isinstance(self.session.profile, ntfs.NTFSProfile)



class TSKMode(kb.ParameterHook):
    name = "mode_tsk"

    def calculate(self):
        return isinstance(self.session.profile, tsk.TSKProfile)



class WinXPMode(kb.ParameterHook):
    name = "mode_xp"

    def calculate(self):
        return self.session.profile.metadata("major") == 5


class AMD64Mode(kb.ParameterHook):
    name = "mode_amd64"

    def calculate(self):
        return self.session.profile.metadata("arch") == "AMD64"


class WinMode(kb.ParameterHook):
    name = "mode_windows"

    def calculate(self):
        return self.session.profile.metadata("os") == "windows"


class LinMode(kb.ParameterHook):
    name = "mode_linux"

    def calculate(self):
        return self.session.profile.metadata("os") == "linux"


class DarwinMode(kb.ParameterHook):
    name = "mode_darwin"

    def calculate(self):
        return self.session.profile.metadata("os") == "darwin"


class LiveMode(kb.ParameterHook):
    name = "mode_live"

    def calculate(self):
        return bool(self.session.GetParameter("live_mode"))



class LiveMemoryMode(kb.ParameterHook):
    name = "mode_live_memory"

    def calculate(self):
        return self.session.GetParameter("live_mode") == "Memory"


class LiveAPIMode(kb.ParameterHook):
    name = "mode_live_api"

    def calculate(self):
        return self.session.GetParameter("live_mode") == "API"


class ImageMode(kb.ParameterHook):
    """Determines if we are reading from an image."""
    name = "mode_image"

    def calculate(self):
        # If there is no physical address space but a filename was specified we
        # try to load the physical_address_space from the filename.
        if (not self.session.physical_address_space and
            self.session.GetParameter("filename")):
            self.session.plugins.load_as().GetPhysicalAddressSpace()

        return (self.session.physical_address_space and
                self.session.physical_address_space.metadata("image"))


class VistaMode(kb.ParameterHook):
    name = "mode_vista_plus"

    def calculate(self):
        return self.session.profile.metadata("major") >= 6


class WinMemoryMode(kb.ParameterHook):
    """Windows memory image or live windows."""
    name = "mode_windows_memory"

    def calculate(self):
        return (self.session.GetParameter("mode_live_memory") or
                self.session.GetParameter("mode_image")) and (
                    self.session.GetParameter("mode_windows"))


class LinMemoryMode(kb.ParameterHook):
    """Windows memory image or live windows."""
    name = "mode_linux_memory"

    def calculate(self):
        return (self.session.GetParameter("mode_live_memory") or
                self.session.GetParameter("mode_image")) and (
                    self.session.GetParameter("mode_linux"))


class DarwinMemoryMode(kb.ParameterHook):
    """Windows memory image or live windows."""
    name = "mode_darwin_memory"

    def calculate(self):
        return (self.session.GetParameter("mode_live_memory") or
                self.session.GetParameter("mode_image")) and (
                    self.session.GetParameter("mode_darwin"))


class MountainLionMode(kb.ParameterHook):
    """Windows memory image or live windows."""
    name = "mode_darwin_mountain_lion_plus"

    def calculate(self):
        return (self.session.profile.get_constant("_BootPML4", False) and
                self.session.GetParameter("mode_darwin_memory"))