dissect.target 3.19.dev53__py3-none-any.whl → 3.19.dev55__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -138,12 +138,18 @@ class MftPlugin(Plugin):
138
138
  FilesystemFilenameCompactRecord,
139
139
  ]
140
140
  )
141
- @arg("--compact", action="store_true", help="compacts the MFT entry timestamps into a single record")
141
+ @arg(
142
+ "--compact",
143
+ group="fmt",
144
+ action="store_true",
145
+ help="compacts the MFT entry timestamps into a single record",
146
+ )
142
147
  @arg("--fs", type=int, default=None, help="optional filesystem index, zero indexed")
143
148
  @arg("--start", type=int, default=0, help="the first MFT segment number")
144
149
  @arg("--end", type=int, default=-1, help="the last MFT segment number")
145
150
  @arg(
146
151
  "--macb",
152
+ group="fmt",
147
153
  action="store_true",
148
154
  help="compacts the MFT entry timestamps into aggregated records with MACB bitfield",
149
155
  )
@@ -171,9 +177,7 @@ class MftPlugin(Plugin):
171
177
 
172
178
  aggr = noaggr
173
179
 
174
- if compact and macb:
175
- raise ValueError("--macb and --compact are mutually exclusive")
176
- elif compact:
180
+ if compact:
177
181
  record_formatter = compacted_formatter
178
182
  elif macb:
179
183
  aggr = macb_aggr
@@ -76,6 +76,9 @@ class LinuxPlugin(UnixPlugin, LinuxNetworkManager):
76
76
  or self._os_release.get("DISTRIB_RELEASE", "")
77
77
  )
78
78
 
79
+ if not any([name, version, distrib_description]):
80
+ return None
81
+
79
82
  if len(f"{name} {version}") > len(distrib_description):
80
83
  distrib_description = f"{name} {version}"
81
84
 
@@ -5,7 +5,7 @@ from dissect.target.plugins.os.unix.linux._os import LinuxPlugin
5
5
  from dissect.target.target import Target
6
6
 
7
7
 
8
- class RedHat(LinuxPlugin):
8
+ class RedHatPlugin(LinuxPlugin):
9
9
  def __init__(self, target: Target):
10
10
  super().__init__(target)
11
11
 
@@ -1,4 +1,7 @@
1
+ from __future__ import annotations
2
+
1
3
  from pathlib import Path
4
+ from typing import Iterator
2
5
 
3
6
  from dissect.target.helpers.localeutil import normalize_language
4
7
  from dissect.target.helpers.record import TargetRecordDescriptor
@@ -30,7 +33,7 @@ class LocalePlugin(Plugin):
30
33
  pass
31
34
 
32
35
  @export(property=True)
33
- def timezone(self):
36
+ def timezone(self) -> str | None:
34
37
  """Get the timezone of the system."""
35
38
 
36
39
  # /etc/timezone should contain a simple timezone string
@@ -58,15 +61,23 @@ class LocalePlugin(Plugin):
58
61
  size = p_localtime.stat().st_size
59
62
  sha1 = p_localtime.get().sha1()
60
63
  for path in self.target.fs.path("/usr/share/zoneinfo").rglob("*"):
64
+ # Ignore posix files in zoneinfo directory (RHEL).
65
+ if path.name.startswith("posix"):
66
+ continue
67
+
61
68
  if path.is_file() and path.stat().st_size == size and path.get().sha1() == sha1:
62
69
  return timezone_from_path(path)
63
70
 
64
71
  @export(property=True)
65
- def language(self):
72
+ def language(self) -> list[str]:
66
73
  """Get the configured locale(s) of the system."""
67
- # Although this purports to be a generic function for Unix targets,
68
- # these paths are Linux specific.
69
- locale_paths = ["/etc/default/locale", "/etc/locale.conf"]
74
+
75
+ # Although this purports to be a generic function for Unix targets, these paths are Linux specific.
76
+ locale_paths = [
77
+ "/etc/default/locale",
78
+ "/etc/locale.conf",
79
+ "/etc/sysconfig/i18n",
80
+ ]
70
81
 
71
82
  found_languages = []
72
83
 
@@ -79,7 +90,7 @@ class LocalePlugin(Plugin):
79
90
  return found_languages
80
91
 
81
92
  @export(record=UnixKeyboardRecord)
82
- def keyboard(self):
93
+ def keyboard(self) -> Iterator[UnixKeyboardRecord]:
83
94
  """Get the keyboard layout(s) of the system."""
84
95
 
