praetorian-cli 2.2.12__py3-none-any.whl → 2.2.13__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.
- praetorian_cli/handlers/add.py +46 -4
- praetorian_cli/sdk/entities/credentials.py +26 -0
- praetorian_cli/sdk/entities/jobs.py +8 -5
- {praetorian_cli-2.2.12.dist-info → praetorian_cli-2.2.13.dist-info}/METADATA +1 -1
- {praetorian_cli-2.2.12.dist-info → praetorian_cli-2.2.13.dist-info}/RECORD +9 -9
- {praetorian_cli-2.2.12.dist-info → praetorian_cli-2.2.13.dist-info}/WHEEL +0 -0
- {praetorian_cli-2.2.12.dist-info → praetorian_cli-2.2.13.dist-info}/entry_points.txt +0 -0
- {praetorian_cli-2.2.12.dist-info → praetorian_cli-2.2.13.dist-info}/licenses/LICENSE +0 -0
- {praetorian_cli-2.2.12.dist-info → praetorian_cli-2.2.13.dist-info}/top_level.txt +0 -0
praetorian_cli/handlers/add.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import datetime
|
|
2
|
+
import json
|
|
2
3
|
import os.path
|
|
3
4
|
|
|
4
5
|
import click
|
|
@@ -163,7 +164,8 @@ def risk(sdk, name, asset, status, comment, capability):
|
|
|
163
164
|
@click.option('-c', '--capability', 'capabilities', multiple=True,
|
|
164
165
|
help='Capabilities to run (can be specified multiple times)')
|
|
165
166
|
@click.option('-g', '--config', help='JSON configuration string')
|
|
166
|
-
|
|
167
|
+
@click.option('-s', '--credential', 'credentials', help='Credential ID to use with the job', multiple=True)
|
|
168
|
+
def job(sdk, key, capabilities, config, credentials):
|
|
167
169
|
""" Schedule scan jobs for an asset or an attribute
|
|
168
170
|
|
|
169
171
|
This command schedules the relevant discovery and vulnerability scans for
|
|
@@ -176,8 +178,9 @@ def job(sdk, key, capabilities, config):
|
|
|
176
178
|
- praetorian chariot add job --key "#asset#example.com#1.2.3.4" -c subdomain -c portscan
|
|
177
179
|
- praetorian chariot add job --key "#attribute#ssh#22#asset#api.www.example.com#1.2.3.4"
|
|
178
180
|
- praetorian chariot add job --key "#asset#example.com#1.2.3.4" --config '{"run-type":"login"}'
|
|
181
|
+
- praetorian chariot add job --key "#asset#example.com#1.2.3.4" --config '{"run-type":"login"} --credential "E4644F37-6985-40B4-8D07-5311516D98F1"'
|
|
179
182
|
"""
|
|
180
|
-
sdk.jobs.add(key, capabilities, config)
|
|
183
|
+
sdk.jobs.add(key, capabilities, config, credentials)
|
|
181
184
|
|
|
182
185
|
|
|
183
186
|
@add.command()
|
|
@@ -333,13 +336,52 @@ def key(sdk, name, expires):
|
|
|
333
336
|
@click.option('-p', '--parent', required=False, help='Optional key of the parent WebApplication')
|
|
334
337
|
def webpage(sdk, url, parent):
|
|
335
338
|
""" Add a Webpage
|
|
336
|
-
|
|
339
|
+
|
|
337
340
|
Add a web page to the Chariot database. Webpages can optionally be associated
|
|
338
341
|
with a parent WebApplication or exist independently.
|
|
339
|
-
|
|
342
|
+
|
|
340
343
|
\b
|
|
341
344
|
Example usages:
|
|
342
345
|
- praetorian chariot add webpage --url https://app.example.com/login
|
|
343
346
|
- praetorian chariot add webpage --url https://app.example.com/admin --parent "#webapplication#https://app.example.com"
|
|
344
347
|
"""
|
|
345
348
|
sdk.webpage.add(url, parent)
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
@add.command()
|
|
352
|
+
@cli_handler
|
|
353
|
+
@click.option('-r', '--resource-key', required=True, help='The resource key for the credential (e.g., account key)')
|
|
354
|
+
@click.option('-c', '--category', required=True,
|
|
355
|
+
type=click.Choice(['integration', 'cloud', 'env-integration']),
|
|
356
|
+
help='The category of the credential')
|
|
357
|
+
@click.option('-t', '--type', 'cred_type', required=True,
|
|
358
|
+
help='The type of credential (aws, gcp, azure, static, ssh_key, json, active-directory, default)')
|
|
359
|
+
@click.option('-l', '--label', required=True, help='A human-readable label for the credential')
|
|
360
|
+
@click.option('-p', '--param', 'parameters', multiple=True,
|
|
361
|
+
help='Parameter in format key=value (can be specified multiple times)')
|
|
362
|
+
def credential(sdk, resource_key, category, cred_type, label, parameters):
|
|
363
|
+
""" Add a credential
|
|
364
|
+
|
|
365
|
+
This command adds a credential to the credential broker. Credentials can be used
|
|
366
|
+
for authentication with various cloud providers, integrations, and environment services.
|
|
367
|
+
|
|
368
|
+
\b
|
|
369
|
+
Example usages:
|
|
370
|
+
- praetorian chariot add credential --resource-key "C.0c6cf7104f516b08-OGMPG" --category env-integration --type active-directory --label "Robb Stark" --param username=robb.stark --param password=sexywolfy --param domain=north.sevenkingdoms.local
|
|
371
|
+
- praetorian chariot add credential -r "C.example-key" -c cloud -t aws --label "AWS Production" -p region=us-east-1 -p role_arn=arn:aws:iam::123456789012:role/MyRole
|
|
372
|
+
- praetorian chariot add credential -r "C.example-key" -c integration -t static --label "API Token" -p token=abc123xyz
|
|
373
|
+
"""
|
|
374
|
+
# Parse parameters from key=value format
|
|
375
|
+
params = {}
|
|
376
|
+
for param in parameters:
|
|
377
|
+
if '=' not in param:
|
|
378
|
+
error(f"Parameter '{param}' is not in the format key=value")
|
|
379
|
+
return
|
|
380
|
+
key, value = param.split('=', 1)
|
|
381
|
+
params[key] = value
|
|
382
|
+
|
|
383
|
+
try:
|
|
384
|
+
result = sdk.credentials.add(resource_key, category, cred_type, label, params)
|
|
385
|
+
click.echo(json.dumps(result, indent=2))
|
|
386
|
+
except Exception as e:
|
|
387
|
+
error(f'Unable to add credential. Error: {e}')
|
|
@@ -9,6 +9,32 @@ class Credentials:
|
|
|
9
9
|
def __init__(self, api):
|
|
10
10
|
self.api = api
|
|
11
11
|
|
|
12
|
+
def add(self, resource_key, category, type, label, parameters):
|
|
13
|
+
"""
|
|
14
|
+
Add a new credential to the credential broker.
|
|
15
|
+
|
|
16
|
+
:param resource_key: The resource key for the credential (e.g., account key)
|
|
17
|
+
:type resource_key: str
|
|
18
|
+
:param category: The category of the credential ('integration', 'cloud', 'env-integration')
|
|
19
|
+
:type category: str
|
|
20
|
+
:param type: The type of credential ('aws', 'gcp', 'azure', 'static', 'ssh_key', 'json', 'active-directory', 'default')
|
|
21
|
+
:type type: str
|
|
22
|
+
:param label: A human-readable label for the credential
|
|
23
|
+
:type label: str
|
|
24
|
+
:param parameters: Additional parameters for the credential (e.g., username, password, domain)
|
|
25
|
+
:type parameters: dict
|
|
26
|
+
:return: The response from the broker API
|
|
27
|
+
:rtype: dict
|
|
28
|
+
"""
|
|
29
|
+
request = {
|
|
30
|
+
'Operation': 'add',
|
|
31
|
+
'ResourceKey': resource_key,
|
|
32
|
+
'Category': category,
|
|
33
|
+
'Type': type,
|
|
34
|
+
'Parameters': parameters | {'label': label}
|
|
35
|
+
}
|
|
36
|
+
return self.api.post('broker', request)
|
|
37
|
+
|
|
12
38
|
def list(self, offset=None, pages=100000):
|
|
13
39
|
"""
|
|
14
40
|
List credentials available to the current principal.
|
|
@@ -8,7 +8,7 @@ class Jobs:
|
|
|
8
8
|
def __init__(self, api):
|
|
9
9
|
self.api = api
|
|
10
10
|
|
|
11
|
-
def add(self, target_key, capabilities=[], config=None):
|
|
11
|
+
def add(self, target_key, capabilities=[], config=None, credentials=[]):
|
|
12
12
|
"""
|
|
13
13
|
Add a job to execute capabilities against an asset or attribute.
|
|
14
14
|
|
|
@@ -62,19 +62,22 @@ class Jobs:
|
|
|
62
62
|
- crawler: Web application crawler
|
|
63
63
|
- whois: Domain registration information lookup
|
|
64
64
|
"""
|
|
65
|
-
|
|
65
|
+
body = dict(key=target_key)
|
|
66
66
|
if capabilities:
|
|
67
|
-
|
|
67
|
+
body = body | dict(capabilities=capabilities)
|
|
68
68
|
|
|
69
69
|
if config:
|
|
70
70
|
try:
|
|
71
|
-
|
|
71
|
+
body = body | dict(config=json.loads(config))
|
|
72
72
|
except json.JSONDecodeError as e:
|
|
73
73
|
raise Exception(f"Invalid JSON in configuration string: {e}")
|
|
74
74
|
except Exception as e:
|
|
75
75
|
raise Exception(f"Error processing configuration string: {e}")
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
if credentials:
|
|
78
|
+
body = body | dict(credential_ids=credentials)
|
|
79
|
+
|
|
80
|
+
return self.api.force_add('job', body)
|
|
78
81
|
|
|
79
82
|
def get(self, key):
|
|
80
83
|
"""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
praetorian_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
praetorian_cli/main.py,sha256=AVrOCQgioLDKm-Y8-b3lLLdLtaO1WwOAzUfs0obe5Nw,1451
|
|
3
3
|
praetorian_cli/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
praetorian_cli/handlers/add.py,sha256=
|
|
4
|
+
praetorian_cli/handlers/add.py,sha256=q0lJlGroHx0dA6w7V35CHZoi8tqHdj8lv5wqqRu0ZIA,16266
|
|
5
5
|
praetorian_cli/handlers/aegis.py,sha256=1259bNmoUOVhcs7GqI8TyTyCI_ZvKzEPvfUVvAHcTzU,3936
|
|
6
6
|
praetorian_cli/handlers/agent.py,sha256=52_BcZF10VOuiwkySQpjeh07JdUKaMURo-RLVOINK1w,3165
|
|
7
7
|
praetorian_cli/handlers/chariot.py,sha256=HClwYdsgFKlLY68RhV65W1Y4g-JgbBDdI4PdP4s8MgI,611
|
|
@@ -36,11 +36,11 @@ praetorian_cli/sdk/entities/assets.py,sha256=z8ErleQQ-BdnYkwPWOp2EQ8eJI4YB8qi45X
|
|
|
36
36
|
praetorian_cli/sdk/entities/attributes.py,sha256=AyWsYyjUFNbHTCN7j-OYA7YD1Y0z_LmnlcME5y74je8,3573
|
|
37
37
|
praetorian_cli/sdk/entities/capabilities.py,sha256=WeNlPrhVgLQPbpqYvS4nHmIX697ITpoZkJeLYxG5bmY,2808
|
|
38
38
|
praetorian_cli/sdk/entities/configurations.py,sha256=y32_QYSS6MgGDyz0tEuJgG6jWCI4Vyzwyf0m4SVtVNw,4249
|
|
39
|
-
praetorian_cli/sdk/entities/credentials.py,sha256=
|
|
39
|
+
praetorian_cli/sdk/entities/credentials.py,sha256=tl9NHUGygFkcTFiMzJwO-jjV_HOQH1WAiXBeWwP9Yxc,6247
|
|
40
40
|
praetorian_cli/sdk/entities/definitions.py,sha256=rpuNLM3DZxMr5YINYDD6ePWG1TEI1biZ4IqnjpDAEh0,3125
|
|
41
41
|
praetorian_cli/sdk/entities/files.py,sha256=Gw9Yt_Cm2xR-Vu8vjaekMHbGldhe930WJjjeaJrBLxg,5822
|
|
42
42
|
praetorian_cli/sdk/entities/integrations.py,sha256=NVaW_dWbnMkMIs-EYr2W7QAeamPVwLhmM2ppdMJmsK0,3176
|
|
43
|
-
praetorian_cli/sdk/entities/jobs.py,sha256=
|
|
43
|
+
praetorian_cli/sdk/entities/jobs.py,sha256=k4QFw4qR5MdVyMAYstfnRIWr_ZH4q1PwDyUEGC-qBSM,8269
|
|
44
44
|
praetorian_cli/sdk/entities/keys.py,sha256=PgoGa3xyLMzWrIIQ8zgi7bfZiUFFumPtMDo64GjhdjE,6089
|
|
45
45
|
praetorian_cli/sdk/entities/preseeds.py,sha256=SeSY4K6diJMQzsjCBxYK3N9Lz0fUz3B_LMBOAAcBSLg,8890
|
|
46
46
|
praetorian_cli/sdk/entities/risks.py,sha256=7WcAGiehoGuLlugIujxQC2FcA1ndOh7s_ooEGERpWM4,6630
|
|
@@ -96,9 +96,9 @@ praetorian_cli/ui/aegis/commands/set.py,sha256=WJ0Qt30fBa_hyWEaawyA3h3rSeWHFPbJS
|
|
|
96
96
|
praetorian_cli/ui/aegis/commands/ssh.py,sha256=KGsNlN0i-Cwp6gWyr-cjML9_L13oE7xFenysF2pC8Rc,3045
|
|
97
97
|
praetorian_cli/ui/conversation/__init__.py,sha256=sNhNN_ZG1Va_7OLTaoXlIFL6ageKHWdufFVYw6F_aV8,90
|
|
98
98
|
praetorian_cli/ui/conversation/textual_chat.py,sha256=gGgEs7HhNAto9rTVrGbz62mG10OqmtArI-aKxFLSfVs,24405
|
|
99
|
-
praetorian_cli-2.2.
|
|
100
|
-
praetorian_cli-2.2.
|
|
101
|
-
praetorian_cli-2.2.
|
|
102
|
-
praetorian_cli-2.2.
|
|
103
|
-
praetorian_cli-2.2.
|
|
104
|
-
praetorian_cli-2.2.
|
|
99
|
+
praetorian_cli-2.2.13.dist-info/licenses/LICENSE,sha256=Zv97QripiVALv-WokW_Elsiz9vtOfbtNt1aLZhhk67I,1067
|
|
100
|
+
praetorian_cli-2.2.13.dist-info/METADATA,sha256=MUJwo3wrkUulp376p98YNPnFC_tmNaMvSwGWbANr5xI,7752
|
|
101
|
+
praetorian_cli-2.2.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
102
|
+
praetorian_cli-2.2.13.dist-info/entry_points.txt,sha256=uJbDvZdkYaLiCh2DMvXPUGKFm2p5ZfzJCizUK3-PUEE,56
|
|
103
|
+
praetorian_cli-2.2.13.dist-info/top_level.txt,sha256=QbUdRPGEj_TyHO-E7AD5BxFfR8ore37i273jP4Gn43c,15
|
|
104
|
+
praetorian_cli-2.2.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|