praetorian-cli 2.2.7__tar.gz → 2.2.8__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.
- {praetorian_cli-2.2.7/praetorian_cli.egg-info → praetorian_cli-2.2.8}/PKG-INFO +1 -1
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/chariot.py +34 -19
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/credentials.py +1 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/risks.py +11 -1
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/keychain.py +6 -3
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_conversation.py +9 -9
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_z_cli.py +1 -1
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/conversation/textual_chat.py +1 -1
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8/praetorian_cli.egg-info}/PKG-INFO +1 -1
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/setup.cfg +1 -1
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/LICENSE +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/MANIFEST.in +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/README.md +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/add.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/aegis.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/agent.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/chariot.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/cli_decorators.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/configure.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/delete.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/enrich.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/get.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/imports.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/link.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/list.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/script.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/search.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/ssh_utils.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/test.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/unlink.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/update.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/handlers/utils.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/main.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/scripts/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/scripts/commands/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/scripts/commands/nmap-example.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/scripts/utils.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/accounts.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/aegis.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/agents.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/assets.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/attributes.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/capabilities.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/configurations.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/definitions.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/files.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/integrations.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/jobs.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/keys.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/preseeds.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/scanners.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/schema.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/search.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/seeds.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/settings.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/statistics.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/webhook.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/entities/webpage.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/mcp_server.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/model/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/model/aegis.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/model/globals.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/model/query.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/model/utils.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/pytest.ini +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_account.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_agent.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_asset.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_attribute.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_capabilities.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_configuration.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_definition.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_extend.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_file.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_job.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_key.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_mcp.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_preseed.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_risk.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_search.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_seed.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_setting.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_webhook.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/test_webpage.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/ui_mocks.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/sdk/test/utils.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/commands/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/commands/help.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/commands/info.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/commands/job.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/commands/list.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/commands/set.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/commands/ssh.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/constants.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/menu.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/aegis/utils.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/conversation/__init__.py +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli.egg-info/SOURCES.txt +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli.egg-info/dependency_links.txt +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli.egg-info/entry_points.txt +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli.egg-info/requires.txt +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli.egg-info/top_level.txt +0 -0
- {praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/pyproject.toml +0 -0
|
@@ -64,19 +64,25 @@ class Chariot:
|
|
|
64
64
|
import urllib3
|
|
65
65
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
66
66
|
|
|
67
|
-
def
|
|
67
|
+
def chariot_request(self, method: str, url: str, **kwargs) -> requests.Response:
|
|
68
68
|
"""
|
|
69
|
-
Centralized method to make HTTP requests with
|
|
70
|
-
|
|
69
|
+
Centralized method to make HTTP requests to the Chariot API with all global headers/parameters set.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
self.add_beta_url_param(kwargs)
|
|
73
|
+
|
|
74
|
+
return self.request(method, url, self.keychain.headers(), **kwargs)
|
|
75
|
+
|
|
76
|
+
def request(self, method: str, url: str, headers: dict = None, **kwargs) -> requests.Response:
|
|
77
|
+
"""
|
|
78
|
+
Centralized wrapper around requests.request, ensuring the HTTP proxy is respected.
|
|
71
79
|
"""
|
|
72
80
|
|
|
73
81
|
if self.proxy:
|
|
74
82
|
kwargs['proxies'] = {'http': self.proxy, 'https': self.proxy}
|
|
75
83
|
kwargs['verify'] = False
|
|
76
|
-
|
|
77
|
-
self.add_beta_url_param(kwargs)
|
|
78
84
|
|
|
79
|
-
return requests.request(method, url, headers=
|
|
85
|
+
return requests.request(method, url, headers=headers, **kwargs)
|
|
80
86
|
|
|
81
87
|
def add_beta_url_param(self, kwargs: dict):
|
|
82
88
|
if 'params' in kwargs:
|
|
@@ -94,7 +100,7 @@ class Chariot:
|
|
|
94
100
|
|
|
95
101
|
# The search is on data in DynamoDB, which uses DynamoDB's native offset format.
|
|
96
102
|
for _ in range(pages):
|
|
97
|
-
resp = self.
|
|
103
|
+
resp = self.chariot_request('GET', self.url('/my'), params=params)
|
|
98
104
|
process_failure(resp)
|
|
99
105
|
resp = resp.json()
|
|
100
106
|
extend(final_resp, resp)
|
|
@@ -121,7 +127,7 @@ class Chariot:
|
|
|
121
127
|
final_resp = dict()
|
|
122
128
|
|
|
123
129
|
while pages > 0:
|
|
124
|
-
resp = self.
|
|
130
|
+
resp = self.chariot_request('POST', self.url('/my'), json=raw_query, params=params)
|
|
125
131
|
if is_query_limit_failure(resp):
|
|
126
132
|
# In this block, the data size is too large for the number of records requested in raw_query['limit'].
|
|
127
133
|
# We need to halve the page size: LIMIT = LIMIT / 2
|
|
@@ -148,22 +154,22 @@ class Chariot:
|
|
|
148
154
|
return final_resp
|
|
149
155
|
|
|
150
156
|
def post(self, type: str, body: dict, params: dict = {}) -> dict:
|
|
151
|
-
resp = self.
|
|
157
|
+
resp = self.chariot_request('POST', self.url(f'/{type}'), json=body, params=params)
|
|
152
158
|
process_failure(resp)
|
|
153
159
|
return resp.json()
|
|
154
160
|
|
|
155
161
|
def put(self, type: str, body: dict, params: dict = {}) -> dict:
|
|
156
|
-
resp = self.
|
|
162
|
+
resp = self.chariot_request('PUT', self.url(f'/{type}'), json=body, params=params)
|
|
157
163
|
process_failure(resp)
|
|
158
164
|
return resp.json()
|
|
159
165
|
|
|
160
166
|
def get(self, type: str, params: dict = {}) -> dict:
|
|
161
|
-
resp = self.
|
|
167
|
+
resp = self.chariot_request('GET', self.url(f'/{type}'), params=params)
|
|
162
168
|
process_failure(resp)
|
|
163
169
|
return resp.json()
|
|
164
170
|
|
|
165
171
|
def delete(self, type: str, body: dict, params: dict) -> dict:
|
|
166
|
-
resp = self.
|
|
172
|
+
resp = self.chariot_request('DELETE', self.url(f'/{type}'), json=body, params=params)
|
|
167
173
|
process_failure(resp)
|
|
168
174
|
return resp.json()
|
|
169
175
|
|
|
@@ -183,12 +189,12 @@ class Chariot:
|
|
|
183
189
|
return self.put(type, body, params)
|
|
184
190
|
|
|
185
191
|
def link_account(self, username: str, value: str = '', config: dict = {}) -> dict:
|
|
186
|
-
resp = self.
|
|
192
|
+
resp = self.chariot_request('POST', self.url(f'/account/{username}'), json=dict(config=config, value=value))
|
|
187
193
|
process_failure(resp)
|
|
188
194
|
return resp.json()
|
|
189
195
|
|
|
190
196
|
def unlink(self, username: str, value: str = '', config: dict = {}) -> dict:
|
|
191
|
-
resp = self.
|
|
197
|
+
resp = self.chariot_request('DELETE', self.url(f'/account/{username}'), json=dict(value=value, config=config))
|
|
192
198
|
process_failure(resp)
|
|
193
199
|
return resp.json()
|
|
194
200
|
|
|
@@ -202,7 +208,7 @@ class Chariot:
|
|
|
202
208
|
def _upload(self, chariot_filepath: str, content: str) -> dict:
|
|
203
209
|
# It is a two-step upload. The PUT request to the /file endpoint is to get a presigned URL for S3.
|
|
204
210
|
# There is no data transfer.
|
|
205
|
-
presigned_url = self.
|
|
211
|
+
presigned_url = self.chariot_request('PUT', self.url('/file'), params=dict(name=chariot_filepath))
|
|
206
212
|
process_failure(presigned_url)
|
|
207
213
|
resp = requests.put(presigned_url.json()['url'], data=content)
|
|
208
214
|
process_failure(resp)
|
|
@@ -213,12 +219,21 @@ class Chariot:
|
|
|
213
219
|
if global_:
|
|
214
220
|
params |= GLOBAL_FLAG
|
|
215
221
|
|
|
216
|
-
resp = self.
|
|
222
|
+
resp = self.chariot_request('GET', self.url('/file'), params=params)
|
|
223
|
+
process_failure(resp)
|
|
224
|
+
|
|
225
|
+
data = resp.json()
|
|
226
|
+
url = data.get("url", None)
|
|
227
|
+
if not url:
|
|
228
|
+
message = f'Download request failed: response missing URL' + (f'\nBody: {resp.text}' if resp.text else '(empty)')
|
|
229
|
+
raise Exception(message)
|
|
230
|
+
|
|
231
|
+
resp = self.request('GET', url)
|
|
217
232
|
process_failure(resp)
|
|
218
233
|
return resp.content
|
|
219
234
|
|
|
220
235
|
def count(self, params: dict) -> dict:
|
|
221
|
-
resp = self.
|
|
236
|
+
resp = self.chariot_request('GET', self.url('/my/count'), params=params)
|
|
222
237
|
process_failure(resp)
|
|
223
238
|
return resp.json()
|
|
224
239
|
|
|
@@ -227,11 +242,11 @@ class Chariot:
|
|
|
227
242
|
return json.loads(self.download(f'enrichments/{type}/{filename}', True).decode('utf-8'))
|
|
228
243
|
|
|
229
244
|
def purge(self):
|
|
230
|
-
self.
|
|
245
|
+
self.chariot_request('DELETE', self.url('/account/purge'))
|
|
231
246
|
|
|
232
247
|
def agent(self, agent: str, body: dict) -> dict:
|
|
233
248
|
body = body | dict(agent=agent)
|
|
234
|
-
resp = self.
|
|
249
|
+
resp = self.chariot_request('PUT', self.url('/agent'), json=body)
|
|
235
250
|
process_failure(resp)
|
|
236
251
|
return resp.json()
|
|
237
252
|
|
|
@@ -102,7 +102,17 @@ class Risks:
|
|
|
102
102
|
if contains_filter:
|
|
103
103
|
contains_filter_filter = Filter(field=Filter.Field.KEY, operator=Filter.Operator.CONTAINS, value=contains_filter)
|
|
104
104
|
filters.append(contains_filter_filter)
|
|
105
|
-
|
|
105
|
+
|
|
106
|
+
query = Query(
|
|
107
|
+
Node(
|
|
108
|
+
labels=[Node.Label.RISK],
|
|
109
|
+
filters=filters
|
|
110
|
+
)
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
if offset:
|
|
114
|
+
query.page = int(offset)
|
|
115
|
+
|
|
106
116
|
return self.api.search.by_query(query, pages)
|
|
107
117
|
|
|
108
118
|
def attributes(self, key):
|
|
@@ -65,13 +65,16 @@ class Keychain:
|
|
|
65
65
|
error(f'Could not find the "{self.profile}" profile in {self.filepath}. Run "praetorian configure" to fix.')
|
|
66
66
|
|
|
67
67
|
profile = self.config[self.profile]
|
|
68
|
-
|
|
69
|
-
error(f'Keychain profile "{self.profile}" is corrupted or incomplete. Run "praetorian configure" to fix.')
|
|
70
|
-
|
|
68
|
+
|
|
71
69
|
self.load_env('username', 'PRAETORIAN_CLI_USERNAME', required=False)
|
|
72
70
|
self.load_env('password', 'PRAETORIAN_CLI_PASSWORD', required=False)
|
|
73
71
|
self.load_env(API_KEY_ID, 'PRAETORIAN_CLI_API_KEY_ID', required=False)
|
|
74
72
|
self.load_env(API_KEY_SECRET, 'PRAETORIAN_CLI_API_KEY_SECRET', required=False)
|
|
73
|
+
self.load_env('api', 'PRAETORIAN_CLI_API', required=False)
|
|
74
|
+
self.load_env('client_id', 'PRAETORIAN_CLI_CLIENT_ID', required=False)
|
|
75
|
+
|
|
76
|
+
if 'api' not in profile or 'client_id' not in profile:
|
|
77
|
+
error(f'Keychain profile "{self.profile}" is corrupted or incomplete. Run "praetorian configure" to fix.')
|
|
75
78
|
|
|
76
79
|
if self.account is None:
|
|
77
80
|
self.account = self.config.get(self.profile, 'account', fallback=None)
|
|
@@ -23,7 +23,7 @@ class TestConversation:
|
|
|
23
23
|
"mode": "query"
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
response = self.sdk.
|
|
26
|
+
response = self.sdk.chariot_request("POST", url, json=payload)
|
|
27
27
|
|
|
28
28
|
# Should get successful response
|
|
29
29
|
assert response.status_code == 200
|
|
@@ -45,7 +45,7 @@ class TestConversation:
|
|
|
45
45
|
"mode": "query"
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
response = self.sdk.
|
|
48
|
+
response = self.sdk.chariot_request("POST", url, json=initial_payload)
|
|
49
49
|
assert response.status_code == 200
|
|
50
50
|
|
|
51
51
|
result = response.json()
|
|
@@ -58,7 +58,7 @@ class TestConversation:
|
|
|
58
58
|
"conversationId": conversation_id
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
response = self.sdk.
|
|
61
|
+
response = self.sdk.chariot_request("POST", url, json=follow_up_payload)
|
|
62
62
|
|
|
63
63
|
# Should get successful response
|
|
64
64
|
assert response.status_code == 200
|
|
@@ -72,7 +72,7 @@ class TestConversation:
|
|
|
72
72
|
"mode": "query"
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
response = self.sdk.
|
|
75
|
+
response = self.sdk.chariot_request("POST", url, json=payload)
|
|
76
76
|
assert response.status_code == 200
|
|
77
77
|
|
|
78
78
|
result = response.json()
|
|
@@ -100,7 +100,7 @@ class TestConversation:
|
|
|
100
100
|
"mode": "query"
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
response = self.sdk.
|
|
103
|
+
response = self.sdk.chariot_request("POST", url, json=payload)
|
|
104
104
|
assert response.status_code == 200
|
|
105
105
|
|
|
106
106
|
# Wait a moment for conversation to be stored
|
|
@@ -123,7 +123,7 @@ class TestConversation:
|
|
|
123
123
|
# Missing required "message" field
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
response = self.sdk.
|
|
126
|
+
response = self.sdk.chariot_request("POST", url, json=malformed_payload)
|
|
127
127
|
|
|
128
128
|
# Should get a 4xx error for bad request
|
|
129
129
|
assert response.status_code >= 400
|
|
@@ -138,7 +138,7 @@ class TestConversation:
|
|
|
138
138
|
"mode": "query"
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
response = self.sdk.
|
|
141
|
+
response = self.sdk.chariot_request("POST", url, json=query_payload)
|
|
142
142
|
assert response.status_code == 200
|
|
143
143
|
|
|
144
144
|
result = response.json()
|
|
@@ -150,7 +150,7 @@ class TestConversation:
|
|
|
150
150
|
"mode": "agent"
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
response = self.sdk.
|
|
153
|
+
response = self.sdk.chariot_request("POST", url, json=agent_payload)
|
|
154
154
|
assert response.status_code == 200
|
|
155
155
|
|
|
156
156
|
result = response.json()
|
|
@@ -165,7 +165,7 @@ class TestConversation:
|
|
|
165
165
|
"mode": "query"
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
response = self.sdk.
|
|
168
|
+
response = self.sdk.chariot_request("POST", url, json=payload)
|
|
169
169
|
assert response.status_code == 200
|
|
170
170
|
|
|
171
171
|
result = response.json()
|
|
@@ -296,7 +296,7 @@ class TestZCli:
|
|
|
296
296
|
o = make_test_values(lambda: None)
|
|
297
297
|
self.verify(f'add asset --dns "{o.webapp_name}" --name "{o.webapp_url}" --type webapplication')
|
|
298
298
|
self.verify(f'get asset "{o.webapp_key}"', expected_stdout=[o.webapp_key, o.webapp_url, o.webapp_name, '"status"', '"A"'])
|
|
299
|
-
self.verify(f'list assets -f "{o.
|
|
299
|
+
self.verify(f'list assets -f "{o.webapp_key}"', expected_stdout=[o.webapp_key])
|
|
300
300
|
self.verify(f'delete asset "{o.webapp_key}"', ignore_stdout=True)
|
|
301
301
|
|
|
302
302
|
def test_webpage_cli(self):
|
{praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/ui/conversation/textual_chat.py
RENAMED
|
@@ -347,7 +347,7 @@ class ConversationApp(App):
|
|
|
347
347
|
if self.conversation_id:
|
|
348
348
|
payload["conversationId"] = self.conversation_id
|
|
349
349
|
|
|
350
|
-
response = self.sdk.
|
|
350
|
+
response = self.sdk.chariot_request("POST", url, json=payload)
|
|
351
351
|
|
|
352
352
|
if response.status_code == 200:
|
|
353
353
|
result = response.json()
|
|
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
|
{praetorian_cli-2.2.7 → praetorian_cli-2.2.8}/praetorian_cli/scripts/commands/nmap-example.py
RENAMED
|
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
|
|
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
|