dissect.target 3.20.dev15__py3-none-any.whl → 3.20.dev17__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.
@@ -0,0 +1,68 @@
1
+ from pathlib import Path
2
+ from typing import Iterator
3
+
4
+ from dissect.target.exceptions import UnsupportedPluginError
5
+ from dissect.target.helpers.fsutil import TargetPath
6
+ from dissect.target.helpers.record import ChildTargetRecord
7
+ from dissect.target.plugin import ChildTargetPlugin
8
+ from dissect.target.target import Target
9
+
10
+ PARALLELS_USER_PATHS = [
11
+ "Parallels",
12
+ "Documents/Parallels",
13
+ "Library/Group Containers/*.com.parallels.desktop.appstore/Shared/Parallels",
14
+ ]
15
+
16
+ PARALLELS_SYSTEM_PATHS = [
17
+ "/Users/Shared/Parallels",
18
+ ]
19
+
20
+
21
+ def find_pvms(target: Target) -> Iterator[TargetPath]:
22
+ """Finds virtual machines located in default folders on a macOS target.
23
+
24
+ Resources:
25
+ - https://kb.parallels.com/117333
26
+ """
27
+ for user_details in target.user_details.all_with_home():
28
+ for parallels_path in PARALLELS_SYSTEM_PATHS:
29
+ if (path := target.fs.path(parallels_path)).exists():
30
+ yield from iter_vms(path)
31
+
32
+ for parallels_path in PARALLELS_USER_PATHS:
33
+ if "*" in parallels_path:
34
+ start_path, pattern = parallels_path.split("*", 1)
35
+ for path in user_details.home_path.joinpath(start_path).rglob("*" + pattern):
36
+ yield from iter_vms(path)
37
+ else:
38
+ if (path := user_details.home_path.joinpath(parallels_path)).exists():
39
+ yield from iter_vms(path)
40
+
41
+
42
+ def iter_vms(path: Path) -> Iterator[TargetPath]:
43
+ """Glob for .pvm folders in the provided folder."""
44
+ for file in path.rglob("*.pvm"):
45
+ if file.is_dir():
46
+ yield file
47
+
48
+
49
+ class ParallelsChildTargetPlugin(ChildTargetPlugin):
50
+ """Child target plugin that yields Parallels Desktop VM files."""
51
+
52
+ __type__ = "parallels"
53
+
54
+ def __init__(self, target: Target):
55
+ super().__init__(target)
56
+ self.pvms = list(find_pvms(target))
57
+
58
+ def check_compatible(self) -> None:
59
+ if not self.pvms:
60
+ raise UnsupportedPluginError("No Parallels pvm file(s) found")
61
+
62
+ def list_children(self) -> Iterator[ChildTargetRecord]:
63
+ for pvm in self.pvms:
64
+ yield ChildTargetRecord(
65
+ type=self.__type__,
66
+ path=pvm,
67
+ _target=self.target,
68
+ )
@@ -3,13 +3,13 @@ from __future__ import annotations
3
3
  import logging
4
4
 
5
5
  from dissect.target.filesystem import Filesystem
6
- from dissect.target.helpers.network_managers import (
7
- LinuxNetworkManager,
8
- parse_unix_dhcp_log_messages,
9
- )
10
6
  from dissect.target.plugin import OperatingSystem, export
11
7
  from dissect.target.plugins.os.unix._os import UnixPlugin
12
8
  from dissect.target.plugins.os.unix.bsd.osx._os import MacPlugin
9
+ from dissect.target.plugins.os.unix.linux.network_managers import (
10
+ LinuxNetworkManager,
11
+ parse_unix_dhcp_log_messages,
12
+ )
13
13
  from dissect.target.plugins.os.windows._os import WindowsPlugin
14
14
  from dissect.target.target import Target
15
15
 
@@ -7,15 +7,17 @@ from configparser import ConfigParser, MissingSectionHeaderError
7
7
  from io import StringIO
8
8
  from itertools import chain
9
9
  from re import compile, sub
10
- from typing import Any, Callable, Iterable, Iterator, Match, Optional
10
+ from typing import TYPE_CHECKING, Any, Callable, Iterable, Iterator, Match
11
11
 
12
12
  from defusedxml import ElementTree
13
13
 
14
14
  from dissect.target.exceptions import PluginError
