dissect.target 3.18.dev3__py3-none-any.whl → 3.18.dev4__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.dev4
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
@@ -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.dev4.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
344
+ dissect.target-3.18.dev4.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
345
+ dissect.target-3.18.dev4.dist-info/METADATA,sha256=gk5V6v0uboLj95v64bfrxLe_sT7-fksU2GJTOvRXBfE,11299
346
+ dissect.target-3.18.dev4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
347
+ dissect.target-3.18.dev4.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
348
+ dissect.target-3.18.dev4.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
349
+ dissect.target-3.18.dev4.dist-info/RECORD,,