dissect.target 3.15.dev20__py3-none-any.whl → 3.15.dev21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,6 +123,12 @@ class MftPlugin(Plugin):
123
123
 
124
124
  The Master File Table (MFT) contains primarily metadata about every file and folder on a NFTS filesystem.
125
125
 
126
+ If the filesystem is part of a virtual NTFS filesystem (a ``VirtualFilesystem`` with the MFT properties
127
+ added to it through a "fake" ``NtfsFilesystem``), the paths returned in the MFT records are based on the
128
+ mount point of the ``VirtualFilesystem``. This ensures that the proper original drive letter is used when
129
+ available.
130
+ When no drive letter can be determined, the path will show as e.g. ``\\$fs$\\fs0``.
131
+
126
132
  References:
127
133
  - https://docs.microsoft.com/en-us/windows/win32/fileio/master-file-table
128
134
  """
@@ -136,6 +142,10 @@ class MftPlugin(Plugin):
136
142
  if fs.__type__ != "ntfs":
137
143
  continue
138
144
 
145
+ # If this filesystem is a "fake" NTFS filesystem, used to enhance a
146
+ # VirtualFilesystem, The driveletter (more accurate mount point)
147
+ # returned will be that of the VirtualFilesystem. This makes sure
148
+ # the paths returned in the records are actually reachable.
139
149
  drive_letter = get_drive_letter(self.target, fs)
140
150
  volume_uuid = get_volume_identifier(fs)
141
151
 
@@ -105,6 +105,12 @@ class MftTimelinePlugin(Plugin):
105
105
 
106
106
  The Master File Table (MFT) contains metadata about every file and folder on a NFTS filesystem.
107
107
 
108
+ If the filesystem is part of a virtual NTFS filesystem (a ``VirtualFilesystem`` with the MFT properties
109
+ added to it through a "fake" ``NtfsFilesystem``), the paths returned in the MFT records are based on the
110
+ mount point of the ``VirtualFilesystem``. This ensures that the proper original drive letter is used when
111
+ available.
112
+ When no drive letter can be determined, the path will show as e.g. ``\\$fs$\\fs0``.
113
+
108
114
  References:
109
115
  - https://docs.microsoft.com/en-us/windows/win32/fileio/master-file-table
110
116
  """
@@ -112,6 +118,10 @@ class MftTimelinePlugin(Plugin):
112
118
  if fs.__type__ != "ntfs":
113
119
  continue
114
120
 
121
+ # If this filesystem is a "fake" NTFS filesystem, used to enhance a
122
+ # VirtualFilesystem, The driveletter (more accurate mount point)
123
+ # returned will be that of the VirtualFilesystem. This makes sure
124
+ # the paths returned in the records are actually reachable.
115
125
  drive_letter = get_drive_letter(self.target, fs)