15
- from dissect.target.helpers.fsutil import TargetPath
16
- from dissect.target.plugins.os.unix.log.journal import JournalRecord
17
- from dissect.target.plugins.os.unix.log.messages import MessagesRecord
18
- from dissect.target.target import Target
15
+
16
+ if TYPE_CHECKING:
17
+ from dissect.target.helpers.fsutil import TargetPath
18
+ from dissect.target.plugins.os.unix.log.journal import JournalRecord
19
+ from dissect.target.plugins.os.unix.log.messages import MessagesRecord
20
+ from dissect.target.target import Target
19
21
 
20
22
  log = logging.getLogger(__name__)
21
23
 
@@ -57,7 +59,7 @@ class Template:
57
59
  """Sets the name of the the used parsing template to the name of the discovered network manager."""
58
60
  self.name = name
59
61
 
60
- def create_config(self, path: TargetPath) -> Optional[dict]:
62
+ def create_config(self, path: TargetPath) -> dict | None:
61
63
  """Create a network config dictionary based on the configured template and supplied path.
62
64
 
63
65
  Args:
@@ -81,7 +83,7 @@ class Template:
81
83
  config = self._parse_configparser_config(path)
82
84
  return config
83
85
 
84
- def _parse_netplan_config(self, path: TargetPath) -> Optional[dict]:
86
+ def _parse_netplan_config(self, path: TargetPath) -> dict | None:
85
87
  """Internal function to parse a netplan YAML based configuration file into a dict.
86
88
 
87
89
  Args:
@@ -286,7 +288,7 @@ class Parser:
286
288
  if option in translation_values and value:
287
289
  return translation_key
288
290
 
289
- def _get_option(self, config: dict, option: str, section: Optional[str] = None) -> Optional[str | Callable]:
291
+ def _get_option(self, config: dict, option: str, section: str | None = None) -> str | Callable | None:
290
292
  """Internal function to get arbitrary options values from a parsed (non-translated) dictionary.
291
293
 
292
294
  Args:
@@ -334,7 +336,7 @@ class NetworkManager:
334
336
  self.config_globs = (config_globs,) if isinstance(config_globs, str) else config_globs
335
337
  self.detection_globs = (detection_globs,) if isinstance(detection_globs, str) else detection_globs
336
338
 
337
- def detect(self, target: Optional[Target] = None) -> bool:
339
+ def detect(self, target: Target | None = None) -> bool:
338
340
  """Detects if the network manager is active on the target
339
341
 
340
342
  Returns:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.20.dev15
3
+ Version: 3.20.dev17
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
@@ -58,7 +58,6 @@ dissect/target/helpers/loaderutil.py,sha256=4cS0RKGgsljQYYc5uGzmnWJ_NXt7QfWJ1jvt
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
61
- dissect/target/helpers/network_managers.py,sha256=ByBSe2K3c8hgQC6dokcf-hHdmPcD8PmrOj0xs1C3yhs,25743
62
61
  dissect/target/helpers/polypath.py,sha256=h8p7m_OCNiQljGwoZh5Aflr9H2ot6CZr6WKq1OSw58o,2175
63
62
  dissect/target/helpers/protobuf.py,sha256=b4DsnqrRLrefcDjx7rQno-_LBcwtJXxuKf5RdOegzfE,1537
64
63
  dissect/target/helpers/record.py,sha256=7Se6ZV8cvwEaGSjRd9bKhVnUAn4W4KR2eqP6AbQhTH4,5892
@@ -158,6 +157,7 @@ dissect/target/plugins/child/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
158
157
  dissect/target/plugins/child/docker.py,sha256=frBZ8UUzbtkT9VrK1fwUzXDAdkHESdPCb-QI_OP9Jj4,872
159
158
  dissect/target/plugins/child/esxi.py,sha256=GfgQzxntcHcyxAE2QjMJ-TrFhklweSXLbYh0uuv-klg,693
160
159
  dissect/target/plugins/child/hyperv.py,sha256=R2qVeu4p_9V53jO-65znN0LwX9v3FVA-9jbbtOQcEz8,2236
160
+ dissect/target/plugins/child/parallels.py,sha256=jeBT_NvTQbQBaUjqGWTy2I5Q5OWlrogoyWHRXjOhLis,2255
161
161
  dissect/target/plugins/child/qemu.py,sha256=vNzQwzFO964jYaI67MlX8vpWyHxpegjIU5F29zHKOGI,791
