dissect.target 3.17.dev27__py3-none-any.whl → 3.17.dev28__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- dissect/target/loaders/mqtt.py +41 -16
- dissect/target/tools/query.py +1 -2
- {dissect.target-3.17.dev27.dist-info → dissect.target-3.17.dev28.dist-info}/METADATA +1 -1
- {dissect.target-3.17.dev27.dist-info → dissect.target-3.17.dev28.dist-info}/RECORD +9 -9
- {dissect.target-3.17.dev27.dist-info → dissect.target-3.17.dev28.dist-info}/COPYRIGHT +0 -0
- {dissect.target-3.17.dev27.dist-info → dissect.target-3.17.dev28.dist-info}/LICENSE +0 -0
- {dissect.target-3.17.dev27.dist-info → dissect.target-3.17.dev28.dist-info}/WHEEL +0 -0
- {dissect.target-3.17.dev27.dist-info → dissect.target-3.17.dev28.dist-info}/entry_points.txt +0 -0
- {dissect.target-3.17.dev27.dist-info → dissect.target-3.17.dev28.dist-info}/top_level.txt +0 -0
dissect/target/loaders/mqtt.py
CHANGED
@@ -65,6 +65,9 @@ class MQTTStream(AlignedStream):
|
|
65
65
|
class MQTTConnection:
|
66
66
|
broker = None
|
67
67
|
host = None
|
68
|
+
prev = -1
|
69
|
+
factor = 1
|
70
|
+
prefetch_factor_inc = 10
|
68
71
|
|
69
72
|
def __init__(self, broker: Broker, host: str):
|
70
73
|
self.broker = broker
|
@@ -95,20 +98,32 @@ class MQTTConnection:
|
|
95
98
|
|
96
99
|
def read(self, disk_id: int, offset: int, length: int, optimization_strategy: int) -> bytes:
|
97
100
|
message = None
|
98
|
-
self.broker.seek(self.host, disk_id, offset, length, optimization_strategy)
|
99
101
|
|
102
|
+
message = self.broker.read(self.host, disk_id, offset, length)
|
103
|
+
if message:
|
104
|
+
return message.data
|
105
|
+
|
106
|
+
if self.prev == offset - (length * self.factor):
|
107
|
+
if self.factor < 500:
|
108
|
+
self.factor += self.prefetch_factor_inc
|
109
|
+
else:
|
110
|
+
self.factor = 1
|
111
|
+
|
112
|
+
self.prev = offset
|
113
|
+
flength = length * self.factor
|
114
|
+
self.broker.factor = self.factor
|
115
|
+
self.broker.seek(self.host, disk_id, offset, flength, optimization_strategy)
|
100
116
|
attempts = 0
|
101
117
|
while True:
|
102
|
-
message
|
103
|
-
|
104
|
-
if message:
|
118
|
+
if message := self.broker.read(self.host, disk_id, offset, length):
|
119
|
+
# don't waste time with sleep if we have a response
|
105
120
|
break
|
106
121
|
|
107
122
|
attempts += 1
|
108
|
-
time.sleep(0.
|
109
|
-
if attempts >
|
123
|
+
time.sleep(0.1)
|
124
|
+
if attempts > 300:
|
110
125
|
# message might have not reached agent, resend...
|
111
|
-
self.broker.seek(self.host, disk_id, offset,
|
126
|
+
self.broker.seek(self.host, disk_id, offset, flength, optimization_strategy)
|
112
127
|
attempts = 0
|
113
128
|
|
114
129
|
return message.data
|
@@ -127,6 +142,7 @@ class Broker:
|
|
127
142
|
diskinfo = {}
|
128
143
|
index = {}
|
129
144
|
topo = {}
|
145
|
+
factor = 1
|
130
146
|
|
131
147
|
def __init__(self, broker: Broker, port: str, key: str, crt: str, ca: str, case: str, **kwargs):
|
132
148
|
self.broker_host = broker
|
@@ -137,10 +153,13 @@ class Broker:
|
|
137
153
|
self.case = case
|
138
154
|
self.command = kwargs.get("command", None)
|
139
155
|
|
156
|
+
def clear_cache(self) -> None:
|
157
|
+
self.index = {}
|
158
|
+
|
140
159
|
@suppress
|
141
160
|
def read(self, host: str, disk_id: int, seek_address: int, read_length: int) -> SeekMessage:
|
142
161
|
key = f"{host}-{disk_id}-{seek_address}-{read_length}"
|
143
|
-
return self.index.
|
162
|
+
return self.index.get(key)
|
144
163
|
|
145
164
|
@suppress
|
146
165
|
def disk(self, host: str) -> DiskMessage:
|
@@ -165,14 +184,15 @@ class Broker:
|
|
165
184
|
disk_id = tokens[3]
|
166
185
|
seek_address = int(tokens[4], 16)
|
167
186
|
read_length = int(tokens[5], 16)
|
168
|
-
msg = SeekMessage(data=payload)
|
169
187
|
|
170
|
-
|
188
|
+
for i in range(self.factor):
|
189
|
+
sublength = int(read_length / self.factor)
|
190
|
+
start = i * sublength
|
191
|
+
key = f"{hostname}-{disk_id}-{seek_address+start}-{sublength}"
|
192
|
+
if key in self.index:
|
193
|
+
continue
|
171
194
|
|
172
|
-
|
173
|
-
return
|
174
|
-
|
175
|
-
self.index[key] = msg
|
195
|
+
self.index[key] = SeekMessage(data=payload[start : start + sublength])
|
176
196
|
|
177
197
|
def _on_id(self, hostname: str, payload: bytes) -> None:
|
178
198
|
key = hostname
|
@@ -204,9 +224,14 @@ class Broker:
|
|
204
224
|
elif response == "ID":
|
205
225
|
self._on_id(hostname, msg.payload)
|
206
226
|
|
207
|
-
def seek(self, host: str, disk_id: int, offset: int,
|
227
|
+
def seek(self, host: str, disk_id: int, offset: int, flength: int, optimization_strategy: int) -> None:
|
228
|
+
length = int(flength / self.factor)
|
229
|
+
key = f"{host}-{disk_id}-{offset}-{length}"
|
230
|
+
if key in self.index:
|
231
|
+
return
|
232
|
+
|
208
233
|
self.mqtt_client.publish(
|
209
|
-
f"{self.case}/{host}/SEEK/{disk_id}/{hex(offset)}/{hex(
|
234
|
+
f"{self.case}/{host}/SEEK/{disk_id}/{hex(offset)}/{hex(flength)}", pack("<I", optimization_strategy)
|
210
235
|
)
|
211
236
|
|
212
237
|
def info(self, host: str) -> None:
|
dissect/target/tools/query.py
CHANGED
@@ -173,8 +173,7 @@ def main():
|
|
173
173
|
collected_plugins = {}
|
174
174
|
|
175
175
|
if targets:
|
176
|
-
for
|
177
|
-
plugin_target = Target.open(target)
|
176
|
+
for plugin_target in Target.open_all(targets, args.children):
|
178
177
|
if isinstance(plugin_target._loader, ProxyLoader):
|
179
178
|
parser.error("can't list compatible plugins for remote targets.")
|
180
179
|
funcs, _ = find_plugin_functions(plugin_target, args.list, compatibility=True, show_hidden=True)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dissect.target
|
3
|
-
Version: 3.17.
|
3
|
+
Version: 3.17.dev28
|
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
|
@@ -85,7 +85,7 @@ dissect/target/loaders/itunes.py,sha256=69aMTQiiGYpmD_EYSmf9mO1re8C3jAZIEStmwlMx
|
|
85
85
|
dissect/target/loaders/kape.py,sha256=t5TfrGLqPeIpUUpXzIl6aHsqXMEGDqJ5YwDCs07DiBA,1237
|
86
86
|
dissect/target/loaders/local.py,sha256=Ul-LCd_fY7SyWOVR6nH-NqbkuNpxoZVmffwrkvQElU8,16453
|
87
87
|
dissect/target/loaders/log.py,sha256=cCkDIRS4aPlX3U-n_jUKaI2FPSV3BDpfqKceaU7rBbo,1507
|
88
|
-
dissect/target/loaders/mqtt.py,sha256=
|
88
|
+
dissect/target/loaders/mqtt.py,sha256=D8AmdOz2atD92z8bhjVFi3tC1H7pYmP4UrOCtMgfwMY,10396
|
89
89
|
dissect/target/loaders/multiraw.py,sha256=4a3ZST0NwjnfPDxHkcEfAcX2ddUlT_C-rcrMHNg1wp4,1046
|
90
90
|
dissect/target/loaders/ova.py,sha256=6h4O-7i87J394C6KgLsPkdXRAKNwtPubzLNS3vBGs7U,744
|
91
91
|
dissect/target/loaders/ovf.py,sha256=ELMq6J2y6cPKbp7pjWAqMMnFYefWxXNqzIiAQdvGGXQ,1061
|
@@ -320,7 +320,7 @@ dissect/target/tools/fs.py,sha256=cizCrW8rqdpT1irA8g6mslkaXX7CynWVQ7fvRUrcxNU,37
|
|
320
320
|
dissect/target/tools/info.py,sha256=3smHr8I71yj3kCjsQ5nXkOHI9T_N8UwvkVa1CNOxB-s,5461
|
321
321
|
dissect/target/tools/logging.py,sha256=5ZnumtMWLyslxfrUGZ4ntRyf3obOOhmn8SBjKfdLcEg,4174
|
322
322
|
dissect/target/tools/mount.py,sha256=L_0tSmiBdW4aSaF0vXjB0bAkTC0kmT2N1hrbW6s5Jow,3254
|
323
|
-
dissect/target/tools/query.py,sha256=
|
323
|
+
dissect/target/tools/query.py,sha256=ONHu2FVomLccikb84qBrlhNmEfRoHYFQMcahk_y2c9A,15580
|
324
324
|
dissect/target/tools/reg.py,sha256=FDsiBBDxjWVUBTRj8xn82vZe-J_d9piM-TKS3PHZCcM,3193
|
325
325
|
dissect/target/tools/shell.py,sha256=4v6Z06YJDjKv6e6SRvWNjQ2n_KHo_CjL4P0w1_gY_ro,44827
|
326
326
|
dissect/target/tools/utils.py,sha256=sQizexY3ui5vmWw4KOBLg5ecK3TPFjD-uxDqRn56ZTY,11304
|
@@ -336,10 +336,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
|
|
336
336
|
dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
|
337
337
|
dissect/target/volumes/md.py,sha256=j1K1iKmspl0C_OJFc7-Q1BMWN2OCC5EVANIgVlJ_fIE,1673
|
338
338
|
dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
|
339
|
-
dissect.target-3.17.
|
340
|
-
dissect.target-3.17.
|
341
|
-
dissect.target-3.17.
|
342
|
-
dissect.target-3.17.
|
343
|
-
dissect.target-3.17.
|
344
|
-
dissect.target-3.17.
|
345
|
-
dissect.target-3.17.
|
339
|
+
dissect.target-3.17.dev28.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
|
340
|
+
dissect.target-3.17.dev28.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
341
|
+
dissect.target-3.17.dev28.dist-info/METADATA,sha256=BUIYxmU-67ACgU91l-B3EP-B6QpBkjk-OBY7EOMDfBU,11300
|
342
|
+
dissect.target-3.17.dev28.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
343
|
+
dissect.target-3.17.dev28.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
|
344
|
+
dissect.target-3.17.dev28.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
|
345
|
+
dissect.target-3.17.dev28.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
{dissect.target-3.17.dev27.dist-info → dissect.target-3.17.dev28.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|