dissect.target 3.20.dev26__py3-none-any.whl → 3.20.dev27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dissect/target/filesystems/config.py +4 -0
- dissect/target/helpers/configutil.py +23 -3
- {dissect.target-3.20.dev26.dist-info → dissect.target-3.20.dev27.dist-info}/METADATA +1 -1
- {dissect.target-3.20.dev26.dist-info → dissect.target-3.20.dev27.dist-info}/RECORD +9 -9
- {dissect.target-3.20.dev26.dist-info → dissect.target-3.20.dev27.dist-info}/COPYRIGHT +0 -0
- {dissect.target-3.20.dev26.dist-info → dissect.target-3.20.dev27.dist-info}/LICENSE +0 -0
- {dissect.target-3.20.dev26.dist-info → dissect.target-3.20.dev27.dist-info}/WHEEL +0 -0
- {dissect.target-3.20.dev26.dist-info → dissect.target-3.20.dev27.dist-info}/entry_points.txt +0 -0
- {dissect.target-3.20.dev26.dist-info → dissect.target-3.20.dev27.dist-info}/top_level.txt +0 -0
@@ -247,10 +247,14 @@ class ConfigurationEntry(FilesystemEntry):
|
|
247
247
|
Returns:
|
248
248
|
A file-like object holding a byte representation of :attr:`parser_items`.
|
249
249
|
"""
|
250
|
+
|
250
251
|
if isinstance(self.parser_items, ConfigurationParser):
|
251
252
|
# Currently trying to open the underlying entry
|
252
253
|
return self.entry.open()
|
253
254
|
|
255
|
+
if isinstance(self.parser_items, bytes):
|
256
|
+
return io.BytesIO(self.parser_items)
|
257
|
+
|
254
258
|
output_data = self._write_value_mapping(self.parser_items)
|
255
259
|
return io.BytesIO(bytes(output_data, "utf-8"))
|
256
260
|
|
@@ -161,7 +161,7 @@ class ConfigurationParser:
|
|
161
161
|
def get(self, item: str, default: Optional[Any] = None) -> Any:
|
162
162
|
return self.parsed_data.get(item, default)
|
163
163
|
|
164
|
-
def read_file(self, fh: TextIO) -> None:
|
164
|
+
def read_file(self, fh: TextIO | io.BytesIO) -> None:
|
165
165
|
"""Parse a configuration file.
|
166
166
|
|
167
167
|
Raises:
|
@@ -303,6 +303,14 @@ class Txt(ConfigurationParser):
|
|
303
303
|
self.parsed_data = {"content": fh.read(), "size": str(fh.tell())}
|
304
304
|
|
305
305
|
|
306
|
+
class Bin(ConfigurationParser):
|
307
|
+
|
308
|
+
"""Read the file into ``binary`` and show the number of bytes read"""
|
309
|
+
|
310
|
+
def parse_file(self, fh: io.BytesIO) -> None:
|
311
|
+
self.parsed_data = {"binary": fh.read(), "size": str(fh.tell())}
|
312
|
+
|
313
|
+
|
306
314
|
class Xml(ConfigurationParser):
|
307
315
|
"""Parses an XML file. Ignores any constructor parameters passed from ``ConfigurationParser`."""
|
308
316
|
|
@@ -733,6 +741,8 @@ MATCH_MAP: dict[str, ParserConfig] = {
|
|
733
741
|
"*/sysconfig/network-scripts/ifcfg-*": ParserConfig(Default),
|
734
742
|
"*/sysctl.d/*.conf": ParserConfig(Default),
|
735
743
|
"*/xml/*": ParserConfig(Xml),
|
744
|
+
"*.bashrc": ParserConfig(Txt),
|
745
|
+
"*/vim/vimrc*": ParserConfig(Txt),
|
736
746
|
}
|
737
747
|
|
738
748
|
CONFIG_MAP: dict[tuple[str, ...], ParserConfig] = {
|
@@ -744,6 +754,13 @@ CONFIG_MAP: dict[tuple[str, ...], ParserConfig] = {
|
|
744
754
|
"cnf": ParserConfig(Default),
|
745
755
|
"conf": ParserConfig(Default, separator=(r"\s",)),
|
746
756
|
"sample": ParserConfig(Txt),
|
757
|
+
"sh": ParserConfig(Txt),
|
758
|
+
"key": ParserConfig(Txt),
|
759
|
+
"crt": ParserConfig(Txt),
|
760
|
+
"pem": ParserConfig(Txt),
|
761
|
+
"pl": ParserConfig(Txt), # various admin panels
|
762
|
+
"lua": ParserConfig(Txt), # wireshark etc.
|
763
|
+
"txt": ParserConfig(Txt),
|
747
764
|
"systemd": ParserConfig(SystemD),
|
748
765
|
"template": ParserConfig(Txt),
|
749
766
|
"toml": ParserConfig(Toml),
|
@@ -759,6 +776,7 @@ KNOWN_FILES: dict[str, type[ConfigurationParser]] = {
|
|
759
776
|
"nsswitch.conf": ParserConfig(Default, separator=(":",)),
|
760
777
|
"lsb-release": ParserConfig(Default),
|
761
778
|
"catalog": ParserConfig(Xml),
|
779
|
+
"ld.so.cache": ParserConfig(Bin),
|
762
780
|
"fstab": ParserConfig(
|
763
781
|
CSVish,
|
764
782
|
separator=(r"\s",),
|
@@ -832,9 +850,11 @@ def parse_config(
|
|
832
850
|
parser_type = _select_parser(entry, hint)
|
833
851
|
|
834
852
|
parser = parser_type.create_parser(options)
|
835
|
-
|
836
853
|
with entry.open() as fh:
|
837
|
-
|
854
|
+
if not isinstance(parser, Bin):
|
855
|
+
open_file = io.TextIOWrapper(fh, encoding="utf-8")
|
856
|
+
else:
|
857
|
+
open_file = io.BytesIO(fh.read())
|
838
858
|
parser.read_file(open_file)
|
839
859
|
|
840
860
|
return parser
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dissect.target
|
3
|
-
Version: 3.20.
|
3
|
+
Version: 3.20.dev27
|
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
|
@@ -25,7 +25,7 @@ dissect/target/filesystems/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
25
25
|
dissect/target/filesystems/ad1.py,sha256=nEPzaaRsb6bL4ItFo0uLdmdLvrmK9BjqHeD3FOp3WQI,2413
|
26
26
|
dissect/target/filesystems/btrfs.py,sha256=TotOs0-VOmgSijERZb1pOrIH_E7B1J_DRKqws8ttQTk,6569
|
27
27
|
dissect/target/filesystems/cb.py,sha256=6LcoJiwsYu1Han31IUzVpZVDTifhTLTx_gLfNpB_p6k,5329
|
28
|
-
dissect/target/filesystems/config.py,sha256=
|
28
|
+
dissect/target/filesystems/config.py,sha256=5ZJfxs1Cidjxr7nKH2_iGKNWFd5SeLORRWkL4oYcZnk,12063
|
29
29
|
dissect/target/filesystems/cpio.py,sha256=ssVCjkAtLn2FqmNxeo6U5boyUdSYFxLWfXpytHYGPqs,641
|
30
30
|
dissect/target/filesystems/dir.py,sha256=rKEreX3A7CI6a3pMssrO9F-9i5pkxCn_Ucs_dMtHxxA,4574
|
31
31
|
dissect/target/filesystems/exfat.py,sha256=PRkZPUVN5NlgB1VetFtywdNgF6Yj5OBtF5a25t-fFvw,5917
|
@@ -46,7 +46,7 @@ dissect/target/filesystems/zip.py,sha256=BeNj23DOYfWuTm5V1V419ViJiMfBrO1VA5gP6rl
|
|
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=RMHnIuKJHINHiLrvKN3EyA0jFA1o6-pbeaycG8Pgrp8,2596
|
49
|
-
dissect/target/helpers/configutil.py,sha256=
|
49
|
+
dissect/target/helpers/configutil.py,sha256=2PjQG-8vsParTANkMox_2cB1_MDxpOURJrUFj5dL3DI,28355
|
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
|
@@ -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.dev27.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
|
372
|
+
dissect.target-3.20.dev27.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
373
|
+
dissect.target-3.20.dev27.dist-info/METADATA,sha256=O7DsHBHZKJGXZ1bQFS5nypC1x3WA9342Xj88YwbbT4k,12897
|
374
|
+
dissect.target-3.20.dev27.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
375
|
+
dissect.target-3.20.dev27.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
|
376
|
+
dissect.target-3.20.dev27.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
|
377
|
+
dissect.target-3.20.dev27.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
{dissect.target-3.20.dev26.dist-info → dissect.target-3.20.dev27.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|