dissect.target 3.16.dev38__py3-none-any.whl → 3.16.dev39__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- dissect/target/plugins/apps/vpn/wireguard.py +31 -24
- {dissect.target-3.16.dev38.dist-info → dissect.target-3.16.dev39.dist-info}/METADATA +1 -1
- {dissect.target-3.16.dev38.dist-info → dissect.target-3.16.dev39.dist-info}/RECORD +8 -8
- {dissect.target-3.16.dev38.dist-info → dissect.target-3.16.dev39.dist-info}/COPYRIGHT +0 -0
- {dissect.target-3.16.dev38.dist-info → dissect.target-3.16.dev39.dist-info}/LICENSE +0 -0
- {dissect.target-3.16.dev38.dist-info → dissect.target-3.16.dev39.dist-info}/WHEEL +0 -0
- {dissect.target-3.16.dev38.dist-info → dissect.target-3.16.dev39.dist-info}/entry_points.txt +0 -0
- {dissect.target-3.16.dev38.dist-info → dissect.target-3.16.dev39.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import re
|
2
2
|
from collections import OrderedDict
|
3
3
|
from configparser import ConfigParser
|
4
|
-
from
|
4
|
+
from functools import partial
|
5
5
|
from pathlib import Path
|
6
6
|
from typing import Iterator, Union
|
7
7
|
|
@@ -34,7 +34,7 @@ WireGuardPeerRecord = TargetRecordDescriptor(
|
|
34
34
|
("string", "name"),
|
35
35
|
("string", "public_key"),
|
36
36
|
("string", "pre_shared_key"),
|
37
|
-
("net.ipnetwork", "allowed_ips"),
|
37
|
+
("net.ipnetwork[]", "allowed_ips"),
|
38
38
|
("string", "endpoint"),
|
39
39
|
("varint", "persistent_keep_alive"),
|
40
40
|
("string", "source"),
|
@@ -102,37 +102,42 @@ class WireGuardPlugin(Plugin):
|
|
102
102
|
|
103
103
|
config = _parse_config(config_buf)
|
104
104
|
|
105
|
-
|
105
|
+
# Set up an iterator to go through all the sections and pre-set the fallback
|
106
|
+
config_iterator = ((section, partial(config.get, section, fallback=None)) for section in config.sections())
|
107
|
+
|
108
|
+
for section, config_dict in config_iterator:
|
106
109
|
if "Interface" in section:
|
107
|
-
if address :=
|
110
|
+
if address := config_dict("Address"):
|
108
111
|
address = address.split("/")[0]
|
109
|
-
|
110
|
-
name = self.TUNNEL_NAME_RE.sub("", name)
|
112
|
+
|
111
113
|
yield WireGuardInterfaceRecord(
|
112
|
-
name=
|
114
|
+
name=config_path.stem,
|
113
115
|
address=address,
|
114
|
-
listen_port=
|
115
|
-
private_key=
|
116
|
-
fw_mark=
|
117
|
-
dns=
|
118
|
-
table=
|
119
|
-
mtu=
|
120
|
-
preup=
|
121
|
-
postup=
|
122
|
-
predown=
|
123
|
-
postdown=
|
116
|
+
listen_port=config_dict("ListenPort"),
|
117
|
+
private_key=config_dict("PrivateKey"),
|
118
|
+
fw_mark=config_dict("FwMark"),
|
119
|
+
dns=config_dict("DNS"),
|
120
|
+
table=config_dict("Table"),
|
121
|
+
mtu=config_dict("MTU"),
|
122
|
+
preup=config_dict("PreUp"),
|
123
|
+
postup=config_dict("PostUp"),
|
124
|
+
predown=config_dict("PreDown"),
|
125
|
+
postdown=config_dict("PostDown"),
|
124
126
|
source=config_path,
|
125
127
|
_target=self.target,
|
126
128
|
)
|
127
129
|
|
128
130
|
if "Peer" in section:
|
131
|
+
if allowed_ips := config_dict("AllowedIPs"):
|
132
|
+
allowed_ips = [value.strip() for value in allowed_ips.split(",")]
|
133
|
+
|
129
134
|
yield WireGuardPeerRecord(
|
130
|
-
name=
|
131
|
-
public_key=
|
132
|
-
pre_shared_key=
|
133
|
-
allowed_ips=
|
134
|
-
endpoint=
|
135
|
-
persistent_keep_alive=
|
135
|
+
name=config_dict("Name"),
|
136
|
+
public_key=config_dict("PublicKey"),
|
137
|
+
pre_shared_key=config_dict("PreSharedKey"),
|
138
|
+
allowed_ips=allowed_ips,
|
139
|
+
endpoint=config_dict("Endpoint"),
|
140
|
+
persistent_keep_alive=config_dict("PersistentKeepAlive"),
|
136
141
|
source=config_path,
|
137
142
|
_target=self.target,
|
138
143
|
)
|
@@ -148,6 +153,8 @@ def _parse_config(content: str) -> ConfigParser:
|
|
148
153
|
"""
|
149
154
|
|
150
155
|
cp = ConfigParser(defaults=None, dict_type=MultiDict, strict=False)
|
156
|
+
# Set to use str so it doesn't do any lower operation on the keys.
|
157
|
+
cp.optionxform = str
|
151
158
|
cp.read_string(content)
|
152
159
|
return cp
|
153
160
|
|
@@ -158,7 +165,7 @@ class MultiDict(OrderedDict):
|
|
158
165
|
super().__init__(*args, **kwargs)
|
159
166
|
|
160
167
|
def __setitem__(self, key, val):
|
161
|
-
if isinstance(val, dict) and (key
|
168
|
+
if isinstance(val, dict) and (key in ["Peer", "Interface"]):
|
162
169
|
self._unique += 1
|
163
170
|
key += str(self._unique)
|
164
171
|
super().__setitem__(key, val)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dissect.target
|
3
|
-
Version: 3.16.
|
3
|
+
Version: 3.16.dev39
|
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
|
@@ -137,7 +137,7 @@ dissect/target/plugins/apps/ssh/putty.py,sha256=N8ssjutUVN50JNA5fEIVISbP5sJ7bGTF
|
|
137
137
|
dissect/target/plugins/apps/ssh/ssh.py,sha256=uCaoWlT2bgKLUHA1aL6XymJDWJ8JmLsN8PB1C66eidY,1409
|
138
138
|
dissect/target/plugins/apps/vpn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
139
139
|
dissect/target/plugins/apps/vpn/openvpn.py,sha256=NZeFSFgGAifevGIQBusdbBRFOPxu0584Th8rKE-XSus,6875
|
140
|
-
dissect/target/plugins/apps/vpn/wireguard.py,sha256=
|
140
|
+
dissect/target/plugins/apps/vpn/wireguard.py,sha256=SoAMED_bwWJQ3nci5qEY-qV4wJKSSDZQ8K7DoJRYq0k,6521
|
141
141
|
dissect/target/plugins/apps/webhosting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
142
142
|
dissect/target/plugins/apps/webhosting/cpanel.py,sha256=OeFQnu9GmpffIlFyK-AR2Qf8tjyMhazWEAUyccDU5y0,2979
|
143
143
|
dissect/target/plugins/apps/webserver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -332,10 +332,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
|
|
332
332
|
dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
|
333
333
|
dissect/target/volumes/md.py,sha256=j1K1iKmspl0C_OJFc7-Q1BMWN2OCC5EVANIgVlJ_fIE,1673
|
334
334
|
dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
|
335
|
-
dissect.target-3.16.
|
336
|
-
dissect.target-3.16.
|
337
|
-
dissect.target-3.16.
|
338
|
-
dissect.target-3.16.
|
339
|
-
dissect.target-3.16.
|
340
|
-
dissect.target-3.16.
|
341
|
-
dissect.target-3.16.
|
335
|
+
dissect.target-3.16.dev39.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
|
336
|
+
dissect.target-3.16.dev39.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
337
|
+
dissect.target-3.16.dev39.dist-info/METADATA,sha256=ngLz4XeexsGKv4urTocePElt3tx1Jpc0yxVHs1FcGWU,11107
|
338
|
+
dissect.target-3.16.dev39.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
339
|
+
dissect.target-3.16.dev39.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
|
340
|
+
dissect.target-3.16.dev39.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
|
341
|
+
dissect.target-3.16.dev39.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
{dissect.target-3.16.dev38.dist-info → dissect.target-3.16.dev39.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|