116
126
  extras = Extras(
117
127
  serial=fs.ntfs.serial,
@@ -34,6 +34,12 @@ class UsnjrnlPlugin(Plugin):
34
34
  The Update Sequence Number Journal (UsnJrnl) is a feature of an NTFS file system and contains information about
35
35
  filesystem activities. Each volume has its own UsnJrnl.
36
36
 
37
+ If the filesystem is part of a virtual NTFS filesystem (a ``VirtualFilesystem`` with the UsnJrnl
38
+ properties added to it through a "fake" ``NtfsFilesystem``), the paths returned in the UsnJrnl records
39
+ are based on the mount point of the ``VirtualFilesystem``. This ensures that the proper original drive
40
+ letter is used when available.
41
+ When no drive letter can be determined, the path will show as e.g. ``\\$fs$\\fs0``.
42
+
37
43
  References:
38
44
  - https://en.wikipedia.org/wiki/USN_Journal
39
45
  - https://velociraptor.velocidex.com/the-windows-usn-journal-f0c55c9010e
@@ -47,6 +53,10 @@ class UsnjrnlPlugin(Plugin):
47
53
  if not usnjrnl:
48
54
  continue
49
55
 
56
+ # If this filesystem is a "fake" NTFS filesystem, used to enhance a
57
+ # VirtualFilesystem, The driveletter (more accurate mount point)
58
+ # returned will be that of the VirtualFilesystem. This makes sure
59
+ # the paths returned in the records are actually reachable.
50
60
  drive_letter = get_drive_letter(self.target, fs)
51
61
  for record in usnjrnl.records():
52
62
  try:
@@ -1,3 +1,4 @@
1
+ import re
1
2
  from enum import Enum, auto
2
3
  from typing import Optional, Tuple
3
4
  from uuid import UUID
@@ -8,6 +9,8 @@ from dissect.ntfs.mft import MftRecord
8
9
  from dissect.target import Target
9
10
  from dissect.target.filesystems.ntfs import NtfsFilesystem
10
11
 
12
+ DRIVE_LETTER_RE = re.compile(r"[a-zA-Z]:")
13
+
11
14
 
12
15
  class InformationType(Enum):
13
16
  STANDARD_INFORMATION = auto()
@@ -20,13 +23,33 @@ def get_drive_letter(target: Target, filesystem: NtfsFilesystem):
20
23
 
21
24
  When the drive letter is not available for that filesystem it returns empty.
22
25
  """
26
+ # A filesystem can be known under multiple drives (mount points). If it is
27
+ # a windows system volume, there are the default sysvol and c: drives.
28
+ # If the target has a virtual ntfs filesystem, e.g. as constructed by the
29
+ # tar and dir loaders, there is also the /$fs$/fs<n> drive, under which the
30
+ # "fake" ntfs filesystem is mounted.
31
+ # The precedence for drives is first the drive letter drives (e.g. c:),
32
+ # second the "normally" named drives (e.g. sysvol) and finally the anonymous
33
+ # drives (e.g. /$fs/fs0).
23
34
  mount_items = (item for item in target.fs.mounts.items() if hasattr(item[1], "ntfs"))
24
- driveletters = [key for key, fs in mount_items if fs.ntfs is filesystem.ntfs]
35
+ drives = [key for key, fs in mount_items if fs.ntfs is filesystem.ntfs]
36
+
37
+ single_letter_drives = []
38
+ other_drives = []
39
+ anon_drives = []
40
+
41
+ for drive in drives:
42
+ if DRIVE_LETTER_RE.match(drive):
43
+ single_letter_drives.append(drive)
44
+ elif "$fs$" in drive:
45
+ anon_drives.append(drive)
46
+ else:
47
+ other_drives.append(drive)
48
+
49
+ drives = sorted(single_letter_drives) + sorted(other_drives) + sorted(anon_drives)
25
50
 
26
- if driveletters:
27
- # Currently, mount_dict contain 2 instances of the same filesystem: 'sysvol' and 'c:'
28
- # This is to choose the latter which will be 'c:'
29
- return f"{driveletters[-1]}\\"
51
+ if drives:
52
+ return f"{drives[0]}\\"
30
53
  else:
31
54
  return ""
32
55
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.15.dev20
3
+ Version: 3.15.dev21
4
4
  Summary: This module ties all other Dissect modules together, it provides a programming API and command line tools which allow easy access to various data sources inside disk images or file collections (a.k.a. targets)
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -153,10 +153,10 @@ dissect/target/plugins/filesystem/resolver.py,sha256=HfyASUFV4F9uD-yFXilFpPTORAs
153
153
  dissect/target/plugins/filesystem/walkfs.py,sha256=aCEBmT3uoQdMdSGUshMOsKpcjrzAFg3HzeYW24PJZwk,2296
154
154
  dissect/target/plugins/filesystem/yara.py,sha256=q_pbrQArNaWP4ILRzK7VQhukIw16LhUvntoviHmZ38Q,2241
155
155
  dissect/target/plugins/filesystem/ntfs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
156
- dissect/target/plugins/filesystem/ntfs/mft.py,sha256=O5OHo2WDVhvflsQq8DcUaDRgDeWPcJs_1C_bqfm1PO0,8806
157
- dissect/target/plugins/filesystem/ntfs/mft_timeline.py,sha256=EJr_SFNkCrGx0VKIQFu-0zhNYuNv_7PpaXsYjE6UzE4,6033
158
- dissect/target/plugins/filesystem/ntfs/usnjrnl.py,sha256=2n64bhiBOuhVv9GsgFQcfMSE9CQ-RRfu2b3i9E2wzeQ,2938
159
- dissect/target/plugins/filesystem/ntfs/utils.py,sha256=9oRkmrByR1JPiIM0n_evORcK6NDQuDqrmiVIolupeck,2316
156
+ dissect/target/plugins/filesystem/ntfs/mft.py,sha256=Za-fsTcKlAlhm9ugJlMdwsJVf2Osrh4PrEGSFuv-Eeo,9564
157
+ dissect/target/plugins/filesystem/ntfs/mft_timeline.py,sha256=vvNFAZbr7s3X2OTYf4ES_L6-XsouTXcTymfxnHfZ1Rw,6791
158
+ dissect/target/plugins/filesystem/ntfs/usnjrnl.py,sha256=uiT1ipmcAo__6VIUi8R_vvIu22vdnjMACKwLSAbzYjs,3704
159
+ dissect/target/plugins/filesystem/ntfs/utils.py,sha256=xG7Lgw9NX4tDDrZVRm0vycFVJTOM7j-HrjqzDh0f4uA,3136
160
160
  dissect/target/plugins/filesystem/unix/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
161
161
  dissect/target/plugins/filesystem/unix/capability.py,sha256=oTJVEr8Yszejd-FxU0D8J49ATxNrJOcUnBFIc96k8kg,5920
162
162
  dissect/target/plugins/filesystem/unix/suid.py,sha256=Q0Y5CyPm34REruyZYP5siFAka4i7QEOOxZ9K2L-SxPY,1290
@@ -315,10 +315,10 @@ dissect/target/volumes/luks.py,sha256=v_mHW05KM5iG8JDe47i2V4Q9O0r4rnAMA9m_qc9cYw
315
315
  dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
316
316
  dissect/target/volumes/md.py,sha256=j1K1iKmspl0C_OJFc7-Q1BMWN2OCC5EVANIgVlJ_fIE,1673
317
317
  dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
318
- dissect.target-3.15.dev20.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
319
- dissect.target-3.15.dev20.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
320
- dissect.target-3.15.dev20.dist-info/METADATA,sha256=P3aZf5INRmResMw5qj2ipews4T7dSbv7eHIUFfYp5L4,11113
321
- dissect.target-3.15.dev20.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
322
- dissect.target-3.15.dev20.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
323
- dissect.target-3.15.dev20.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
324
- dissect.target-3.15.dev20.dist-info/RECORD,,
318
+ dissect.target-3.15.dev21.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
319
+ dissect.target-3.15.dev21.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
320
+ dissect.target-3.15.dev21.dist-info/METADATA,sha256=4zEuRFKt1qhipeN98KP4OJXi0bz5r8RLmqBrRUbQbuI,11113
321
+ dissect.target-3.15.dev21.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
322
+ dissect.target-3.15.dev21.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
323
+ dissect.target-3.15.dev21.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
324
+ dissect.target-3.15.dev21.dist-info/RECORD,,