dissect.target 3.19.dev29__py3-none-any.whl → 3.19.dev30__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ import subprocess
8
8
  from configparser import ConfigParser
9
9
  from configparser import Error as ConfigParserError
10
10
  from io import BytesIO
11
- from typing import Any, BinaryIO, Iterator, Optional, TextIO
11
+ from typing import Any, BinaryIO, Iterator, TextIO
12
12
 
13
13
  from defusedxml import ElementTree
14
14
  from dissect.hypervisor.util import vmtar
@@ -73,7 +73,7 @@ class ESXiPlugin(UnixPlugin):
73
73
  if configstore.exists():
74
74
  self._configstore = parse_config_store(configstore.open())
75
75
 
76
- def _cfg(self, path: str) -> Optional[str]:
76
+ def _cfg(self, path: str) -> str | None:
77
77
  if not self._config:
78
78
  self.target.log.warning("No ESXi config!")
79
79
  return None
@@ -87,7 +87,7 @@ class ESXiPlugin(UnixPlugin):
87
87
  return obj.get(value_name) if obj else None
88
88
 
89
89
  @classmethod
90
- def detect(cls, target: Target) -> Optional[Filesystem]:
90
+ def detect(cls, target: Target) -> Filesystem | None:
91
91
  bootbanks = [
92
92
  fs for fs in target.filesystems if fs.path("boot.cfg").exists() and list(fs.path("/").glob("*.v00"))
93
93
  ]
@@ -128,7 +128,7 @@ class ESXiPlugin(UnixPlugin):
128
128
  return "localhost"
129
129
 
130
130
  @export(property=True)
131
- def domain(self) -> Optional[str]:
131
+ def domain(self) -> str | None:
132
132
  if hostname := self._cfg("/adv/Misc/HostName"):
133
133
  return hostname.partition(".")[2]
134
134
 
@@ -146,7 +146,7 @@ class ESXiPlugin(UnixPlugin):
146
146
  return list(result)
147
147
 
148
148
  @export(property=True)
149
- def version(self) -> Optional[str]:
149
+ def version(self) -> str | None:
150
150
  boot_cfg = self.target.fs.path("/bootbank/boot.cfg")
151
151
  if not boot_cfg.exists():
152
152
  return None
@@ -187,11 +187,11 @@ class ESXiPlugin(UnixPlugin):
187
187
  return self._configstore
188
188
 
189
189
  @export(property=True)
190
- def os(self):
190
+ def os(self) -> str:
191
191
  return OperatingSystem.ESXI.value
192
192
 
193
193
 
194
- def _mount_modules(target: Target, sysvol: Filesystem, cfg: dict[str, str]):
194
+ def _mount_modules(target: Target, sysvol: Filesystem, cfg: dict[str, str]) -> None:
195
195
  modules = [m.strip() for m in cfg["modules"].split("---")]
196
196
 
197
197
  for module in modules:
@@ -218,20 +218,22 @@ def _mount_modules(target: Target, sysvol: Filesystem, cfg: dict[str, str]):
218
218
  target.fs.append_layer().mount("/", tfs)
219
219
 
220
220
 
221
- def _mount_local(target: Target, local_layer: VirtualFilesystem):
221
+ def _mount_local(target: Target, local_layer: VirtualFilesystem) -> None:
222
222
  local_tgz = target.fs.path("local.tgz")
223
+ local_tgz_ve = target.fs.path("local.tgz.ve")
223
224
  local_fs = None
224
225
 
225
226
  if local_tgz.exists():
226
227
  local_fs = tar.TarFilesystem(local_tgz.open())
227
- else:
228
- local_tgz_ve = target.fs.path("local.tgz.ve")
228
+ elif local_tgz_ve.exists():
229
229
  # In the case "encryption.info" does not exist, but ".#encryption.info" does
230
230
  encryption_info = next(target.fs.path("/").glob("*encryption.info"), None)
231
231
  if not local_tgz_ve.exists() or not encryption_info.exists():
232
232
  raise ValueError("Unable to find valid configuration archive")
233
233
 
234
234
  local_fs = _create_local_fs(target, local_tgz_ve, encryption_info)
235
+ else:
236
+ target.log.warning("No local.tgz or local.tgz.ve found, skipping local state")
235
237
 
236
238
  if local_fs:
237
239
  local_layer.mount("/", local_fs)
@@ -245,7 +247,7 @@ def _decrypt_envelope(local_tgz_ve: TargetPath, encryption_info: TargetPath) ->
245
247
  return local_tgz
246
248
 
247
249
 
