dissect.fat 3.14.dev1__tar.gz → 3.14.dev3__tar.gz
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.
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/.git-blame-ignore-revs +2 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/PKG-INFO +1 -1
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect/fat/__init__.py +2 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect/fat/exceptions.py +3 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect/fat/exfat.py +12 -31
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect.fat.egg-info/PKG-INFO +1 -1
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/pyproject.toml +20 -2
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/_docs/conf.py +2 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/COPYRIGHT +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/LICENSE +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/MANIFEST.in +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/README.md +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect/fat/c_exfat.py +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect/fat/c_fat.py +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect/fat/fat.py +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect.fat.egg-info/SOURCES.txt +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect.fat.egg-info/dependency_links.txt +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect.fat.egg-info/requires.txt +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/dissect.fat.egg-info/top_level.txt +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/setup.cfg +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/__init__.py +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/_docs/Makefile +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/_docs/index.rst +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/conftest.py +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/data/exfat.bin +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/data/exfat4m.bin +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/data/fat12.bin +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/data/fat16.bin +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/data/fat32.bin +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/test_exceptions.py +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/test_exfat.py +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tests/test_fat.py +0 -0
- {dissect_fat-3.14.dev1 → dissect_fat-3.14.dev3}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.fat
|
|
3
|
-
Version: 3.14.
|
|
3
|
+
Version: 3.14.dev3
|
|
4
4
|
Summary: A Dissect module implementing parsers for the FAT and exFAT file systems, commonly used on flash memory based storage devices and UEFI partitions
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -60,8 +60,7 @@ class ExFAT:
|
|
|
60
60
|
self.volume_label = self.root_directory.volume_entry.volume_label.strip("\x00")
|
|
61
61
|
|
|
62
62
|
def cluster_to_sector(self, cluster: int) -> int | None:
|
|
63
|
-
"""
|
|
64
|
-
Returns the clusters' corresponding sector address
|
|
63
|
+
"""Returns the clusters' corresponding sector address.
|
|
65
64
|
|
|
66
65
|
Args:
|
|
67
66
|
cluster (int): cluster address
|
|
@@ -69,13 +68,11 @@ class ExFAT:
|
|
|
69
68
|
Returns:
|
|
70
69
|
int: corresponding sector address if available
|
|
71
70
|
"""
|
|
72
|
-
|
|
73
71
|
sector = ((cluster - 2) * (2**self.vbr.sectors_per_cluster_exp)) + self.cluster_heap_sector
|
|
74
72
|
return sector if sector > 0 else None
|
|
75
73
|
|
|
76
74
|
def sector_to_cluster(self, sector: int) -> int | None:
|
|
77
|
-
"""
|
|
78
|
-
Returns the sectors' corresponding cluster address
|
|
75
|
+
"""Returns the sectors' corresponding cluster address.
|
|
79
76
|
|
|
80
77
|
Args:
|
|
81
78
|
sector (int): sector address
|
|
@@ -83,22 +80,20 @@ class ExFAT:
|
|
|
83
80
|
Returns:
|
|
84
81
|
int: corresponding cluster address if available
|
|
85
82
|
"""
|
|
86
|
-
|
|
87
83
|
cluster = ((sector - self.cluster_to_sector(2)) // self.sector_size) + 2
|
|
88
84
|
return cluster if cluster >= 2 else None
|
|
89
85
|
|
|
90
86
|
def runlist(
|
|
91
87
|
self, starting_cluster: int, not_fragmented: bool = True, size: int | None = None
|
|
92
88
|
) -> list[tuple[int, int]]:
|
|
93
|
-
"""
|
|
94
|
-
Creates a RunlistStream compatible runlist from exFAT FAT structures, in sectors.
|
|
89
|
+
"""Creates a RunlistStream compatible runlist from exFAT FAT structures, in sectors.
|
|
95
90
|
|
|
96
91
|
Args:
|
|
97
92
|
starting_cluster (int): First cluster of file, folder or location in question
|
|
98
93
|
|
|
99
94
|
Returns:
|
|
100
|
-
runlist: [(sector_offset, run_length_in_sectors)]
|
|
101
|
-
|
|
95
|
+
runlist: [(sector_offset, run_length_in_sectors)]
|
|
96
|
+
"""
|
|
102
97
|
# If file is not fragmented clusters will not be present in the FAT
|
|
103
98
|
cluster_chain = [starting_cluster] if not_fragmented else self.get_cluster_chain(starting_cluster)
|
|
104
99
|
runlist = []
|
|
@@ -126,8 +121,7 @@ class ExFAT:
|
|
|
126
121
|
return runlist
|
|
127
122
|
|
|
128
123
|
def get_cluster_chain(self, starting_cluster: int) -> list[int]:
|
|
129
|
-
"""
|
|
130
|
-
Reads the on disk FAT to construct the cluster chain
|
|
124
|
+
"""Reads the on disk FAT to construct the cluster chain.
|
|
131
125
|
|
|
132
126
|
Args:
|
|
133
127
|
starting_cluster (int): cluster to look-up the chain from
|
|
@@ -135,7 +129,6 @@ class ExFAT:
|
|
|
135
129
|
Returns:
|
|
136
130
|
list: Chain of clusters. Including starting_cluster
|
|
137
131
|
"""
|
|
138
|
-
|
|
139
132
|
next_ = 0x00000000
|
|
140
133
|
chain = []
|
|
141
134
|
|
|
@@ -152,8 +145,7 @@ class ExFAT:
|
|
|
152
145
|
|
|
153
146
|
@staticmethod
|
|
154
147
|
def _utc_timezone(timezone: int) -> dict[str, str | int]:
|
|
155
|
-
"""
|
|
156
|
-
Converts a Microsoft exFAT timezone byte to its UTC timezone equivalent
|
|
148
|
+
"""Converts a Microsoft exFAT timezone byte to its UTC timezone equivalent.
|
|
157
149
|
|
|
158
150
|
Args:
|
|
159
151
|
timezone (int): exFAT timezone byte
|
|
@@ -161,7 +153,6 @@ class ExFAT:
|
|
|
161
153
|
Returns:
|
|
162
154
|
dict: UTC name (str), UTC offset in minutes (int)
|
|
163
155
|
"""
|
|
164
|
-
|
|
165
156
|
# utc_bool -64 32 16 : 8 4 2 1
|
|
166
157
|
# ^ sign
|
|
167
158
|
TIMEZONE_MINUTE_INCREMENT = 15
|
|
@@ -195,9 +186,7 @@ class RootDirectory:
|
|
|
195
186
|
self._parse_root_dir(fh)
|
|
196
187
|
|
|
197
188
|
def _parse_root_dir(self, fh: BinaryIO) -> None:
|
|
198
|
-
"""
|
|
199
|
-
Parses the passed fh to construct the Root directory object"""
|
|
200
|
-
|
|
189
|
+
"""Parses the passed fh to construct the Root directory object."""
|
|
201
190
|
# Root dir is always present in FAT so we pass False to traverse the FAT table
|
|
202
191
|
# thus root dir is per definition fragmented
|
|
203
192
|
runlist = self.exfat.runlist(self.location, False)
|
|
@@ -212,8 +201,7 @@ class RootDirectory:
|
|
|
212
201
|
self.dict = self._create_root_dir(self.root_dir)
|
|
213
202
|
|
|
214
203
|
def _parse_subdir(self, entry: c_exfat.FILE) -> OrderedDict:
|
|
215
|
-
"""
|
|
216
|
-
Parses the given sub directory file directory entry for containing files
|
|
204
|
+
"""Parses the given sub directory file directory entry for containing files.
|
|
217
205
|
|
|
218
206
|
Args:
|
|
219
207
|
entry (FILE): Directory FILE entry
|
|
@@ -221,7 +209,6 @@ class RootDirectory:
|
|
|
221
209
|
Returns:
|
|
222
210
|
OrderedDict: Containing files in sub directory
|
|
223
211
|
"""
|
|
224
|
-
|
|
225
212
|
folder_location = entry.stream.location
|
|
226
213
|
folder_size = entry.stream.data_length # in bytes
|
|
227
214
|
folder_runlist = self.exfat.runlist(folder_location, not_fragmented=entry.stream.flags.not_fragmented)
|
|
@@ -231,8 +218,7 @@ class RootDirectory:
|
|
|
231
218
|
|
|
232
219
|
@staticmethod
|
|
233
220
|
def _construct_filename(fn_entries: list[c_exfat.FILENAME_DIRECTORY_ENTRY], is_dir: bool = False) -> str:
|
|
234
|
-
"""
|
|
235
|
-
Assembles the filename from given file name directory entries
|
|
221
|
+
"""Assembles the filename from given file name directory entries.
|
|
236
222
|
|
|
237
223
|
Args:
|
|
238
224
|
fn_entries (list): A list of exFAT file name directory entries
|
|
@@ -240,7 +226,6 @@ class RootDirectory:
|
|
|
240
226
|
Returns:
|
|
241
227
|
str: Name of file or folder stripped from trailing null values
|
|
242
228
|
"""
|
|
243
|
-
|
|
244
229
|
filename = []
|
|
245
230
|
if len(fn_entries) == 1:
|
|
246
231
|
filename = fn_entries[0].filename.strip("\x00")
|
|
@@ -253,8 +238,7 @@ class RootDirectory:
|
|
|
253
238
|
return filename if not is_dir else filename + "/"
|
|
254
239
|
|
|
255
240
|
def _parse_file_entries(self, fh: BinaryIO) -> OrderedDict:
|
|
256
|
-
"""
|
|
257
|
-
Finds and parses file entries in a given file handle (file like object)
|
|
241
|
+
"""Finds and parses file entries in a given file handle (file like object).
|
|
258
242
|
|
|
259
243
|
Args:
|
|
260
244
|
fh (Stream object): Any stream object
|
|
@@ -262,7 +246,6 @@ class RootDirectory:
|
|
|
262
246
|
Returns:
|
|
263
247
|
OrderedDict: Found and parsed file directory entries
|
|
264
248
|
"""
|
|
265
|
-
|
|
266
249
|
entries = OrderedDict()
|
|
267
250
|
|
|
268
251
|
while fh.tell() < fh.size:
|
|
@@ -305,13 +288,11 @@ class RootDirectory:
|
|
|
305
288
|
self.upcase_entry = c_exfat.UPCASE_DIRECTORY_ENTRY(entry.dumps())
|
|
306
289
|
|
|
307
290
|
def _create_root_dir(self, root_dir: BinaryIO) -> OrderedDict:
|
|
308
|
-
"""
|
|
309
|
-
Since exFAT does not have a dedicated root directory entry
|
|
291
|
+
"""Since exFAT does not have a dedicated root directory entry
|
|
310
292
|
one has to be constructed form available parameters during filesystem parsing.
|
|
311
293
|
|
|
312
294
|
This is ballpark so no real forensic conclusions should be based on the information of the root entry
|
|
313
295
|
"""
|
|
314
|
-
|
|
315
296
|
metadata = c_exfat.FILE_DIRECTORY_ENTRY(
|
|
316
297
|
entry_type=0x85, subentry_count=2, attributes=c_exfat.ATTRIBUTES(directory=0b1)
|
|
317
298
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.fat
|
|
3
|
-
Version: 3.14.
|
|
3
|
+
Version: 3.14.dev3
|
|
4
4
|
Summary: A Dissect module implementing parsers for the FAT and exFAT file systems, commonly used on flash memory based storage devices and UEFI partitions
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -94,7 +94,7 @@ select = [
|
|
|
94
94
|
"SLOT",
|
|
95
95
|
"SIM",
|
|
96
96
|
"TID",
|
|
97
|
-
"
|
|
97
|
+
"TC",
|
|
98
98
|
"PTH",
|
|
99
99
|
"PLC",
|
|
100
100
|
"TRY",
|
|
@@ -102,8 +102,25 @@ select = [
|
|
|
102
102
|
"PERF",
|
|
103
103
|
"FURB",
|
|
104
104
|
"RUF",
|
|
105
|
+
"D"
|
|
105
106
|
]
|
|
106
|
-
ignore = [
|
|
107
|
+
ignore = [
|
|
108
|
+
"E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM105", "TRY003", "PLC0415",
|
|
109
|
+
# Ignore some pydocstyle rules for now as they require a larger cleanup
|
|
110
|
+
"D1",
|
|
111
|
+
"D205",
|
|
112
|
+
"D301",
|
|
113
|
+
"D417",
|
|
114
|
+
# Seems bugged: https://github.com/astral-sh/ruff/issues/16824
|
|
115
|
+
"D402",
|
|
116
|
+
]
|
|
117
|
+
future-annotations = true
|
|
118
|
+
|
|
119
|
+
[tool.ruff.lint.pydocstyle]
|
|
120
|
+
convention = "google"
|
|
121
|
+
|
|
122
|
+
[tool.ruff.lint.flake8-type-checking]
|
|
123
|
+
strict = true
|
|
107
124
|
|
|
108
125
|
[tool.ruff.lint.per-file-ignores]
|
|
109
126
|
"tests/_docs/**" = ["INP001"]
|
|
@@ -111,6 +128,7 @@ ignore = ["E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM1
|
|
|
111
128
|
[tool.ruff.lint.isort]
|
|
112
129
|
known-first-party = ["dissect.fat"]
|
|
113
130
|
known-third-party = ["dissect"]
|
|
131
|
+
required-imports = ["from __future__ import annotations"]
|
|
114
132
|
|
|
115
133
|
[tool.setuptools.packages.find]
|
|
116
134
|
include = ["dissect.*"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|