162
162
  dissect/target/plugins/child/virtuozzo.py,sha256=Mx4ZxEl21g7IYkzraw4FBZup5EfrkFDv4WuTE3hxguw,1206
163
163
  dissect/target/plugins/child/vmware_workstation.py,sha256=8wkA_tSufvBUyp4XQHzRzFETf5ROlyyO_MVS3TExyfw,1570
@@ -219,12 +219,13 @@ dissect/target/plugins/os/unix/esxi/_os.py,sha256=s6pAgUyfHh3QcY6sgvk5uVMmLvqK1t
219
219
  dissect/target/plugins/os/unix/etc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
220
220
  dissect/target/plugins/os/unix/etc/etc.py,sha256=px_UwtPuk_scD-3nKJQZ0ao5lus9-BrSU4lPZWelYzI,2541
221
221
  dissect/target/plugins/os/unix/linux/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
222
- dissect/target/plugins/os/unix/linux/_os.py,sha256=ktEx_VhRB9vvZePo3-np2_L3yzUPq1Cc_D_1lnPq4-4,3023
222
+ dissect/target/plugins/os/unix/linux/_os.py,sha256=W5ok4TS0nZfR6x9vk12FAjGhZyS5cNrdxFeFpQkVOrQ,3037
223
223
  dissect/target/plugins/os/unix/linux/cmdline.py,sha256=AyMfndt3UsmJtoOyZYC8nWq2GZg9oPvn8SiI3M4NxnE,1622
224
224
  dissect/target/plugins/os/unix/linux/environ.py,sha256=UOQD7Xmu754u2oAh3L5g5snuz-gv4jbWbVy46qszYjo,1881
225
225
  dissect/target/plugins/os/unix/linux/iptables.py,sha256=qTzY5PHHXA33WnPYb5NESgoSwI7ECZ8YPoEe_Fmln-8,6045
226
226
  dissect/target/plugins/os/unix/linux/modules.py,sha256=H1S5CkpXttCVwzE2Ylz3jkvrCptN2f-fXcQ_hCB0FG0,2443
227
227
  dissect/target/plugins/os/unix/linux/netstat.py,sha256=MAC4ZdeNqcKpxT2ZMh1-7rjt4Pt_WQIRy7RChr7nlPk,1649
228
+ dissect/target/plugins/os/unix/linux/network_managers.py,sha256=nr0gA3hBqsvP9k6xAYmRYwGRB1kMtXB1k0pe78jWdFI,25768
228
229
  dissect/target/plugins/os/unix/linux/proc.py,sha256=jm35fAasnNbObN2tpflwQuCfVYLDkTP2EDrzYG42ZSk,23354
229
230
  dissect/target/plugins/os/unix/linux/processes.py,sha256=rvDJWAp16WAJZ91A8_GJJIj5y0U7BNnU8CW_47AueKY,1967
230
231
  dissect/target/plugins/os/unix/linux/services.py,sha256=-d2y073mOXUM3XCzRgDVCRFR9eTLoVuN8FsZVewHzRg,4075
@@ -365,10 +366,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
365
366
  dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
366
367
  dissect/target/volumes/md.py,sha256=7ShPtusuLGaIv27SvEETtgsuoQyAa4iAAeOR1NEaajI,1689
367
368
  dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
368
- dissect.target-3.20.dev15.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
369
- dissect.target-3.20.dev15.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
370
- dissect.target-3.20.dev15.dist-info/METADATA,sha256=Z0q9VoAwFjPPZnc3S6F_5bAUKanh-79WT4DZbPQ-0cs,12897
371
- dissect.target-3.20.dev15.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
372
- dissect.target-3.20.dev15.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
373
- dissect.target-3.20.dev15.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
374
- dissect.target-3.20.dev15.dist-info/RECORD,,
369
+ dissect.target-3.20.dev17.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
370
+ dissect.target-3.20.dev17.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
371
+ dissect.target-3.20.dev17.dist-info/METADATA,sha256=b-FuP0zAaieA2KU6NYBKK1oQK45_bIreeC9TCgCLHvE,12897
372
+ dissect.target-3.20.dev17.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
373
+ dissect.target-3.20.dev17.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
374
+ dissect.target-3.20.dev17.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
375
+ dissect.target-3.20.dev17.dist-info/RECORD,,