This file is indexed.

/usr/lib/python2.7/dist-packages/rekall/resources.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
#!/usr/bin/env python

# Rekall
# Copyright (C) 2012 Michael Cohen <scudette@gmail.com>
# Copyright 2013 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
#

__author__ = "Michael Cohen <scudette@gmail.com>"
"""Finds resources which are normally bundled with Rekall.

Rekall is shipped both as a python package and as a pyinstaller
application. This module is the interface between the two.
"""

import os
import sys

import pkg_resources


def get_resource(filename, package="rekall-core", prefix="resources"):
    """Use the pkg_resources API to extract resources.

    This will extract into a temporary file in case the egg is compressed.

    Args:
      package: name of the package (e.g. rekall-core, rekall-gui).
      filename: The filename inside the package.
      prefix: The sub-directory in the source distribution which contains the
          resource.

   Returns:
      A path to the actual filename.

    """
    target = _get_pkg_resource(filename, package, prefix)
    if target and os.access(target, os.R_OK):
        return target

    # Installing from wheel places data_files relative to sys.prefix and not
    # site-packages. If we can not find in site-packages, check sys.prefix
    # instead.
    # https://python-packaging-user-guide.readthedocs.io/en/latest/distributing/#data-files
    target = os.path.join(sys.prefix, prefix, filename)
    if target and os.access(target, os.R_OK):
        return target

    raise IOError("Unable to find resource %s" % filename)


def _get_pkg_resource(filename, package, prefix):
    """Query pkg_resources for the location of the filename."""
    #requirement = pkg_resources.Requirement.parse(package)
    target = os.path.join(prefix, filename)
    try:
        return pkg_resources.resource_filename(package, target)
    except pkg_resources.DistributionNotFound:
        # It may be that the working set is not in sync (e.g. if sys.path was
        # manipulated). Try to reload it just in case.
        pkg_resources.working_set = pkg_resources.WorkingSet()
        try:
            return pkg_resources.resource_filename(requirement, target)
        except pkg_resources.DistributionNotFound:
            return None