exploitfarm 1.7.4__tar.gz → 1.7.6__tar.gz
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.
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/PKG-INFO +1 -1
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/__init__.py +1 -1
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/_init_exposed.py +53 -15
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm.egg-info/PKG-INFO +1 -1
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/setup.py +1 -1
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/MANIFEST.in +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/README.md +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/__main__.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/__init__.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/client.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/dbtypes.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/enums.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/exploit.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/exploit_template.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/flags.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/groups.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/response.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/service.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/submitter.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/models/teams.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/__init__.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/config.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/exploitdownload.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/exploitinit.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/group_prejoin.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/group_select.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/login.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/shared_attack_group.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/startxploit.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/tui/template.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/utils/__init__.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/utils/cmd.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/utils/config.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/utils/exploit.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/utils/reqs.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/utils/templates.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/utils/windows_close_fix.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/xfarm.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm/xploit.py +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm.egg-info/SOURCES.txt +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm.egg-info/dependency_links.txt +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm.egg-info/requires.txt +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/exploitfarm.egg-info/top_level.txt +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/requirements.txt +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/setup.cfg +0 -0
- {exploitfarm-1.7.4 → exploitfarm-1.7.6}/xfarm +0 -0
|
@@ -147,7 +147,7 @@ print = functools.partial(print, flush=True)
|
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
class Store:
|
|
150
|
-
def __init__(self):
|
|
150
|
+
def __init__(self, default_context_id: str | None = None):
|
|
151
151
|
self.base_url = os.getenv("XFARM_REMOTE_URL", None)
|
|
152
152
|
if not self.base_url:
|
|
153
153
|
raise ValueError("this exploit has to be run with xfarm")
|
|
@@ -156,62 +156,100 @@ class Store:
|
|
|
156
156
|
raise ValueError("this exploit has to be run with xfarm")
|
|
157
157
|
self.login_token = os.getenv("XFARM_LOGIN_TOKEN", None)
|
|
158
158
|
self.session: Session = get_session(self.login_token)
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
if default_context_id is not None:
|
|
160
|
+
self._keycheck(default_context_id, "default_context_id")
|
|
161
|
+
self.default_context_id = default_context_id
|
|
162
|
+
|
|
163
|
+
def _get_context_id(self, context_id: str | None = None) -> str | None:
|
|
164
|
+
if context_id is not None:
|
|
165
|
+
self._keycheck(context_id, "context_id")
|
|
166
|
+
return context_id
|
|
167
|
+
if self.default_context_id is not None:
|
|
168
|
+
return self.default_context_id
|
|
169
|
+
return None
|
|
170
|
+
|
|
171
|
+
def _keycheck(self, key: str, what: str = "key"):
|
|
161
172
|
if not isinstance(key, str):
|
|
162
|
-
raise ValueError("
|
|
173
|
+
raise ValueError(f"{what} must be a string")
|
|
163
174
|
if len(key) > 255:
|
|
164
|
-
raise ValueError("
|
|
175
|
+
raise ValueError(f"{what} must be less than 255 characters")
|
|
165
176
|
if not re.match(r"^[A-Za-z0-9\-\._~()'!*:@,;]+$", key):
|
|
166
|
-
raise ValueError(
|
|
177
|
+
raise ValueError(rf"{what} must match this regex: ^[A-Za-z0-9\-\._~()'!*:@,;$]+$")
|
|
167
178
|
|
|
168
|
-
def get_bytes(self, key: str, default=None, timeout: int = HTTP_TIMEOUT) -> bytes:
|
|
179
|
+
def get_bytes(self, key: str, default=None, context_id: str | None = None, timeout: int = HTTP_TIMEOUT) -> bytes:
|
|
180
|
+
context_id = self._get_context_id(context_id)
|
|
169
181
|
self._keycheck(key)
|
|
170
182
|
r = self.session.get(
|
|
171
183
|
urljoin(self.base_url, f"exploits/{self.exploit_id}/store/key/{key}"),
|
|
184
|
+
params={"context_id": context_id} if context_id else None,
|
|
172
185
|
timeout=timeout,
|
|
173
186
|
)
|
|
174
187
|
if r.status_code == 404:
|
|
175
188
|
return default
|
|
176
189
|
return check_req(r).content
|
|
177
190
|
|
|
178
|
-
def get(self, key: str, default=None, timeout: int = HTTP_TIMEOUT) -> bytes:
|
|
191
|
+
def get(self, key: str, default=None, context_id: str | None = None, timeout: int = HTTP_TIMEOUT) -> bytes:
|
|
179
192
|
class TmpNotFound:
|
|
180
193
|
pass
|
|
181
|
-
|
|
182
|
-
data = self.get_bytes(key, default=TmpNotFound, timeout=timeout)
|
|
194
|
+
data = self.get_bytes(key, context_id=context_id, default=TmpNotFound, timeout=timeout)
|
|
183
195
|
if data == TmpNotFound:
|
|
184
196
|
return default
|
|
185
197
|
return pickle.loads(data)
|
|
186
198
|
|
|
187
|
-
def set_bytes(self, key: str, value: bytes, timeout: int = HTTP_TIMEOUT):
|
|
199
|
+
def set_bytes(self, key: str, value: bytes, context_id: str | None = None, timeout: int = HTTP_TIMEOUT):
|
|
188
200
|
self._keycheck(key)
|
|
201
|
+
context_id = self._get_context_id(context_id)
|
|
189
202
|
return requests_check_json(
|
|
190
203
|
self.session.put(
|
|
191
204
|
urljoin(self.base_url, f"exploits/{self.exploit_id}/store/key/{key}"),
|
|
192
205
|
data=value,
|
|
193
206
|
timeout=timeout,
|
|
194
207
|
headers={"Content-Type": "application/octet-stream"},
|
|
208
|
+
params={"context_id": context_id} if context_id else None,
|
|
195
209
|
)
|
|
196
210
|
)
|
|
197
211
|
|
|
198
|
-
def set(self, key: str, value, timeout: int = HTTP_TIMEOUT):
|
|
212
|
+
def set(self, key: str, value, context_id: str | None = None, timeout: int = HTTP_TIMEOUT):
|
|
199
213
|
value = pickle.dumps(value)
|
|
200
|
-
return self.set_bytes(key, value, timeout)
|
|
214
|
+
return self.set_bytes(key, value, context_id=context_id, timeout=timeout)
|
|
201
215
|
|
|
202
|
-
def delete(self, key: str, timeout: int = HTTP_TIMEOUT):
|
|
216
|
+
def delete(self, key: str, context_id: str | None = None, timeout: int = HTTP_TIMEOUT):
|
|
203
217
|
self._keycheck(key)
|
|
218
|
+
context_id = self._get_context_id(context_id)
|
|
204
219
|
return requests_check_json(
|
|
205
220
|
self.session.delete(
|
|
206
221
|
urljoin(self.base_url, f"exploits/{self.exploit_id}/store/key/{key}"),
|
|
222
|
+
params={"context_id": context_id} if context_id else None,
|
|
207
223
|
timeout=timeout,
|
|
208
224
|
)
|
|
209
225
|
)
|
|
210
226
|
|
|
211
|
-
def keys(self, timeout: int = HTTP_TIMEOUT) -> list[str]:
|
|
227
|
+
def keys(self, timeout: int = HTTP_TIMEOUT, context_id: str | None = None) -> list[str]:
|
|
228
|
+
context_id = self._get_context_id(context_id)
|
|
212
229
|
return requests_check_json(
|
|
213
230
|
self.session.get(
|
|
214
231
|
urljoin(self.base_url, f"exploits/{self.exploit_id}/store/keys"),
|
|
232
|
+
params={ "context_id": context_id } if context_id else None,
|
|
233
|
+
timeout=timeout,
|
|
234
|
+
)
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
def contexts(self, timeout: int = HTTP_TIMEOUT) -> list[str]:
|
|
238
|
+
return requests_check_json(
|
|
239
|
+
self.session.get(
|
|
240
|
+
urljoin(self.base_url, f"exploits/{self.exploit_id}/store/contexts"),
|
|
241
|
+
timeout=timeout,
|
|
242
|
+
)
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
def delete_context(self, context_id: str | None = None, timeout: int = HTTP_TIMEOUT):
|
|
246
|
+
context_id = self._get_context_id(context_id)
|
|
247
|
+
if not context_id:
|
|
248
|
+
raise ValueError("context_id must be provided to delete it")
|
|
249
|
+
self._keycheck(context_id, "context_id")
|
|
250
|
+
return requests_check_json(
|
|
251
|
+
self.session.delete(
|
|
252
|
+
urljoin(self.base_url, f"exploits/{self.exploit_id}/store/context/{context_id}"),
|
|
215
253
|
timeout=timeout,
|
|
216
254
|
)
|
|
217
255
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|