dissect.ntfs 3.14.dev2__tar.gz → 3.15.dev2__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_ntfs-3.15.dev2/.gitattributes +1 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/PKG-INFO +5 -5
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/attr.py +2 -8
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/c_ntfs.py +8 -44
- dissect_ntfs-3.15.dev2/dissect/ntfs/c_ntfs.pyi +925 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/index.py +4 -12
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/mft.py +25 -4
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/ntfs.py +1 -1
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/usnjrnl.py +2 -2
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/util.py +38 -1
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect.ntfs.egg-info/PKG-INFO +5 -5
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect.ntfs.egg-info/SOURCES.txt +13 -9
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/pyproject.toml +27 -9
- dissect_ntfs-3.15.dev2/tests/_data/ntfs-cloud.bin.gz +0 -0
- {dissect_ntfs-3.14.dev2/tests/docs → dissect_ntfs-3.15.dev2/tests/_docs}/Makefile +1 -1
- dissect_ntfs-3.15.dev2/tests/_docs/__init__.py +0 -0
- {dissect_ntfs-3.14.dev2/tests/docs → dissect_ntfs-3.15.dev2/tests/_docs}/conf.py +7 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/conftest.py +11 -6
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/test_mft.py +48 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tox.ini +12 -14
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/.git-blame-ignore-revs +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/COPYRIGHT +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/LICENSE +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/MANIFEST.in +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/README.md +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/__init__.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/exceptions.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/secure.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect/ntfs/stream.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect.ntfs.egg-info/dependency_links.txt +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect.ntfs.egg-info/requires.txt +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/dissect.ntfs.egg-info/top_level.txt +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/setup.cfg +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/__init__.py +0 -0
- {dissect_ntfs-3.14.dev2/tests/data → dissect_ntfs-3.15.dev2/tests/_data}/boot_2m.bin.gz +0 -0
- {dissect_ntfs-3.14.dev2/tests/data → dissect_ntfs-3.15.dev2/tests/_data}/mft.bin.gz +0 -0
- {dissect_ntfs-3.14.dev2/tests/data → dissect_ntfs-3.15.dev2/tests/_data}/ntfs.bin.gz +0 -0
- {dissect_ntfs-3.14.dev2/tests/data → dissect_ntfs-3.15.dev2/tests/_data}/ntfs_fragmented_mft.csv.gz +0 -0
- {dissect_ntfs-3.14.dev2/tests/data → dissect_ntfs-3.15.dev2/tests/_data}/sds.bin.gz +0 -0
- {dissect_ntfs-3.14.dev2/tests/data → dissect_ntfs-3.15.dev2/tests/_data}/sds_complex.bin.gz +0 -0
- {dissect_ntfs-3.14.dev2/tests/docs → dissect_ntfs-3.15.dev2/tests/_docs}/index.rst +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/test_attr.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/test_exceptions.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/test_index.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/test_ntfs.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/test_secure.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/test_usnjrnl.py +0 -0
- {dissect_ntfs-3.14.dev2 → dissect_ntfs-3.15.dev2}/tests/test_util.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tests/_data/** filter=lfs diff=lfs merge=lfs -text
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.ntfs
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.15.dev2
|
|
4
4
|
Summary: A Dissect module implementing a parser for the NTFS file system, used by the Windows operating system
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
|
-
License:
|
|
6
|
+
License-Expression: AGPL-3.0-or-later
|
|
7
7
|
Project-URL: homepage, https://dissect.tools
|
|
8
8
|
Project-URL: documentation, https://docs.dissect.tools/en/latest/projects/dissect.ntfs
|
|
9
9
|
Project-URL: repository, https://github.com/fox-it/dissect.ntfs
|
|
@@ -11,14 +11,13 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
11
11
|
Classifier: Environment :: Console
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: Intended Audience :: Information Technology
|
|
14
|
-
Classifier: License :: OSI Approved
|
|
15
14
|
Classifier: Operating System :: OS Independent
|
|
16
15
|
Classifier: Programming Language :: Python :: 3
|
|
17
16
|
Classifier: Topic :: Internet :: Log Analysis
|
|
18
17
|
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
19
18
|
Classifier: Topic :: Security
|
|
20
19
|
Classifier: Topic :: Utilities
|
|
21
|
-
Requires-Python:
|
|
20
|
+
Requires-Python: >=3.10
|
|
22
21
|
Description-Content-Type: text/markdown
|
|
23
22
|
License-File: LICENSE
|
|
24
23
|
License-File: COPYRIGHT
|
|
@@ -27,6 +26,7 @@ Requires-Dist: dissect.util<4,>=3
|
|
|
27
26
|
Provides-Extra: dev
|
|
28
27
|
Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
|
|
29
28
|
Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
30
|
|
|
31
31
|
# dissect.ntfs
|
|
32
32
|
|
|
@@ -6,15 +6,9 @@ from typing import TYPE_CHECKING, Any, BinaryIO
|
|
|
6
6
|
from dissect.util.stream import RangeStream, RunlistStream
|
|
7
7
|
from dissect.util.ts import wintimestamp
|
|
8
8
|
|
|
9
|
-
from dissect.ntfs.c_ntfs import
|
|
10
|
-
ATTRIBUTE_TYPE_CODE,
|
|
11
|
-
IO_REPARSE_TAG,
|
|
12
|
-
c_ntfs,
|
|
13
|
-
segment_reference,
|
|
14
|
-
varint,
|
|
15
|
-
)
|
|
9
|
+
from dissect.ntfs.c_ntfs import ATTRIBUTE_TYPE_CODE, IO_REPARSE_TAG, c_ntfs
|
|
16
10
|
from dissect.ntfs.exceptions import MftNotAvailableError, VolumeNotAvailableError
|
|
17
|
-
from dissect.ntfs.util import ensure_volume, get_full_path, ts_to_ns
|
|
11
|
+
from dissect.ntfs.util import ensure_volume, get_full_path, segment_reference, ts_to_ns, varint
|
|
18
12
|
|
|
19
13
|
if TYPE_CHECKING:
|
|
20
14
|
from collections.abc import Iterator
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import struct
|
|
4
|
-
|
|
5
3
|
from dissect.cstruct import cstruct
|
|
6
4
|
|
|
7
5
|
ntfs_def = """
|
|
@@ -276,6 +274,14 @@ typedef struct _MOUNT_POINT_REPARSE_BUFFER {
|
|
|
276
274
|
USHORT PrintNameLength;
|
|
277
275
|
} _MOUNT_POINT_REPARSE_BUFFER;
|
|
278
276
|
|
|
277
|
+
typedef struct _CLOUD_FILTER_REPARSE_BUFFER {
|
|
278
|
+
// ULONG Unknown_1;
|
|
279
|
+
// ULONG Unknown_2;
|
|
280
|
+
CHAR Guid[16];
|
|
281
|
+
USHORT NameLength;
|
|
282
|
+
// WCHAR Name[NameLength];
|
|
283
|
+
} _CLOUD_FILTER_REPARSE_BUFFER;
|
|
284
|
+
|
|
279
285
|
/* ================ Index ================ */
|
|
280
286
|
|
|
281
287
|
enum COLLATION : ULONG {
|
|
@@ -613,45 +619,3 @@ COMPRESSION_FORMAT_LZNT1 = 0x0002
|
|
|
613
619
|
INDEX_NODE = 0x01
|
|
614
620
|
INDEX_ENTRY_NODE = 0x01
|
|
615
621
|
INDEX_ENTRY_END = 0x02
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
def segment_reference(reference: c_ntfs._MFT_SEGMENT_REFERENCE) -> int:
|
|
619
|
-
"""Helper to calculate the complete segment number from a cstruct MFT segment reference.
|
|
620
|
-
|
|
621
|
-
Args:
|
|
622
|
-
reference: A cstruct _MFT_SEGMENT_REFERENCE instance to return the complete segment number of.
|
|
623
|
-
"""
|
|
624
|
-
return reference.SegmentNumberLowPart | (reference.SegmentNumberHighPart << 32)
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
def varint(buf: bytes) -> int:
|
|
628
|
-
"""Parse variable integers.
|
|
629
|
-
|
|
630
|
-
Dataruns in NTFS are stored as a tuple of variable sized integers. The size of each integer is
|
|
631
|
-
stored in the first byte, 4 bits for each integer. This logic can be seen in
|
|
632
|
-
:func:`AttributeHeader.dataruns <dissect.ntfs.attr.AttributeHeader.dataruns>`.
|
|
633
|
-
|
|
634
|
-
This function only parses those variable amount of bytes into actual integers. To do that, we
|
|
635
|
-
simply pad the bytes to 8 bytes long and parse it as a signed 64 bit integer. We pad with 0xff
|
|
636
|
-
if the number is negative and 0x00 otherwise.
|
|
637
|
-
|
|
638
|
-
Args:
|
|
639
|
-
buf: The byte buffer to parse a varint from.
|
|
640
|
-
"""
|
|
641
|
-
if len(buf) < 8:
|
|
642
|
-
buf += (b"\xff" if buf[-1] & 0x80 else b"\x00") * (8 - len(buf))
|
|
643
|
-
|
|
644
|
-
return struct.unpack("<q", buf)[0]
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
def bsf(value: int, size: int = 32) -> int:
|
|
648
|
-
"""Count the number of trailing zero bits in an integer of a given size.
|
|
649
|
-
|
|
650
|
-
Args:
|
|
651
|
-
value: The integer to count trailing zero bits in.
|
|
652
|
-
size: Integer size to limit to.
|
|
653
|
-
"""
|
|
654
|
-
for i in range(size):
|
|
655
|
-
if value & (1 << i):
|
|
656
|
-
return i
|
|
657
|
-
return 0
|