85
96
  paths = ["/etc/default/keyboard", "/etc/vconsole.conf"] + list(
@@ -95,12 +95,24 @@ def generate_argparse_for_unbound_method(
95
95
  parser = argparse.ArgumentParser(description=desc, formatter_class=help_formatter, conflict_handler="resolve")
96
96
 
97
97
  fargs = getattr(method, "__args__", [])
98
+ groups = {}
99
+ default_group_options = {"required": False}
98
100
  for args, kwargs in fargs:
99
- parser.add_argument(*args, **kwargs)
101
+ if "group" in kwargs:
102
+ group_name = kwargs.pop("group")
103
+ options = kwargs.pop("group_options") if "group_options" in kwargs else default_group_options
104
+ if group_name not in groups:
105
+ group = parser.add_mutually_exclusive_group(**options)
106
+ groups[group_name] = group
107
+ else:
108
+ group = groups[group_name]
109
+
110
+ group.add_argument(*args, **kwargs)
111
+ else:
112
+ parser.add_argument(*args, **kwargs)
100
113
 
101
114
  usage = parser.format_usage()
102
115
  offset = usage.find(parser.prog) + len(parser.prog)
103
-
104
116
  func_name = method.__name__
105
117
  usage_tmpl = usage_tmpl or "{prog} {usage}"
106
118
  parser.usage = usage_tmpl.format(prog=parser.prog, name=func_name, usage=usage[offset:])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.19.dev53
3
+ Version: 3.19.dev55
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
@@ -172,7 +172,7 @@ dissect/target/plugins/filesystem/resolver.py,sha256=HfyASUFV4F9uD-yFXilFpPTORAs
172
172
  dissect/target/plugins/filesystem/walkfs.py,sha256=rklbN805roy2fKAQe5L1JhTvI0qNgGS70ZNGFwevLB0,2740
173
173
  dissect/target/plugins/filesystem/yara.py,sha256=zh4hU3L_egddLqDeaHDVuCWYhTlNzPYPVak36Q6IMxI,6621
174
174
  dissect/target/plugins/filesystem/ntfs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
175
- dissect/target/plugins/filesystem/ntfs/mft.py,sha256=WzvKSlH4egvDsuonRQ3AjYS59t9jjFX_-GOsAPLUeSk,12418
175
+ dissect/target/plugins/filesystem/ntfs/mft.py,sha256=6r2uQrvJsuHGpKxx4vQPBuZ9yGLj-d8RS5y289-VoZI,12384
176
176
  dissect/target/plugins/filesystem/ntfs/mft_timeline.py,sha256=vvNFAZbr7s3X2OTYf4ES_L6-XsouTXcTymfxnHfZ1Rw,6791
177
177
  dissect/target/plugins/filesystem/ntfs/usnjrnl.py,sha256=uiT1ipmcAo__6VIUi8R_vvIu22vdnjMACKwLSAbzYjs,3704
178
178
  dissect/target/plugins/filesystem/ntfs/utils.py,sha256=xG7Lgw9NX4tDDrZVRm0vycFVJTOM7j-HrjqzDh0f4uA,3136
@@ -197,7 +197,7 @@ dissect/target/plugins/os/unix/datetime.py,sha256=gKfBdPyUirt3qmVYfOJ1oZXRPn8wRz
197
197
  dissect/target/plugins/os/unix/etc.py,sha256=HoPEC1hxqurSnAXQAK-jf_HxdBIDe-1z_qSw_n-ViI4,258
198
198
  dissect/target/plugins/os/unix/generic.py,sha256=6_MJrV1LbIxNQJwAZR0HEQljoxwF5BPQC1SfCTcaSHg,2127
199
199
  dissect/target/plugins/os/unix/history.py,sha256=rvRlcHw3wEtgdyfjX-RBLQUQAd0uHzfZmfW6FUb6s5U,6435
200
- dissect/target/plugins/os/unix/locale.py,sha256=V3R7mEyrH3f-h7SGAucByaYYDA2SIil9Qb-s3dPmDEA,3961
200
+ dissect/target/plugins/os/unix/locale.py,sha256=XOcKBwfK3YJ266eBFKNc1xaZgY8QEQGJOS8PJRJt4ME,4292
201
201
  dissect/target/plugins/os/unix/packagemanager.py,sha256=Wm2AAJOD_B3FAcZNXgWtSm_YwbvrHBYOP8bPmOXNjG4,2427
202
202
  dissect/target/plugins/os/unix/shadow.py,sha256=W6W6rMru7IVnuBc6sl5wsRWTOrJdS1s7_2_q7QRf7Is,4148
203
203
  dissect/target/plugins/os/unix/bsd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -219,7 +219,7 @@ dissect/target/plugins/os/unix/esxi/_os.py,sha256=s6pAgUyfHh3QcY6sgvk5uVMmLvqK1t
219
219
  dissect/target/plugins/os/unix/etc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
220
220
  dissect/target/plugins/os/unix/etc/etc.py,sha256=px_UwtPuk_scD-3nKJQZ0ao5lus9-BrSU4lPZWelYzI,2541
221
221
  dissect/target/plugins/os/unix/linux/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
222
- dissect/target/plugins/os/unix/linux/_os.py,sha256=DF4UV-s6XupV8bWck2Mkm4seFRb0oKjzeM-PtU8OV0k,2940
222
+ dissect/target/plugins/os/unix/linux/_os.py,sha256=ktEx_VhRB9vvZePo3-np2_L3yzUPq1Cc_D_1lnPq4-4,3023
223
223
  dissect/target/plugins/os/unix/linux/cmdline.py,sha256=AyMfndt3UsmJtoOyZYC8nWq2GZg9oPvn8SiI3M4NxnE,1622
224
224
  dissect/target/plugins/os/unix/linux/environ.py,sha256=UOQD7Xmu754u2oAh3L5g5snuz-gv4jbWbVy46qszYjo,1881
225
225
  dissect/target/plugins/os/unix/linux/iptables.py,sha256=qTzY5PHHXA33WnPYb5NESgoSwI7ECZ8YPoEe_Fmln-8,6045
@@ -243,7 +243,7 @@ dissect/target/plugins/os/unix/linux/fortios/_os.py,sha256=Cyw6KyGNc-uZn2WDlD-7G
243
243
  dissect/target/plugins/os/unix/linux/fortios/generic.py,sha256=tT4-lE0Z_DeDIN3zHrQbE8JB3cRJop1_TiEst-Au0bs,1230
244
244
  dissect/target/plugins/os/unix/linux/fortios/locale.py,sha256=VDdk60sqe2JTfftssO05C667-_BpI3kcqKOTVzO3ueU,5209
245
245
  dissect/target/plugins/os/unix/linux/redhat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
246
- dissect/target/plugins/os/unix/linux/redhat/_os.py,sha256=l_SygO1WMBTvaLvAvhe08yPHLBpUZ9wizW28a9_JhJE,578
246
+ dissect/target/plugins/os/unix/linux/redhat/_os.py,sha256=fHXBFJ3ZJDs4mbyI1oubCgkD5liGPZuJzclz-fUGXYc,584
247
247
  dissect/target/plugins/os/unix/linux/redhat/yum.py,sha256=kEvB-C2CNoqxSbgGRZiuo6CMPBo_hMWy2KQIE4SNkdQ,2134
248
248
  dissect/target/plugins/os/unix/linux/suse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
249
249
  dissect/target/plugins/os/unix/linux/suse/_os.py,sha256=eaqgnkbunBJ2Hf_GE96THjfT3ybVIZvtWId-dx3JMV4,575
@@ -342,7 +342,7 @@ dissect/target/tools/mount.py,sha256=L_0tSmiBdW4aSaF0vXjB0bAkTC0kmT2N1hrbW6s5Jow
342
342
  dissect/target/tools/query.py,sha256=ONHu2FVomLccikb84qBrlhNmEfRoHYFQMcahk_y2c9A,15580
343
343
  dissect/target/tools/reg.py,sha256=FDsiBBDxjWVUBTRj8xn82vZe-J_d9piM-TKS3PHZCcM,3193
344
344
  dissect/target/tools/shell.py,sha256=dmshIriwdd_UwrdUcTfWkcYD8Z0mjzbDqwyZG-snDdM,50482
345
- dissect/target/tools/utils.py,sha256=ej9w2uOzPf52EslEamFpY4Bc_u5EUI9Ks4mU1QTmWPI,11664
345
+ dissect/target/tools/utils.py,sha256=nnhjNW8v99eVZQ-CgxTbsi8Wa6Z2XKDFr1aWakgq9jc,12191
346
346
  dissect/target/tools/yara.py,sha256=70k-2VMulf1EdkX03nCACzejaOEcsFHOyX-4E40MdQU,2044
347
347
  dissect/target/tools/dump/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
348
348
  dissect/target/tools/dump/run.py,sha256=aD84peRS4zHqC78fH7Vd4ni3m1ZmVP70LyMwBRvoDGY,9463
@@ -356,10 +356,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
356
356
  dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
357
357
  dissect/target/volumes/md.py,sha256=7ShPtusuLGaIv27SvEETtgsuoQyAa4iAAeOR1NEaajI,1689
358
358
  dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
359
- dissect.target-3.19.dev53.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
360
- dissect.target-3.19.dev53.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
361
- dissect.target-3.19.dev53.dist-info/METADATA,sha256=9Bx6bb3QUXpRP7XxDfw0BeR-YI59jgL9i0eKCzVGrY0,12897
362
- dissect.target-3.19.dev53.dist-info/WHEEL,sha256=ixB2d4u7mugx_bCBycvM9OzZ5yD7NmPXFRtKlORZS2Y,91
363
- dissect.target-3.19.dev53.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
364
- dissect.target-3.19.dev53.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
365
- dissect.target-3.19.dev53.dist-info/RECORD,,
359
+ dissect.target-3.19.dev55.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
360
+ dissect.target-3.19.dev55.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
361
+ dissect.target-3.19.dev55.dist-info/METADATA,sha256=kEnsyXUwLaOo42y56XYs1I9yAA2gKy6KY8DIKqONfU4,12897
362
+ dissect.target-3.19.dev55.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
363
+ dissect.target-3.19.dev55.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
364
+ dissect.target-3.19.dev55.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
365
+ dissect.target-3.19.dev55.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.0)
2
+ Generator: setuptools (74.1.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5