dissect.target 3.19.dev32__py3-none-any.whl → 3.19.dev33__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.
@@ -5,7 +5,7 @@ import re
5
5
  import urllib
6
6
  from os import PathLike
7
7
  from pathlib import Path
8
- from typing import TYPE_CHECKING, BinaryIO, Optional, Union
8
+ from typing import TYPE_CHECKING, BinaryIO
9
9
 
10
10
  from dissect.target.exceptions import FileNotFoundError
11
11
  from dissect.target.filesystem import Filesystem
@@ -42,12 +42,31 @@ def add_virtual_ntfs_filesystem(
42
42
  fh_sds = _try_open(fs, sds_path)
43
43
 
44
44
  if any([fh_boot, fh_mft]):
45
- ntfs = NtfsFilesystem(boot=fh_boot, mft=fh_mft, usnjrnl=fh_usnjrnl, sds=fh_sds)
46
- target.filesystems.add(ntfs)
47
- fs.ntfs = ntfs.ntfs
45
+ ntfs = None
48
46
 
49
-
50
- def _try_open(fs: Filesystem, path: str) -> BinaryIO:
47
+ try:
48
+ ntfs = NtfsFilesystem(boot=fh_boot, mft=fh_mft, usnjrnl=fh_usnjrnl, sds=fh_sds)
49
+ except Exception as e:
50
+ if fh_boot:
51
+ log.warning("Failed to load NTFS filesystem from %s, retrying without $Boot file", fs)
52
+ log.debug("", exc_info=e)
53
+
54
+ try:
55
+ # Try once more without the $Boot file
56
+ ntfs = NtfsFilesystem(mft=fh_mft, usnjrnl=fh_usnjrnl, sds=fh_sds)
57
+ except Exception:
58
+ log.warning("Failed to load NTFS filesystem from %s without $Boot file, skipping", fs)
59
+ return
60
+
61
+ # Only add it if we have a valid NTFS with an MFT
62
+ if ntfs and ntfs.ntfs.mft:
63
+ target.filesystems.add(ntfs)
64
+ fs.ntfs = ntfs.ntfs
65
+ else:
66
+ log.warning("Opened NTFS filesystem from %s but could not find $MFT, skipping", fs)
67
+
68
+
69
+ def _try_open(fs: Filesystem, path: str) -> BinaryIO | None:
51
70
  paths = [path] if not isinstance(path, list) else path
52
71
 
53
72
  for path in paths:
@@ -61,7 +80,7 @@ def _try_open(fs: Filesystem, path: str) -> BinaryIO:
61
80
  pass
62
81
 
63
82
 
64
- def extract_path_info(path: Union[str, Path]) -> tuple[Path, Optional[urllib.parse.ParseResult]]:
83
+ def extract_path_info(path: str | Path) -> tuple[Path, urllib.parse.ParseResult | None]:
65
84
  """
66
85
  Extracts a ParseResult from a path if it has
67
86
  a scheme and adjusts the path if necessary.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.19.dev32
3
+ Version: 3.19.dev33
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
@@ -54,7 +54,7 @@ dissect/target/helpers/fsutil.py,sha256=tPyH4RBDqM9QXjamIQaDRLUy3b4dKmfrT6k3ZP01
54
54
  dissect/target/helpers/hashutil.py,sha256=bYAGEjyYyxuCTziO4kCx6srzY1Cm-PXmayRRcxt5ca4,1061
55
55
  dissect/target/helpers/keychain.py,sha256=wYH0sf7eaxP0bZTo80RF_BQMWulCWmIQ8Tzt9K5TSNQ,3611
56
56
  dissect/target/helpers/lazy.py,sha256=823VtmdWsbJyVZvNWopDhQdqq2i1xtj6b8IKfveboKw,1771
57
- dissect/target/helpers/loaderutil.py,sha256=kiyMWra_gVxfNSGwLlgxLcuuqAYuCMDc5NiCDprVNnc,2649
57
+ dissect/target/helpers/loaderutil.py,sha256=4cS0RKGgsljQYYc5uGzmnWJ_NXt7QfWJ1jvtEINZmdE,3415
58
58
  dissect/target/helpers/localeutil.py,sha256=Y4Fh4jDSGfm5356xSLMriUCN8SZP_FAHg_iodkAxNq4,1504
59
59
  dissect/target/helpers/mount.py,sha256=JxhUYyEbDnHfzPpfuWy4nV9OwCJPoDSGdHHNiyvd_l0,3949
60
60
  dissect/target/helpers/mui.py,sha256=i-7XoHbu4WO2fYapK9yGAMW04rFlgRispknc1KQIS5Q,22258
@@ -346,10 +346,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
346
346
  dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
347
347
  dissect/target/volumes/md.py,sha256=7ShPtusuLGaIv27SvEETtgsuoQyAa4iAAeOR1NEaajI,1689
348
348
  dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
349
- dissect.target-3.19.dev32.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
350
- dissect.target-3.19.dev32.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
351
- dissect.target-3.19.dev32.dist-info/METADATA,sha256=aYH5ExmLUxmscik9N5OAaWx16j-W7AHvqsONGGGOZoE,12719
352
- dissect.target-3.19.dev32.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
353
- dissect.target-3.19.dev32.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
354
- dissect.target-3.19.dev32.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
355
- dissect.target-3.19.dev32.dist-info/RECORD,,
349
+ dissect.target-3.19.dev33.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
350
+ dissect.target-3.19.dev33.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
351
+ dissect.target-3.19.dev33.dist-info/METADATA,sha256=qql1vSsBtkxg9RPKiPg49ssQekDjKwQfE3GKlxWsjCk,12719
352
+ dissect.target-3.19.dev33.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
353
+ dissect.target-3.19.dev33.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
354
+ dissect.target-3.19.dev33.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
355
+ dissect.target-3.19.dev33.dist-info/RECORD,,