dissect.target 3.18.dev3__py3-none-any.whl → 3.18.dev5__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.
@@ -147,7 +147,9 @@ class Cache:
147
147
  if os.access(cache_file, os.R_OK, effective_ids=bool(os.supports_effective_ids)):
148
148
  if os.stat(cache_file).st_size != 0:
149
149
  try:
150
- return self.open_reader(cache_file, output)
150
+ reader = self.open_reader(cache_file, output)
151
+ target.log.info("Using cache for function: %s", self.fname)
152
+ return reader
151
153
  except Exception as e:
152
154
  target.log.warning("Cache will NOT be used. Error opening cache file: %s", cache_file)
153
155
  target.log.debug("", exc_info=e)
@@ -113,6 +113,7 @@ class TargetCmd(cmd.Cmd):
113
113
  def __init__(self, target: Target):
114
114
  cmd.Cmd.__init__(self)
115
115
  self.target = target
116
+ self.debug = False
116
117
 
117
118
  def __getattr__(self, attr: str) -> Any:
118
119
  if attr.startswith("help_"):
@@ -179,25 +180,22 @@ class TargetCmd(cmd.Cmd):
179
180
  lexer.whitespace_split = True
180
181
  argparts = list(lexer)
181
182
 
182
- try:
183
- if "|" in argparts:
184
- pipeidx = argparts.index("|")
185
- argparts, pipeparts = argparts[:pipeidx], argparts[pipeidx + 1 :]
186
- try:
187
- with build_pipe_stdout(pipeparts) as pipe_stdin:
188
- return func(argparts, pipe_stdin)
189
- except OSError as e:
190
- # in case of a failure in a subprocess
191
- print(e)
192
- else:
193
- ctx = contextlib.nullcontext()
194
- if self.target.props.get("cyber") and not no_cyber:
195
- ctx = cyber.cyber(color=None, run_at_end=True)
183
+ if "|" in argparts:
184
+ pipeidx = argparts.index("|")
185
+ argparts, pipeparts = argparts[:pipeidx], argparts[pipeidx + 1 :]
186
+ try:
187
+ with build_pipe_stdout(pipeparts) as pipe_stdin:
188
+ return func(argparts, pipe_stdin)
189
+ except OSError as e:
190
+ # in case of a failure in a subprocess
191
+ print(e)
192
+ else:
193
+ ctx = contextlib.nullcontext()
194
+ if self.target.props.get("cyber") and not no_cyber:
195
+ ctx = cyber.cyber(color=None, run_at_end=True)
196
196
 
197
- with ctx:
198
- return func(argparts, sys.stdout)
199
- except IOError:
200
- pass
197
+ with ctx:
198
+ return func(argparts, sys.stdout)
201
199
 
202
200
  def _exec_command(self, command: str, command_args_str: str) -> Optional[bool]:
203
201
  """Command execution helper for ``cmd_`` commands."""
@@ -279,6 +277,14 @@ class TargetCmd(cmd.Cmd):
279
277
  """exit shell"""
280
278
  return True
281
279
 
280
+ def do_debug(self, line: str) -> Optional[bool]:
281
+ """toggle debug mode"""
282
+ self.debug = not self.debug
283
+ if self.debug:
284
+ print("Debug mode on")
285
+ else:
286
+ print("Debug mode off")
287
+
282
288
 
283
289
  class TargetHubCli(cmd.Cmd):
284
290
  """Hub Cli for interacting with multiple targets."""
@@ -1241,7 +1247,12 @@ def run_cli(cli: cmd.Cmd) -> None:
1241
1247
  print()
1242
1248
  pass
1243
1249
  except Exception as e:
1244
- log.exception(e)
1250
+ if cli.debug:
1251
+ log.exception(e)
1252
+ else:
1253
+ log.info(e)
1254
+ print(f"*** Unhandled error: {e}")
1255
+ print("If you wish to see the full debug trace, enable debug mode.")
1245
1256
  pass
1246
1257
 
