dissect.target 3.20.dev64__py3-none-any.whl → 3.21.dev2__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/helpers/configutil.py +2 -2
- dissect/target/helpers/record.py +12 -6
- dissect/target/helpers/utils.py +20 -1
- dissect/target/plugins/general/network.py +1 -1
- dissect/target/plugins/os/unix/bsd/osx/network.py +2 -1
- dissect/target/plugins/os/unix/linux/fortios/_keys.py +832 -0
- dissect/target/plugins/os/unix/linux/network.py +338 -0
- dissect/target/plugins/os/windows/network.py +2 -1
- {dissect.target-3.20.dev64.dist-info → dissect.target-3.21.dev2.dist-info}/METADATA +1 -1
- {dissect.target-3.20.dev64.dist-info → dissect.target-3.21.dev2.dist-info}/RECORD +15 -14
- {dissect.target-3.20.dev64.dist-info → dissect.target-3.21.dev2.dist-info}/COPYRIGHT +0 -0
- {dissect.target-3.20.dev64.dist-info → dissect.target-3.21.dev2.dist-info}/LICENSE +0 -0
- {dissect.target-3.20.dev64.dist-info → dissect.target-3.21.dev2.dist-info}/WHEEL +0 -0
- {dissect.target-3.20.dev64.dist-info → dissect.target-3.21.dev2.dist-info}/entry_points.txt +0 -0
- {dissect.target-3.20.dev64.dist-info → dissect.target-3.21.dev2.dist-info}/top_level.txt +0 -0
@@ -891,7 +891,7 @@ KNOWN_FILES: dict[str, type[ConfigurationParser]] = {
|
|
891
891
|
}
|
892
892
|
|
893
893
|
|
894
|
-
def parse(path: Union[FilesystemEntry, TargetPath], hint: Optional[str] = None, *args, **kwargs) ->
|
894
|
+
def parse(path: Union[FilesystemEntry, TargetPath], hint: Optional[str] = None, *args, **kwargs) -> ConfigurationParser:
|
895
895
|
"""Parses the content of an ``path`` or ``entry`` to a dictionary.
|
896
896
|
|
897
897
|
Args:
|
@@ -922,7 +922,7 @@ def parse_config(
|
|
922
922
|
entry: FilesystemEntry,
|
923
923
|
hint: Optional[str] = None,
|
924
924
|
options: Optional[ParserOptions] = None,
|
925
|
-
) ->
|
925
|
+
) -> ConfigurationParser:
|
926
926
|
parser_type = _select_parser(entry, hint)
|
927
927
|
|
928
928
|
parser = parser_type.create_parser(options)
|
dissect/target/helpers/record.py
CHANGED
@@ -145,33 +145,40 @@ EmptyRecord = RecordDescriptor(
|
|
145
145
|
|
146
146
|
COMMON_INTERFACE_ELEMENTS = [
|
147
147
|
("string", "name"),
|
148
|
+
("string[]", "mac"),
|
148
149
|
("string", "type"),
|
149
150
|
("boolean", "enabled"),
|
150
|
-
("string", "mac"),
|
151
151
|
("net.ipaddress[]", "dns"),
|
152
152
|
("net.ipaddress[]", "ip"),
|
153
153
|
("net.ipaddress[]", "gateway"),
|
154
|
+
("net.ipnetwork[]", "network"),
|
154
155
|
("string", "source"),
|
155
156
|
]
|
156
157
|
|
157
158
|
|
158
159
|
UnixInterfaceRecord = TargetRecordDescriptor(
|
159
160
|
"unix/network/interface",
|
160
|
-
|
161
|
+
[
|
162
|
+
*COMMON_INTERFACE_ELEMENTS,
|
163
|
+
("boolean", "dhcp_ipv4"), # NetworkManager allows for dual-stack configurations.
|
164
|
+
("boolean", "dhcp_ipv6"),
|
165
|
+
("datetime", "last_connected"),
|
166
|
+
("varint[]", "vlan"),
|
167
|
+
("string", "configurator"),
|
168
|
+
],
|
161
169
|
)
|
162
170
|
|
163
171
|
WindowsInterfaceRecord = TargetRecordDescriptor(
|
164
172
|
"windows/network/interface",
|
165
173
|
[
|
166
174
|
*COMMON_INTERFACE_ELEMENTS,
|
167
|
-
("varint", "vlan"),
|
168
|
-
("net.ipnetwork[]", "network"),
|
169
175
|
("varint", "metric"),
|
170
176
|
("stringlist", "search_domain"),
|
171
177
|
("datetime", "first_connected"),
|
172
178
|
("datetime", "last_connected"),
|
173
179
|
("net.ipaddress[]", "subnetmask"),
|
174
180
|
("boolean", "dhcp"),
|
181
|
+
("varint", "vlan"),
|
175
182
|
],
|
176
183
|
)
|
177
184
|
|
@@ -179,10 +186,9 @@ MacInterfaceRecord = TargetRecordDescriptor(
|
|
179
186
|
"macos/network/interface",
|
180
187
|
[
|
181
188
|
*COMMON_INTERFACE_ELEMENTS,
|
182
|
-
("varint", "vlan"),
|
183
|
-
("net.ipnetwork[]", "network"),
|
184
189
|
("varint", "interface_service_order"),
|
185
190
|
("boolean", "dhcp"),
|
191
|
+
("varint", "vlan"),
|
186
192
|
],
|
187
193
|
)
|
188
194
|
|
dissect/target/helpers/utils.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import logging
|
2
4
|
import re
|
3
5
|
import urllib.parse
|
4
6
|
from datetime import datetime, timezone, tzinfo
|
5
7
|
from enum import Enum
|
6
8
|
from pathlib import Path
|
7
|
-
from typing import BinaryIO, Callable, Iterator, Optional, Union
|
9
|
+
from typing import BinaryIO, Callable, Iterator, Optional, TypeVar, Union
|
8
10
|
|
9
11
|
from dissect.util.ts import from_unix
|
10
12
|
|
@@ -24,6 +26,23 @@ def findall(buf: bytes, needle: bytes) -> Iterator[int]:
|
|
24
26
|
offset += 1
|
25
27
|
|
26
28
|
|
29
|
+
T = TypeVar("T")
|
30
|
+
|
31
|
+
|
32
|
+
def to_list(value: T | list[T]) -> list[T]:
|
33
|
+
"""Convert a single value or a list of values to a list.
|
34
|
+
|
35
|
+
Args:
|
36
|
+
value: The value to convert.
|
37
|
+
|
38
|
+
Returns:
|
39
|
+
A list of values.
|
40
|
+
"""
|
41
|
+
if not isinstance(value, list):
|
42
|
+
return [value]
|
43
|
+
return value
|
44
|
+
|
45
|
+
|
27
46
|
class StrEnum(str, Enum):
|
28
47
|
"""Sortable and serializible string-based enum"""
|
29
48
|
|
@@ -84,9 +84,10 @@ class MacNetworkPlugin(NetworkPlugin):
|
|
84
84
|
network=network,
|
85
85
|
interface_service_order=interface_service_order,
|
86
86
|
dhcp=dhcp,
|
87
|
+
mac=[],
|
87
88
|
_target=self.target,
|
88
89
|
)
|
89
90
|
|
90
91
|
except Exception as e:
|
91
|
-
self.target.log.warning("Error reading configuration for network device %s
|
92
|
+
self.target.log.warning("Error reading configuration for network device %s", name, exc_info=e)
|
92
93
|
continue
|