dissect.target 3.19.dev57__py3-none-any.whl → 3.20__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- dissect/target/container.py +1 -1
- dissect/target/exceptions.py +6 -5
- dissect/target/filesystem.py +2 -2
- dissect/target/filesystems/btrfs.py +14 -5
- dissect/target/filesystems/config.py +5 -1
- dissect/target/filesystems/extfs.py +5 -4
- dissect/target/filesystems/fat.py +22 -16
- dissect/target/filesystems/ffs.py +11 -4
- dissect/target/filesystems/jffs.py +12 -7
- dissect/target/filesystems/ntfs.py +22 -6
- dissect/target/filesystems/overlay.py +14 -4
- dissect/target/filesystems/smb.py +3 -3
- dissect/target/filesystems/squashfs.py +4 -4
- dissect/target/filesystems/vmfs.py +4 -4
- dissect/target/filesystems/xfs.py +15 -8
- dissect/target/helpers/compat/path_common.py +5 -5
- dissect/target/helpers/configutil.py +128 -32
- dissect/target/helpers/cyber.py +2 -0
- dissect/target/helpers/data/windowsZones.xml +19 -23
- dissect/target/helpers/docs.py +1 -1
- dissect/target/helpers/keychain.py +2 -0
- dissect/target/helpers/mount.py +2 -1
- dissect/target/helpers/record.py +29 -2
- dissect/target/helpers/record_modifier.py +5 -1
- dissect/target/helpers/regutil.py +56 -26
- dissect/target/loader.py +1 -1
- dissect/target/loaders/mqtt.py +104 -9
- dissect/target/loaders/proxmox.py +68 -0
- dissect/target/loaders/vma.py +1 -1
- dissect/target/loaders/xva.py +1 -1
- dissect/target/plugin.py +24 -21
- dissect/target/plugins/apps/av/mcafee.py +2 -0
- dissect/target/plugins/apps/av/sophos.py +2 -0
- dissect/target/plugins/apps/av/trendmicro.py +2 -0
- dissect/target/plugins/apps/browser/chromium.py +27 -6
- dissect/target/plugins/apps/container/docker.py +48 -32
- dissect/target/plugins/apps/editor/__init__.py +0 -0
- dissect/target/plugins/apps/editor/editor.py +23 -0
- dissect/target/plugins/apps/{texteditor → editor}/windowsnotepad.py +40 -31
- dissect/target/plugins/apps/other/__init__.py +0 -0
- dissect/target/plugins/apps/other/env.py +56 -0
- dissect/target/plugins/apps/shell/powershell.py +6 -2
- dissect/target/plugins/apps/shell/wget.py +91 -0
- dissect/target/plugins/apps/ssh/openssh.py +2 -0
- dissect/target/plugins/apps/ssh/opensshd.py +2 -0
- dissect/target/plugins/apps/virtualization/__init__.py +0 -0
- dissect/target/plugins/apps/virtualization/vmware_workstation.py +61 -0
- dissect/target/plugins/apps/vpn/wireguard.py +9 -9
- dissect/target/plugins/apps/webhosting/cpanel.py +2 -0
- dissect/target/plugins/apps/webserver/caddy.py +2 -0
- dissect/target/plugins/apps/webserver/nginx.py +2 -0
- dissect/target/plugins/child/esxi.py +3 -1
- dissect/target/plugins/child/parallels.py +68 -0
- dissect/target/plugins/child/proxmox.py +23 -0
- dissect/target/plugins/child/virtuozzo.py +12 -8
- dissect/target/plugins/child/vmware_workstation.py +23 -8
- dissect/target/plugins/filesystem/acquire_hash.py +2 -1
- dissect/target/plugins/filesystem/icat.py +15 -11
- dissect/target/plugins/filesystem/ntfs/mft.py +10 -6
- dissect/target/plugins/filesystem/ntfs/mft_timeline.py +3 -1
- dissect/target/plugins/filesystem/ntfs/usnjrnl.py +2 -0
- dissect/target/plugins/filesystem/ntfs/utils.py +3 -1
- dissect/target/plugins/filesystem/unix/suid.py +4 -1
- dissect/target/plugins/filesystem/walkfs.py +2 -0
- dissect/target/plugins/general/example.py +2 -2
- dissect/target/plugins/general/loaders.py +18 -5
- dissect/target/plugins/general/network.py +20 -5
- dissect/target/plugins/general/osinfo.py +1 -0
- dissect/target/plugins/general/plugins.py +53 -10
- dissect/target/plugins/os/unix/_os.py +70 -44
- dissect/target/plugins/os/unix/applications.py +78 -0
- dissect/target/plugins/os/unix/bsd/citrix/history.py +2 -0
- dissect/target/plugins/os/unix/bsd/osx/_os.py +4 -21
- dissect/target/plugins/os/unix/bsd/osx/network.py +92 -0
- dissect/target/plugins/os/unix/bsd/osx/user.py +4 -0
- dissect/target/plugins/os/unix/cronjobs.py +8 -4
- dissect/target/plugins/os/unix/etc/etc.py +4 -0
- dissect/target/plugins/os/unix/generic.py +2 -0
- dissect/target/plugins/os/unix/history.py +27 -25
- dissect/target/plugins/os/unix/linux/_os.py +8 -10
- dissect/target/plugins/os/unix/linux/cmdline.py +2 -0
- dissect/target/plugins/os/unix/linux/debian/apt.py +4 -1
- dissect/target/plugins/os/unix/linux/debian/dpkg.py +3 -3
- dissect/target/plugins/os/unix/linux/debian/proxmox/__init__.py +0 -0
- dissect/target/plugins/os/unix/linux/debian/proxmox/_os.py +141 -0
- dissect/target/plugins/os/unix/linux/debian/proxmox/vm.py +29 -0
- dissect/target/plugins/os/unix/linux/debian/snap.py +79 -0
- dissect/target/plugins/os/unix/linux/environ.py +2 -0
- dissect/target/plugins/os/unix/linux/fortios/_os.py +74 -63
- dissect/target/plugins/os/unix/linux/fortios/generic.py +2 -0
- dissect/target/plugins/os/unix/linux/fortios/locale.py +2 -0
- dissect/target/plugins/os/unix/linux/modules.py +2 -0
- dissect/target/plugins/os/unix/linux/netstat.py +2 -0
- dissect/target/{helpers → plugins/os/unix/linux}/network_managers.py +11 -9
- dissect/target/plugins/os/unix/linux/processes.py +2 -0
- dissect/target/plugins/os/unix/linux/redhat/yum.py +4 -1
- dissect/target/plugins/os/unix/linux/services.py +5 -3
- dissect/target/plugins/os/unix/linux/sockets.py +2 -0
- dissect/target/plugins/os/unix/linux/suse/zypper.py +4 -1
- dissect/target/plugins/os/unix/locale.py +2 -0
- dissect/target/plugins/os/unix/locate/gnulocate.py +4 -2
- dissect/target/plugins/os/unix/locate/mlocate.py +2 -0
- dissect/target/plugins/os/unix/locate/plocate.py +3 -1
- dissect/target/plugins/os/unix/log/atop.py +2 -0
- dissect/target/plugins/os/unix/log/audit.py +3 -1
- dissect/target/plugins/os/unix/log/auth.py +351 -38
- dissect/target/plugins/os/unix/log/journal.py +123 -101
- dissect/target/plugins/os/unix/log/lastlog.py +5 -3
- dissect/target/plugins/os/unix/log/messages.py +51 -27
- dissect/target/plugins/os/unix/log/utmp.py +52 -71
- dissect/target/plugins/os/unix/packagemanager.py +5 -38
- dissect/target/plugins/os/unix/shadow.py +3 -1
- dissect/target/plugins/os/unix/trash.py +132 -0
- dissect/target/plugins/os/windows/_os.py +22 -41
- dissect/target/plugins/os/windows/activitiescache.py +9 -4
- dissect/target/plugins/os/windows/adpolicy.py +2 -1
- dissect/target/plugins/os/windows/amcache.py +16 -13
- dissect/target/plugins/os/windows/defender.py +4 -3
- dissect/target/plugins/os/windows/dpapi/keyprovider/credhist.py +3 -0
- dissect/target/plugins/os/windows/dpapi/keyprovider/empty.py +3 -0
- dissect/target/plugins/os/windows/dpapi/keyprovider/keychain.py +3 -0
- dissect/target/plugins/os/windows/dpapi/keyprovider/lsa.py +3 -0
- dissect/target/plugins/os/windows/env.py +1 -2
- dissect/target/plugins/os/windows/exchange/exchange.py +6 -4
- dissect/target/plugins/os/windows/generic.py +68 -19
- dissect/target/plugins/os/windows/lnk.py +2 -0
- dissect/target/plugins/os/windows/locale.py +9 -3
- dissect/target/plugins/os/windows/log/etl.py +5 -4
- dissect/target/plugins/os/windows/log/evt.py +12 -8
- dissect/target/plugins/os/windows/log/evtx.py +9 -7
- dissect/target/plugins/os/windows/log/mssql.py +103 -0
- dissect/target/plugins/os/windows/log/pfro.py +2 -1
- dissect/target/plugins/os/windows/network.py +380 -0
- dissect/target/plugins/os/windows/notifications.py +6 -4
- dissect/target/plugins/os/windows/prefetch.py +7 -2
- dissect/target/plugins/os/windows/regf/7zip.py +9 -1
- dissect/target/plugins/os/windows/regf/applications.py +62 -0
- dissect/target/plugins/os/windows/regf/auditpol.py +2 -1
- dissect/target/plugins/os/windows/regf/bam.py +3 -1
- dissect/target/plugins/os/windows/regf/cit.py +14 -12
- dissect/target/plugins/os/windows/regf/clsid.py +6 -3
- dissect/target/plugins/os/windows/regf/firewall.py +2 -1
- dissect/target/plugins/os/windows/regf/mru.py +9 -8
- dissect/target/plugins/os/windows/regf/nethist.py +6 -3
- dissect/target/plugins/os/windows/regf/recentfilecache.py +3 -1
- dissect/target/plugins/os/windows/regf/regf.py +5 -1
- dissect/target/plugins/os/windows/regf/shellbags.py +351 -345
- dissect/target/plugins/os/windows/regf/shimcache.py +1 -1
- dissect/target/plugins/os/windows/regf/usb.py +2 -1
- dissect/target/plugins/os/windows/regf/userassist.py +2 -1
- dissect/target/plugins/os/windows/registry.py +11 -0
- dissect/target/plugins/os/windows/services.py +3 -2
- dissect/target/plugins/os/windows/startupinfo.py +7 -2
- dissect/target/plugins/os/windows/syscache.py +5 -2
- dissect/target/plugins/os/windows/tasks.py +1 -1
- dissect/target/plugins/os/windows/thumbcache.py +11 -5
- dissect/target/plugins/os/windows/ual.py +12 -9
- dissect/target/plugins/os/windows/wer.py +21 -6
- dissect/target/plugins/os/windows/wua_history.py +0 -1
- dissect/target/target.py +13 -8
- dissect/target/tools/dump/utils.py +4 -0
- dissect/target/tools/fsutils.py +1 -1
- dissect/target/tools/info.py +1 -1
- dissect/target/tools/mount.py +15 -5
- dissect/target/tools/query.py +15 -9
- dissect/target/tools/shell.py +98 -9
- dissect/target/tools/utils.py +7 -7
- dissect/target/volume.py +4 -4
- {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/METADATA +6 -2
- {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/RECORD +176 -160
- {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/WHEEL +1 -1
- dissect/target/helpers/targetd.py +0 -58
- dissect/target/loaders/targetd.py +0 -223
- dissect/target/plugins/apps/texteditor/texteditor.py +0 -13
- dissect/target/plugins/os/unix/etc.py +0 -9
- /dissect/target/plugins/apps/{texteditor → database}/__init__.py +0 -0
- {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/COPYRIGHT +0 -0
- {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/LICENSE +0 -0
- {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/entry_points.txt +0 -0
- {dissect.target-3.19.dev57.dist-info → dissect.target-3.20.dist-info}/top_level.txt +0 -0
dissect/target/tools/shell.py
CHANGED
@@ -95,6 +95,8 @@ class ExtendedCmd(cmd.Cmd):
|
|
95
95
|
"""
|
96
96
|
|
97
97
|
CMD_PREFIX = "cmd_"
|
98
|
+
_runtime_aliases = {}
|
99
|
+
DEFAULT_RUNCOMMANDS_FILE = None
|
98
100
|
|
99
101
|
def __init__(self, cyber: bool = False):
|
100
102
|
cmd.Cmd.__init__(self)
|
@@ -120,6 +122,28 @@ class ExtendedCmd(cmd.Cmd):
|
|
120
122
|
|
121
123
|
return object.__getattribute__(self, attr)
|
122
124
|
|
125
|
+
def _load_targetrc(self, path: pathlib.Path) -> None:
|
126
|
+
"""Load and execute commands from the run commands file."""
|
127
|
+
try:
|
128
|
+
with path.open() as fh:
|
129
|
+
for line in fh:
|
130
|
+
if (line := line.strip()) and not line.startswith("#"): # Ignore empty lines and comments
|
131
|
+
self.onecmd(line)
|
132
|
+
except FileNotFoundError:
|
133
|
+
# The .targetrc file is optional
|
134
|
+
pass
|
135
|
+
except Exception as e:
|
136
|
+
log.debug("Error processing .targetrc file: %s", e)
|
137
|
+
|
138
|
+
def _get_targetrc_path(self) -> pathlib.Path | None:
|
139
|
+
"""Get the path to the run commands file. Can return ``None`` if ``DEFAULT_RUNCOMMANDS_FILE`` is not set."""
|
140
|
+
return pathlib.Path(self.DEFAULT_RUNCOMMANDS_FILE).expanduser() if self.DEFAULT_RUNCOMMANDS_FILE else None
|
141
|
+
|
142
|
+
def preloop(self) -> None:
|
143
|
+
super().preloop()
|
144
|
+
if targetrc_path := self._get_targetrc_path():
|
145
|
+
self._load_targetrc(targetrc_path)
|
146
|
+
|
123
147
|
@staticmethod
|
124
148
|
def check_compatible(target: Target) -> bool:
|
125
149
|
return True
|
@@ -164,6 +188,11 @@ class ExtendedCmd(cmd.Cmd):
|
|
164
188
|
return None
|
165
189
|
|
166
190
|
def default(self, line: str) -> bool:
|
191
|
+
com, arg, _ = self.parseline(line)
|
192
|
+
if com in self._runtime_aliases:
|
193
|
+
expanded = " ".join([self._runtime_aliases[com], arg])
|
194
|
+
return self.onecmd(expanded)
|
195
|
+
|
167
196
|
if (should_exit := self._handle_command(line)) is not None:
|
168
197
|
return should_exit
|
169
198
|
|
@@ -176,7 +205,8 @@ class ExtendedCmd(cmd.Cmd):
|
|
176
205
|
|
177
206
|
When entering an empty command, the cmd module will by default repeat the previous command.
|
178
207
|
By defining an empty ``emptyline`` function we make sure no command is executed instead.
|
179
|
-
|
208
|
+
|
209
|
+
References:
|
180
210
|
- https://stackoverflow.com/a/16479030
|
181
211
|
- https://github.com/python/cpython/blob/3.12/Lib/cmd.py#L10
|
182
212
|
"""
|
@@ -230,6 +260,43 @@ class ExtendedCmd(cmd.Cmd):
|
|
230
260
|
def complete_man(self, *args) -> list[str]:
|
231
261
|
return cmd.Cmd.complete_help(self, *args)
|
232
262
|
|
263
|
+
def do_unalias(self, line: str) -> bool:
|
264
|
+
"""delete runtime alias"""
|
265
|
+
aliases = list(shlex.shlex(line, posix=True))
|
266
|
+
for aliased in aliases:
|
267
|
+
if aliased in self._runtime_aliases:
|
268
|
+
del self._runtime_aliases[aliased]
|
269
|
+
else:
|
270
|
+
print(f"alias {aliased} not found")
|
271
|
+
return False
|
272
|
+
|
273
|
+
def do_alias(self, line: str) -> bool:
|
274
|
+
"""create a runtime alias"""
|
275
|
+
args = list(shlex.shlex(line, posix=True))
|
276
|
+
|
277
|
+
if not args:
|
278
|
+
for aliased, command in self._runtime_aliases.items():
|
279
|
+
print(f"alias {aliased}={command}")
|
280
|
+
return False
|
281
|
+
|
282
|
+
while args:
|
283
|
+
alias_name = args.pop(0)
|
284
|
+
try:
|
285
|
+
equals = args.pop(0)
|
286
|
+
# our parser works different, so we have to stop this
|
287
|
+
if equals != "=":
|
288
|
+
raise RuntimeError("Token not allowed")
|
289
|
+
expanded = args.pop(0) if args else "" # this is how it works in bash
|
290
|
+
self._runtime_aliases[alias_name] = expanded
|
291
|
+
except IndexError:
|
292
|
+
if alias_name in self._runtime_aliases:
|
293
|
+
print(f"alias {alias_name}={self._runtime_aliases[alias_name]}")
|
294
|
+
else:
|
295
|
+
print(f"alias {alias_name} not found")
|
296
|
+
pass
|
297
|
+
|
298
|
+
return False
|
299
|
+
|
233
300
|
def do_clear(self, line: str) -> bool:
|
234
301
|
"""clear the terminal screen"""
|
235
302
|
os.system("cls||clear")
|
@@ -266,6 +333,8 @@ class TargetCmd(ExtendedCmd):
|
|
266
333
|
DEFAULT_HISTFILESIZE = 10_000
|
267
334
|
DEFAULT_HISTDIR = None
|
268
335
|
DEFAULT_HISTDIRFMT = ".dissect_history_{uid}_{target}"
|
336
|
+
DEFAULT_RUNCOMMANDS_FILE = "~/.targetrc"
|
337
|
+
CONFIG_KEY_RUNCOMMANDS_FILE = "TARGETRCFILE"
|
269
338
|
|
270
339
|
def __init__(self, target: Target):
|
271
340
|
self.target = target
|
@@ -295,7 +364,15 @@ class TargetCmd(ExtendedCmd):
|
|
295
364
|
|
296
365
|
super().__init__(self.target.props.get("cyber"))
|
297
366
|
|
367
|
+
def _get_targetrc_path(self) -> pathlib.Path:
|
368
|
+
"""Get the path to the run commands file."""
|
369
|
+
|
370
|
+
return pathlib.Path(
|
371
|
+
getattr(self.target._config, self.CONFIG_KEY_RUNCOMMANDS_FILE, self.DEFAULT_RUNCOMMANDS_FILE)
|
372
|
+
).expanduser()
|
373
|
+
|
298
374
|
def preloop(self) -> None:
|
375
|
+
super().preloop()
|
299
376
|
if readline and self.histfile.exists():
|
300
377
|
try:
|
301
378
|
readline.read_history_file(self.histfile)
|
@@ -464,7 +541,6 @@ class TargetCli(TargetCmd):
|
|
464
541
|
self.prompt_base = _target_name(target)
|
465
542
|
|
466
543
|
TargetCmd.__init__(self, target)
|
467
|
-
|
468
544
|
self._clicache = {}
|
469
545
|
self.cwd = None
|
470
546
|
self.chdir("/")
|
@@ -1101,6 +1177,10 @@ class UnixConfigTreeCli(TargetCli):
|
|
1101
1177
|
class RegistryCli(TargetCmd):
|
1102
1178
|
"""CLI for browsing the registry."""
|
1103
1179
|
|
1180
|
+
# Registry shell is incompatible with default shell, so override the default rc file and config key
|
1181
|
+
DEFAULT_RUNCOMMANDS_FILE = "~/.targetrc.registry"
|
1182
|
+
CONFIG_KEY_RUNCOMMANDS_FILE = "TARGETRCFILE_REGISTRY"
|
1183
|
+
|
1104
1184
|
def __init__(self, target: Target, registry: regutil.RegfHive | None = None):
|
1105
1185
|
self.prompt_base = _target_name(target)
|
1106
1186
|
|
@@ -1331,29 +1411,38 @@ def build_pipe_stdout(pipe_parts: list[str]) -> Iterator[TextIO]:
|
|
1331
1411
|
yield pipe_stdin
|
1332
1412
|
|
1333
1413
|
|
1334
|
-
def open_shell(targets: list[str | pathlib.Path], python: bool, registry: bool) -> None:
|
1414
|
+
def open_shell(targets: list[str | pathlib.Path], python: bool, registry: bool, commands: list[str] | None) -> None:
|
1335
1415
|
"""Helper method for starting a regular, Python or registry shell for one or multiple targets."""
|
1336
1416
|
targets = list(Target.open_all(targets))
|
1337
1417
|
|
1338
1418
|
if python:
|
1339
|
-
python_shell(targets)
|
1419
|
+
python_shell(targets, commands=commands)
|
1340
1420
|
else:
|
1341
1421
|
cli_cls = RegistryCli if registry else TargetCli
|
1342
|
-
target_shell(targets, cli_cls=cli_cls)
|
1422
|
+
target_shell(targets, cli_cls=cli_cls, commands=commands)
|
1343
1423
|
|
1344
1424
|
|
1345
|
-
def target_shell(targets: list[Target], cli_cls: type[TargetCmd]) -> None:
|
1425
|
+
def target_shell(targets: list[Target], cli_cls: type[TargetCmd], commands: list[str] | None) -> None:
|
1346
1426
|
"""Helper method for starting a :class:`TargetCli` or :class:`TargetHubCli` for one or multiple targets."""
|
1347
1427
|
if cli := create_cli(targets, cli_cls):
|
1428
|
+
if commands is not None:
|
1429
|
+
for command in commands:
|
1430
|
+
cli.onecmd(command)
|
1431
|
+
return
|
1348
1432
|
run_cli(cli)
|
1349
1433
|
|
1350
1434
|
|
1351
|
-
def python_shell(targets: list[Target]) -> None:
|
1435
|
+
def python_shell(targets: list[Target], commands: list[str] | None = None) -> None:
|
1352
1436
|
"""Helper method for starting a (I)Python shell with multiple targets."""
|
1353
1437
|
banner = "Loaded targets in 'targets' variable. First target is in 't'."
|
1354
1438
|
ns = {"targets": targets, "t": targets[0]}
|
1355
1439
|
|
1356
1440
|
try:
|
1441
|
+
if commands is not None:
|
1442
|
+
for command in commands:
|
1443
|
+
eval(command, ns)
|
1444
|
+
return
|
1445
|
+
|
1357
1446
|
import IPython
|
1358
1447
|
|
1359
1448
|
IPython.embed(header=banner, user_ns=ns, colors="linux")
|
@@ -1433,7 +1522,7 @@ def main() -> None:
|
|
1433
1522
|
default=None,
|
1434
1523
|
help="select a specific loader (i.e. vmx, raw)",
|
1435
1524
|
)
|
1436
|
-
|
1525
|
+
parser.add_argument("-c", "--commands", action="store", nargs="*", help="commands to execute")
|
1437
1526
|
configure_generic_arguments(parser)
|
1438
1527
|
args, rest = parser.parse_known_args()
|
1439
1528
|
args.targets = args_to_uri(args.targets, args.loader, rest) if args.loader else args.targets
|
@@ -1458,7 +1547,7 @@ def main() -> None:
|
|
1458
1547
|
)
|
1459
1548
|
|
1460
1549
|
try:
|
1461
|
-
open_shell(args.targets, args.python, args.registry)
|
1550
|
+
open_shell(args.targets, args.python, args.registry, args.commands)
|
1462
1551
|
except TargetError as e:
|
1463
1552
|
log.error(e)
|
1464
1553
|
log.debug("", exc_info=e)
|
dissect/target/tools/utils.py
CHANGED
@@ -16,7 +16,6 @@ from dissect.target import Target
|
|
16
16
|
from dissect.target.exceptions import UnsupportedPluginError
|
17
17
|
from dissect.target.helpers import docs, keychain
|
18
18
|
from dissect.target.helpers.docs import get_docstring
|
19
|
-
from dissect.target.helpers.targetd import CommandProxy
|
20
19
|
from dissect.target.loader import LOADERS_BY_SCHEME
|
21
20
|
from dissect.target.plugin import (
|
22
21
|
OSPlugin,
|
@@ -91,6 +90,10 @@ def generate_argparse_for_unbound_method(
|
|
91
90
|
raise ValueError(f"Value `{method}` is not an unbound plugin method")
|
92
91
|
|
93
92
|
desc = method.__doc__ or docs.get_func_description(method, with_docstrings=True)
|
93
|
+
|
94
|
+
if "\n" in desc:
|
95
|
+
desc = inspect.cleandoc(desc)
|
96
|
+
|
94
97
|
help_formatter = argparse.RawDescriptionHelpFormatter
|
95
98
|
parser = argparse.ArgumentParser(description=desc, formatter_class=help_formatter, conflict_handler="resolve")
|
96
99
|
|
@@ -227,15 +230,15 @@ def get_target_attribute(target: Target, func: PluginFunction) -> Union[Plugin,
|
|
227
230
|
target.add_plugin(plugin_class)
|
228
231
|
except UnsupportedPluginError as e:
|
229
232
|
raise UnsupportedPluginError(
|
230
|
-
f"Unsupported function `{func.method_name}` for target with plugin {func.class_object}"
|
231
|
-
)
|
233
|
+
f"Unsupported function `{func.method_name}` for target with plugin {func.class_object}"
|
234
|
+
) from e
|
232
235
|
|
233
236
|
_, target_attr = plugin_factory(target, plugin_class, func.method_name, func.plugin_desc["namespace"])
|
234
237
|
return target_attr
|
235
238
|
|
236
239
|
|
237
240
|
def plugin_function_with_argparser(
|
238
|
-
target_attr: Union[Plugin, Callable]
|
241
|
+
target_attr: Union[Plugin, Callable],
|
239
242
|
) -> tuple[Optional[Iterator], Optional[argparse.ArgumentParser]]:
|
240
243
|
"""Resolves which plugin function to execute, and creates the argument parser for said plugin."""
|
241
244
|
plugin_method = None
|
@@ -250,9 +253,6 @@ def plugin_function_with_argparser(
|
|
250
253
|
|
251
254
|
plugin_method = plugin_obj.get_all_records
|
252
255
|
parser = generate_argparse_for_plugin(plugin_obj)
|
253
|
-
elif isinstance(target_attr, CommandProxy):
|
254
|
-
plugin_method = target_attr.command()
|
255
|
-
parser = generate_argparse_for_bound_method(plugin_method)
|
256
256
|
elif callable(target_attr):
|
257
257
|
plugin_method = target_attr
|
258
258
|
parser = generate_argparse_for_bound_method(target_attr)
|
dissect/target/volume.py
CHANGED
@@ -334,7 +334,7 @@ def open(fh: BinaryIO, *args, **kwargs) -> DissectVolumeSystem:
|
|
334
334
|
try:
|
335
335
|
return disk.DissectVolumeSystem(fh)
|
336
336
|
except Exception as e:
|
337
|
-
raise VolumeSystemError(f"Failed to load volume system for {fh}"
|
337
|
+
raise VolumeSystemError(f"Failed to load volume system for {fh}") from e
|
338
338
|
finally:
|
339
339
|
fh.seek(offset)
|
340
340
|
|
@@ -353,7 +353,7 @@ def is_lvm_volume(volume: BinaryIO) -> bool:
|
|
353
353
|
log.info("Failed to import %s", logical_vs)
|
354
354
|
log.debug("", exc_info=e)
|
355
355
|
except Exception as e:
|
356
|
-
raise VolumeSystemError(f"Failed to detect logical volume for {volume}"
|
356
|
+
raise VolumeSystemError(f"Failed to detect logical volume for {volume}") from e
|
357
357
|
|
358
358
|
return False
|
359
359
|
|
@@ -372,7 +372,7 @@ def is_encrypted(volume: BinaryIO) -> bool:
|
|
372
372
|
log.info("Failed to import %s", manager)
|
373
373
|
log.debug("", exc_info=e)
|
374
374
|
except Exception as e:
|
375
|
-
raise VolumeSystemError(f"Failed to detect encrypted volume for {volume}"
|
375
|
+
raise VolumeSystemError(f"Failed to detect encrypted volume for {volume}") from e
|
376
376
|
return False
|
377
377
|
|
378
378
|
|
@@ -422,4 +422,4 @@ def open_lvm(volumes: list[BinaryIO], *args, **kwargs) -> Iterator[VolumeSystem]
|
|
422
422
|
log.info("Failed to import %s", logical_vs)
|
423
423
|
log.debug("", exc_info=e)
|
424
424
|
except Exception as e:
|
425
|
-
raise VolumeSystemError(f"Failed to load logical volume system for {volumes}"
|
425
|
+
raise VolumeSystemError(f"Failed to load logical volume system for {volumes}") from e
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dissect.target
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.20
|
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
|
@@ -31,13 +31,14 @@ Requires-Dist: dissect.ntfs <4,>=3.4
|
|
31
31
|
Requires-Dist: dissect.regf <4,>=3.3
|
32
32
|
Requires-Dist: dissect.util <4,>=3
|
33
33
|
Requires-Dist: dissect.volume <4,>=2
|
34
|
-
Requires-Dist: flow.record ~=3.
|
34
|
+
Requires-Dist: flow.record ~=3.18.0
|
35
35
|
Requires-Dist: structlog
|
36
36
|
Provides-Extra: cb
|
37
37
|
Requires-Dist: dissect.target[full] ; extra == 'cb'
|
38
38
|
Requires-Dist: carbon-black-cloud-sdk ~=1.4.3 ; extra == 'cb'
|
39
39
|
Provides-Extra: dev
|
40
40
|
Requires-Dist: dissect.target[full,mqtt,yara] ; extra == 'dev'
|
41
|
+
Requires-Dist: dissect.archive[dev] <2.0.dev,>=1.0.dev ; extra == 'dev'
|
41
42
|
Requires-Dist: dissect.btrfs[dev] <2.0.dev,>=1.0.dev ; extra == 'dev'
|
42
43
|
Requires-Dist: dissect.cim[dev] <4.0.dev,>=3.0.dev ; extra == 'dev'
|
43
44
|
Requires-Dist: dissect.clfs[dev] <2.0.dev,>=1.0.dev ; extra == 'dev'
|
@@ -61,8 +62,10 @@ Requires-Dist: dissect.util <4.0.dev,>=3.0.dev ; extra == 'dev'
|
|
61
62
|
Requires-Dist: dissect.vmfs[dev] <4.0.dev,>=3.0.dev ; extra == 'dev'
|
62
63
|
Requires-Dist: dissect.volume[dev] <4.0.dev,>=3.0.dev ; extra == 'dev'
|
63
64
|
Requires-Dist: dissect.xfs[dev] <4.0.dev,>=3.0.dev ; extra == 'dev'
|
65
|
+
Requires-Dist: dissect.fve[dev] <5.0.dev,>=4.0.dev ; (platform_system != "Windows" or platform_python_implementation != "PyPy") and extra == 'dev'
|
64
66
|
Provides-Extra: full
|
65
67
|
Requires-Dist: asn1crypto ; extra == 'full'
|
68
|
+
Requires-Dist: dissect.archive <2,>=1 ; extra == 'full'
|
66
69
|
Requires-Dist: dissect.btrfs <2,>=1 ; extra == 'full'
|
67
70
|
Requires-Dist: dissect.cim <4,>=3 ; extra == 'full'
|
68
71
|
Requires-Dist: dissect.clfs <2,>=1 ; extra == 'full'
|
@@ -84,6 +87,7 @@ Requires-Dist: fusepy ; extra == 'full'
|
|
84
87
|
Requires-Dist: pycryptodome ; extra == 'full'
|
85
88
|
Requires-Dist: ruamel.yaml ; extra == 'full'
|
86
89
|
Requires-Dist: zstandard ; extra == 'full'
|
90
|
+
Requires-Dist: dissect.fve <5,>=4 ; (platform_system != "Windows" or platform_python_implementation != "PyPy") and extra == 'full'
|
87
91
|
Requires-Dist: tomli ; (python_version < "3.11") and extra == 'full'
|
88
92
|
Provides-Extra: mqtt
|
89
93
|
Requires-Dist: dissect.target[full] ; extra == 'mqtt'
|