1247
1258
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.18.dev3
3
+ Version: 3.18.dev5
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
@@ -44,7 +44,7 @@ dissect/target/filesystems/vmtar.py,sha256=LlKWkTIuLemQmG9yGqL7980uC_AOL77_GWhbJ
44
44
  dissect/target/filesystems/xfs.py,sha256=kIyFGKYlyFYC7H3jaEv-lNKtBW4ZkD92H0WpfGcr1ww,4498
45
45
  dissect/target/filesystems/zip.py,sha256=WT1bQhzX_1MXXVZTKrJniae4xqRqMZ8FsfbvhgGQRTQ,4462
46
46
  dissect/target/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
- dissect/target/helpers/cache.py,sha256=_0w_iPD1OM066Ueyadb70erQW05jNnpJe-bDDN1UyXc,8444
47
+ dissect/target/helpers/cache.py,sha256=TXlJBdFRz6V9zKs903am4Yawr0maYw5kZY0RqklDQJM,8568
48
48
  dissect/target/helpers/config.py,sha256=6917CZ6eDHaK_tOoiVEIndyhRXO6r6eCBIleq6f47PQ,2346
49
49
  dissect/target/helpers/configutil.py,sha256=Q4qVD_XSawG0MYrTzAjezWL-pCZMAW14Zmg54KGUddU,25637
50
50
  dissect/target/helpers/cyber.py,sha256=Ki5oSU0GgQxjgC_yWoeieGP7GOY5blQCzNX7vy7Pgas,16782
@@ -326,7 +326,7 @@ dissect/target/tools/logging.py,sha256=5ZnumtMWLyslxfrUGZ4ntRyf3obOOhmn8SBjKfdLc
326
326
  dissect/target/tools/mount.py,sha256=L_0tSmiBdW4aSaF0vXjB0bAkTC0kmT2N1hrbW6s5Jow,3254
327
327
  dissect/target/tools/query.py,sha256=ONHu2FVomLccikb84qBrlhNmEfRoHYFQMcahk_y2c9A,15580
328
328
  dissect/target/tools/reg.py,sha256=FDsiBBDxjWVUBTRj8xn82vZe-J_d9piM-TKS3PHZCcM,3193
329
- dissect/target/tools/shell.py,sha256=4v6Z06YJDjKv6e6SRvWNjQ2n_KHo_CjL4P0w1_gY_ro,44827
329
+ dissect/target/tools/shell.py,sha256=1Z-gYRlJu0rmFI20taatlofrvp52ac_arXG8AMhwj0w,45182
330
330
  dissect/target/tools/utils.py,sha256=sQizexY3ui5vmWw4KOBLg5ecK3TPFjD-uxDqRn56ZTY,11304
331
331
  dissect/target/tools/dump/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
332
332
  dissect/target/tools/dump/run.py,sha256=aD84peRS4zHqC78fH7Vd4ni3m1ZmVP70LyMwBRvoDGY,9463
@@ -340,10 +340,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
340
340
  dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
341
341
  dissect/target/volumes/md.py,sha256=j1K1iKmspl0C_OJFc7-Q1BMWN2OCC5EVANIgVlJ_fIE,1673
342
342
  dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
343
- dissect.target-3.18.dev3.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
344
- dissect.target-3.18.dev3.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
345
- dissect.target-3.18.dev3.dist-info/METADATA,sha256=t5yUGDDtnDgTACRs1bUW1xJF2rlVMzxbFW0iWG5WRUw,11299
346
- dissect.target-3.18.dev3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
347
- dissect.target-3.18.dev3.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
348
- dissect.target-3.18.dev3.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
349
- dissect.target-3.18.dev3.dist-info/RECORD,,
343
+ dissect.target-3.18.dev5.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
344
+ dissect.target-3.18.dev5.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
345
+ dissect.target-3.18.dev5.dist-info/METADATA,sha256=wBA3ehlJ0xuwPlvLfhY13YfMg2Fm8w8XIzeWGK5-Ksk,11299
346
+ dissect.target-3.18.dev5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
347
+ dissect.target-3.18.dev5.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
348
+ dissect.target-3.18.dev5.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
349
+ dissect.target-3.18.dev5.dist-info/RECORD,,