dissect.target 3.20.dev19__py3-none-any.whl → 3.20.dev20__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- dissect/target/tools/shell.py +16 -7
- {dissect.target-3.20.dev19.dist-info → dissect.target-3.20.dev20.dist-info}/METADATA +1 -1
- {dissect.target-3.20.dev19.dist-info → dissect.target-3.20.dev20.dist-info}/RECORD +8 -8
- {dissect.target-3.20.dev19.dist-info → dissect.target-3.20.dev20.dist-info}/COPYRIGHT +0 -0
- {dissect.target-3.20.dev19.dist-info → dissect.target-3.20.dev20.dist-info}/LICENSE +0 -0
- {dissect.target-3.20.dev19.dist-info → dissect.target-3.20.dev20.dist-info}/WHEEL +0 -0
- {dissect.target-3.20.dev19.dist-info → dissect.target-3.20.dev20.dist-info}/entry_points.txt +0 -0
- {dissect.target-3.20.dev19.dist-info → dissect.target-3.20.dev20.dist-info}/top_level.txt +0 -0
dissect/target/tools/shell.py
CHANGED
@@ -1410,29 +1410,38 @@ def build_pipe_stdout(pipe_parts: list[str]) -> Iterator[TextIO]:
|
|
1410
1410
|
yield pipe_stdin
|
1411
1411
|
|
1412
1412
|
|
1413
|
-
def open_shell(targets: list[str | pathlib.Path], python: bool, registry: bool) -> None:
|
1413
|
+
def open_shell(targets: list[str | pathlib.Path], python: bool, registry: bool, commands: list[str] | None) -> None:
|
1414
1414
|
"""Helper method for starting a regular, Python or registry shell for one or multiple targets."""
|
1415
1415
|
targets = list(Target.open_all(targets))
|
1416
1416
|
|
1417
1417
|
if python:
|
1418
|
-
python_shell(targets)
|
1418
|
+
python_shell(targets, commands=commands)
|
1419
1419
|
else:
|
1420
1420
|
cli_cls = RegistryCli if registry else TargetCli
|
1421
|
-
target_shell(targets, cli_cls=cli_cls)
|
1421
|
+
target_shell(targets, cli_cls=cli_cls, commands=commands)
|
1422
1422
|
|
1423
1423
|
|
1424
|
-
def target_shell(targets: list[Target], cli_cls: type[TargetCmd]) -> None:
|
1424
|
+
def target_shell(targets: list[Target], cli_cls: type[TargetCmd], commands: list[str] | None) -> None:
|
1425
1425
|
"""Helper method for starting a :class:`TargetCli` or :class:`TargetHubCli` for one or multiple targets."""
|
1426
1426
|
if cli := create_cli(targets, cli_cls):
|
1427
|
+
if commands is not None:
|
1428
|
+
for command in commands:
|
1429
|
+
cli.onecmd(command)
|
1430
|
+
return
|
1427
1431
|
run_cli(cli)
|
1428
1432
|
|
1429
1433
|
|
1430
|
-
def python_shell(targets: list[Target]) -> None:
|
1434
|
+
def python_shell(targets: list[Target], commands: list[str] | None) -> None:
|
1431
1435
|
"""Helper method for starting a (I)Python shell with multiple targets."""
|
1432
1436
|
banner = "Loaded targets in 'targets' variable. First target is in 't'."
|
1433
1437
|
ns = {"targets": targets, "t": targets[0]}
|
1434
1438
|
|
1435
1439
|
try:
|
1440
|
+
if commands is not None:
|
1441
|
+
for command in commands:
|
1442
|
+
eval(command, ns)
|
1443
|
+
return
|
1444
|
+
|
1436
1445
|
import IPython
|
1437
1446
|
|
1438
1447
|
IPython.embed(header=banner, user_ns=ns, colors="linux")
|
@@ -1512,7 +1521,7 @@ def main() -> None:
|
|
1512
1521
|
default=None,
|
1513
1522
|
help="select a specific loader (i.e. vmx, raw)",
|
1514
1523
|
)
|
1515
|
-
|
1524
|
+
parser.add_argument("-c", "--commands", action="store", nargs="*", help="commands to execute")
|
1516
1525
|
configure_generic_arguments(parser)
|
1517
1526
|
args, rest = parser.parse_known_args()
|
1518
1527
|
args.targets = args_to_uri(args.targets, args.loader, rest) if args.loader else args.targets
|
@@ -1537,7 +1546,7 @@ def main() -> None:
|
|
1537
1546
|
)
|
1538
1547
|
|
1539
1548
|
try:
|
1540
|
-
open_shell(args.targets, args.python, args.registry)
|
1549
|
+
open_shell(args.targets, args.python, args.registry, args.commands)
|
1541
1550
|
except TargetError as e:
|
1542
1551
|
log.error(e)
|
1543
1552
|
log.debug("", exc_info=e)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dissect.target
|
3
|
-
Version: 3.20.
|
3
|
+
Version: 3.20.dev20
|
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
|
@@ -353,7 +353,7 @@ dissect/target/tools/logging.py,sha256=5ZnumtMWLyslxfrUGZ4ntRyf3obOOhmn8SBjKfdLc
|
|
353
353
|
dissect/target/tools/mount.py,sha256=8GRYnu4xEmFBHxuIZAYhOMyyTGX8fat1Ou07DNiUnW4,3945
|
354
354
|
dissect/target/tools/query.py,sha256=e-yAN9zdQjuOiTuoOQoo17mVEQGGcOgaA9YkF4GYpkM,15394
|
355
355
|
dissect/target/tools/reg.py,sha256=FDsiBBDxjWVUBTRj8xn82vZe-J_d9piM-TKS3PHZCcM,3193
|
356
|
-
dissect/target/tools/shell.py,sha256=
|
356
|
+
dissect/target/tools/shell.py,sha256=EBGuQS2PDfDgLPghgAjK1G7zoAjm2Gu6eZ9yz0qsuk4,54198
|
357
357
|
dissect/target/tools/utils.py,sha256=JJZDSso1CEK2sv4Z3HJNgqxH6G9S5lbmV-C3h-XmcMo,12035
|
358
358
|
dissect/target/tools/yara.py,sha256=70k-2VMulf1EdkX03nCACzejaOEcsFHOyX-4E40MdQU,2044
|
359
359
|
dissect/target/tools/dump/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -368,10 +368,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
|
|
368
368
|
dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
|
369
369
|
dissect/target/volumes/md.py,sha256=7ShPtusuLGaIv27SvEETtgsuoQyAa4iAAeOR1NEaajI,1689
|
370
370
|
dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
|
371
|
-
dissect.target-3.20.
|
372
|
-
dissect.target-3.20.
|
373
|
-
dissect.target-3.20.
|
374
|
-
dissect.target-3.20.
|
375
|
-
dissect.target-3.20.
|
376
|
-
dissect.target-3.20.
|
377
|
-
dissect.target-3.20.
|
371
|
+
dissect.target-3.20.dev20.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
|
372
|
+
dissect.target-3.20.dev20.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
373
|
+
dissect.target-3.20.dev20.dist-info/METADATA,sha256=qcWPvlyV_0KYf8HyQw-3mgtk1fjvjHv9cWtY9-ab4GM,12897
|
374
|
+
dissect.target-3.20.dev20.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
375
|
+
dissect.target-3.20.dev20.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
|
376
|
+
dissect.target-3.20.dev20.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
|
377
|
+
dissect.target-3.20.dev20.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
{dissect.target-3.20.dev19.dist-info → dissect.target-3.20.dev20.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|