This file is indexed.

/usr/lib/python2.7/dist-packages/rekall/plugins/windows/network.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
# Rekall Memory Forensics
#
# Copyright 2014 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
#

"""This module extracts network information using kernel object inspection.

The netscan plugins use pool tags to scan for objects, while this file directly
examines kernel data structures.
"""

__author__ = "Michael Cohen <scudette@google.com>"


from rekall.plugins.windows import common
from rekall.plugins.overlays.windows import tcpip_vtypes



class WinNetstat(tcpip_vtypes.TcpipPluginMixin, common.WindowsCommandPlugin):
    """Enumerate image for connections and sockets"""

    __name = "netstat"

    table_header = [
        dict(name="offset", style="address"),
        dict(name="protocol", width=8),
        dict(name="local_addr", width=20),
        dict(name="remote_addr", width=20),
        dict(name="state", width=16),
        dict(name="pid", width=5, align="r"),
        dict(name="owner", width=14),
        dict(name="created", width=7)
    ]

    @classmethod
    def is_active(cls, session):
        # This plugin works with the _TCP_ENDPOINT interfaces. This interface
        # uses the new HashTable entry in ntoskernl.exe.
        return (super(WinNetstat, cls).is_active(session) and
                session.profile.get_constant('RtlEnumerateEntryHashTable'))

    def collect(self):
        # First list established endpoints (TcpE pooltags).
        partition_table = self.tcpip_profile.get_constant_object(
            "PartitionTable",
            target="Pointer",
            target_args=dict(
                target="PARTITION_TABLE",
                )
            )

        for partition in partition_table.Partitions:
            for first_level in partition:
                for second_level in first_level.SecondLevel:
                    for endpoint in second_level.list_of_type(
                            "_TCP_ENDPOINT", "ListEntry"):

                        lendpoint = "{0}:{1}".format(
                            endpoint.LocalAddress(),
                            endpoint.LocalPort)

                        rendpoint = "{0}:{1}".format(
                            endpoint.RemoteAddress(),
                            endpoint.RemotePort)

                        yield dict(offset=endpoint,
                                   protocol=None,
                                   local_addr=lendpoint,
                                   remote_addr=rendpoint,
                                   state=endpoint.State,
                                   pid=endpoint.Owner.pid,
                                   owner=endpoint.Owner.name,
                                   created=endpoint.CreateTime)