dissect.target 3.19.dev17__py3-none-any.whl → 3.19.dev18__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- dissect/target/helpers/configutil.py +65 -1
- {dissect.target-3.19.dev17.dist-info → dissect.target-3.19.dev18.dist-info}/METADATA +1 -1
- {dissect.target-3.19.dev17.dist-info → dissect.target-3.19.dev18.dist-info}/RECORD +8 -8
- {dissect.target-3.19.dev17.dist-info → dissect.target-3.19.dev18.dist-info}/WHEEL +1 -1
- {dissect.target-3.19.dev17.dist-info → dissect.target-3.19.dev18.dist-info}/COPYRIGHT +0 -0
- {dissect.target-3.19.dev17.dist-info → dissect.target-3.19.dev18.dist-info}/LICENSE +0 -0
- {dissect.target-3.19.dev17.dist-info → dissect.target-3.19.dev18.dist-info}/entry_points.txt +0 -0
- {dissect.target-3.19.dev17.dist-info → dissect.target-3.19.dev18.dist-info}/top_level.txt +0 -0
@@ -240,6 +240,33 @@ class Default(ConfigurationParser):
|
|
240
240
|
self.parsed_data = information_dict
|
241
241
|
|
242
242
|
|
243
|
+
class CSVish(Default):
|
244
|
+
"""Parses CSV-ish config files (does not confirm to CSV standard!)"""
|
245
|
+
|
246
|
+
def __init__(self, *args, fields: tuple[str], **kwargs) -> None:
|
247
|
+
self.fields = fields
|
248
|
+
self.num_fields = len(self.fields)
|
249
|
+
self.maxsplit = self.num_fields - 1
|
250
|
+
super().__init__(*args, **kwargs)
|
251
|
+
|
252
|
+
def parse_file(self, fh: TextIO) -> None:
|
253
|
+
information_dict = {}
|
254
|
+
|
255
|
+
for i, raw_line in enumerate(self.line_reader(fh, strip_comments=True)):
|
256
|
+
line = raw_line.strip()
|
257
|
+
columns = re.split(self.SEPARATOR, line, maxsplit=self.maxsplit)
|
258
|
+
|
259
|
+
if len(columns) < self.num_fields:
|
260
|
+
# keep unparsed lines separate (often env vars)
|
261
|
+
data = {"line": line}
|
262
|
+
else:
|
263
|
+
data = dict(zip(self.fields, columns))
|
264
|
+
|
265
|
+
information_dict[str(i)] = data
|
266
|
+
|
267
|
+
self.parsed_data = information_dict
|
268
|
+
|
269
|
+
|
243
270
|
class Ini(ConfigurationParser):
|
244
271
|
"""Parses an ini file according using the built-in python ConfigParser"""
|
245
272
|
|
@@ -688,11 +715,12 @@ class ParserConfig:
|
|
688
715
|
collapse_inverse: Optional[bool] = None
|
689
716
|
separator: Optional[tuple[str]] = None
|
690
717
|
comment_prefixes: Optional[tuple[str]] = None
|
718
|
+
fields: Optional[tuple[str]] = None
|
691
719
|
|
692
720
|
def create_parser(self, options: Optional[ParserOptions] = None) -> ConfigurationParser:
|
693
721
|
kwargs = {}
|
694
722
|
|
695
|
-
for field_name in ["collapse", "collapse_inverse", "separator", "comment_prefixes"]:
|
723
|
+
for field_name in ["collapse", "collapse_inverse", "separator", "comment_prefixes", "fields"]:
|
696
724
|
value = getattr(options, field_name, None) or getattr(self, field_name)
|
697
725
|
if value:
|
698
726
|
kwargs.update({field_name: value})
|
@@ -721,6 +749,7 @@ CONFIG_MAP: dict[tuple[str, ...], ParserConfig] = {
|
|
721
749
|
"toml": ParserConfig(Toml),
|
722
750
|
}
|
723
751
|
|
752
|
+
|
724
753
|
KNOWN_FILES: dict[str, type[ConfigurationParser]] = {
|
725
754
|
"ulogd.conf": ParserConfig(Ini),
|
726
755
|
"sshd_config": ParserConfig(Indentation, separator=(r"\s",)),
|
@@ -730,6 +759,41 @@ KNOWN_FILES: dict[str, type[ConfigurationParser]] = {
|
|
730
759
|
"nsswitch.conf": ParserConfig(Default, separator=(":",)),
|
731
760
|
"lsb-release": ParserConfig(Default),
|
732
761
|
"catalog": ParserConfig(Xml),
|
762
|
+
"fstab": ParserConfig(
|
763
|
+
CSVish,
|
764
|
+
separator=(r"\s",),
|
765
|
+
comment_prefixes=("#",),
|
766
|
+
fields=("device", "mount", "type", "options", "dump", "pass"),
|
767
|
+
),
|
768
|
+
"crontab": ParserConfig(
|
769
|
+
CSVish,
|
770
|
+
separator=(r"\s",),
|
771
|
+
comment_prefixes=("#",),
|
772
|
+
fields=("minute", "hour", "day", "month", "weekday", "user", "command"),
|
773
|
+
),
|
774
|
+
"shadow": ParserConfig(
|
775
|
+
CSVish,
|
776
|
+
separator=(r"\:",),
|
777
|
+
comment_prefixes=("#",),
|
778
|
+
fields=(
|
779
|
+
"username",
|
780
|
+
"password",
|
781
|
+
"lastchange",
|
782
|
+
"minpassage",
|
783
|
+
"maxpassage",
|
784
|
+
"warning",
|
785
|
+
"inactive",
|
786
|
+
"expire",
|
787
|
+
"rest",
|
788
|
+
),
|
789
|
+
),
|
790
|
+
"passwd": ParserConfig(
|
791
|
+
CSVish,
|
792
|
+
separator=(r"\:",),
|
793
|
+
comment_prefixes=("#",),
|
794
|
+
fields=("username", "password", "uid", "gid", "gecos", "homedir", "shell"),
|
795
|
+
),
|
796
|
+
"mime.types": ParserConfig(CSVish, separator=(r"\s+",), comment_prefixes=("#",), fields=("name", "extensions")),
|
733
797
|
}
|
734
798
|
|
735
799
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dissect.target
|
3
|
-
Version: 3.19.
|
3
|
+
Version: 3.19.dev18
|
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
|
@@ -46,7 +46,7 @@ dissect/target/filesystems/zip.py,sha256=WT1bQhzX_1MXXVZTKrJniae4xqRqMZ8FsfbvhgG
|
|
46
46
|
dissect/target/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
47
47
|
dissect/target/helpers/cache.py,sha256=TXlJBdFRz6V9zKs903am4Yawr0maYw5kZY0RqklDQJM,8568
|
48
48
|
dissect/target/helpers/config.py,sha256=6917CZ6eDHaK_tOoiVEIndyhRXO6r6eCBIleq6f47PQ,2346
|
49
|
-
dissect/target/helpers/configutil.py,sha256=
|
49
|
+
dissect/target/helpers/configutil.py,sha256=SLJFt_k5ezm7CIr_mcZqVrV-2YrcX5D48KgyC9oyWGw,27645
|
50
50
|
dissect/target/helpers/cyber.py,sha256=WnJlk-HqAETmDAgLq92JPxyDLxvzSoFV_WrO-odVKBI,16805
|
51
51
|
dissect/target/helpers/descriptor_extensions.py,sha256=uT8GwznfDAiIgMM7JKKOY0PXKMv2c0GCqJTCkWFgops,2605
|
52
52
|
dissect/target/helpers/docs.py,sha256=J5U65Y3yOTqxDEZRCdrEmO63XQCeDzOJea1PwPM6Cyc,5146
|
@@ -344,10 +344,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
|
|
344
344
|
dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
|
345
345
|
dissect/target/volumes/md.py,sha256=j1K1iKmspl0C_OJFc7-Q1BMWN2OCC5EVANIgVlJ_fIE,1673
|
346
346
|
dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
|
347
|
-
dissect.target-3.19.
|
348
|
-
dissect.target-3.19.
|
349
|
-
dissect.target-3.19.
|
350
|
-
dissect.target-3.19.
|
351
|
-
dissect.target-3.19.
|
352
|
-
dissect.target-3.19.
|
353
|
-
dissect.target-3.19.
|
347
|
+
dissect.target-3.19.dev18.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
|
348
|
+
dissect.target-3.19.dev18.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
349
|
+
dissect.target-3.19.dev18.dist-info/METADATA,sha256=5gfwL4PP7a_vTLYBnbyfy1keo11MDR4aYuyMlPMv5Vs,12719
|
350
|
+
dissect.target-3.19.dev18.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
351
|
+
dissect.target-3.19.dev18.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
|
352
|
+
dissect.target-3.19.dev18.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
|
353
|
+
dissect.target-3.19.dev18.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{dissect.target-3.19.dev17.dist-info → dissect.target-3.19.dev18.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|