248
- def _decrypt_crypto_util(local_tgz_ve: TargetPath) -> Optional[BytesIO]:
250
+ def _decrypt_crypto_util(local_tgz_ve: TargetPath) -> BytesIO | None:
249
251
  """Decrypt ``local.tgz.ve`` using ESXi ``crypto-util``.
250
252
 
251
253
  We write to stdout, but this results in ``crypto-util`` exiting with a non-zero return code
@@ -264,9 +266,7 @@ def _decrypt_crypto_util(local_tgz_ve: TargetPath) -> Optional[BytesIO]:
264
266
  return BytesIO(result.stdout)
265
267
 
266
268
 
267
- def _create_local_fs(
268
- target: Target, local_tgz_ve: TargetPath, encryption_info: TargetPath
269
- ) -> Optional[tar.TarFilesystem]:
269
+ def _create_local_fs(target: Target, local_tgz_ve: TargetPath, encryption_info: TargetPath) -> tar.TarFilesystem | None:
270
270
  local_tgz = None
271
271
 
272
272
  if HAS_ENVELOPE:
@@ -292,7 +292,7 @@ def _create_local_fs(
292
292
  return tar.TarFilesystem(local_tgz)
293
293
 
294
294
 
295
- def _mount_filesystems(target: Target, sysvol: Filesystem, cfg: dict[str, str]):
295
+ def _mount_filesystems(target: Target, sysvol: Filesystem, cfg: dict[str, str]) -> None:
296
296
  version = cfg["build"]
297
297
 
298
298
  osdata_fs = None
@@ -371,7 +371,7 @@ def _mount_filesystems(target: Target, sysvol: Filesystem, cfg: dict[str, str]):
371
371
  target.fs.symlink(f"/vmfs/volumes/LOCKER-{locker_fs.vmfs.uuid}", "/locker")
372
372
 
373
373
 
374
- def _link_log_dir(target: Target, cfg: dict[str, str], plugin_obj: ESXiPlugin):
374
+ def _link_log_dir(target: Target, cfg: dict[str, str], plugin_obj: ESXiPlugin) -> None:
375
375
  version = cfg["build"]
376
376
 
377
377
  # Don't really know how ESXi does this, but let's just take a shortcut for now
@@ -441,7 +441,7 @@ def parse_esx_conf(fh: TextIO) -> dict[str, Any]:
441
441
  return config
442
442
 
443
443
 
444
- def _traverse(path: str, obj: dict[str, Any], create: bool = False):
444
+ def _traverse(path: str, obj: dict[str, Any], create: bool = False) -> dict[str, Any] | None:
445
445
  parts = path.strip("/").split("/")
446
446
  path_parts = parts[:-1]
447
447
  for part in path_parts:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.19.dev29
3
+ Version: 3.19.dev30
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
@@ -208,7 +208,7 @@ dissect/target/plugins/os/unix/bsd/osx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JC
208
208
  dissect/target/plugins/os/unix/bsd/osx/_os.py,sha256=KvP7YJ7apVwoIop7MR-8q5QbVGoB6MdR42l6ssEe6es,4081
209
209
  dissect/target/plugins/os/unix/bsd/osx/user.py,sha256=qopB0s3n7e6Q7NjWzn8Z-dKtDtU7e6In4Vm7hIvvedo,2322
210
210
  dissect/target/plugins/os/unix/esxi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
211
- dissect/target/plugins/os/unix/esxi/_os.py,sha256=JOJ6j57vFCojgBNkju-7MG2nQqwl4Qc-agXTwjhZPgY,17644
211
+ dissect/target/plugins/os/unix/esxi/_os.py,sha256=s6pAgUyfHh3QcY6sgvk5uVMmLvqK1tIHWR7MSbrFn8w,17789
212
212
  dissect/target/plugins/os/unix/etc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
213
213
  dissect/target/plugins/os/unix/etc/etc.py,sha256=WNCtO7NWOKRDBiV-XjXqgPuGRDE_Zyw6XWz3kTm__QE,2493
214
214
  dissect/target/plugins/os/unix/linux/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.dev29.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
350
- dissect.target-3.19.dev29.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
351
- dissect.target-3.19.dev29.dist-info/METADATA,sha256=mE32WDUFrARni26ZPIFtiWS3iHI51FCZBoIz4IVFVL4,12719
352
- dissect.target-3.19.dev29.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
353
- dissect.target-3.19.dev29.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
354
- dissect.target-3.19.dev29.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
355
- dissect.target-3.19.dev29.dist-info/RECORD,,
349
+ dissect.target-3.19.dev30.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
350
+ dissect.target-3.19.dev30.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
351
+ dissect.target-3.19.dev30.dist-info/METADATA,sha256=fH2AsY4Du8s64GYdA4y4mJGfiEihIMfqkbOgE1ALNqc,12719
352
+ dissect.target-3.19.dev30.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
353
+ dissect.target-3.19.dev30.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
354
+ dissect.target-3.19.dev30.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
355
+ dissect.target-3.19.dev30.dist-info/RECORD,,