praetorian-cli 2.2.15__py3-none-any.whl → 2.2.17__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.
@@ -66,11 +66,9 @@ class Chariot:
66
66
 
67
67
  def chariot_request(self, method: str, url: str, headers: dict = {}, **kwargs) -> requests.Response:
68
68
  """
69
- Centralized wrapper around requests.request. Take care of proxy, beta flag, and
69
+ Centralized wrapper around requests.request. Takes care of proxy and
70
70
  supplies the authentication headers
71
71
  """
72
- self.add_beta_url_param(kwargs)
73
-
74
72
  if self.proxy:
75
73
  kwargs['proxies'] = {'http': self.proxy, 'https': self.proxy}
76
74
  kwargs['verify'] = False
@@ -78,12 +76,6 @@ class Chariot:
78
76
  return requests.request(method, url, headers=(headers | self.keychain.headers()), **kwargs)
79
77
 
80
78
 
81
- def add_beta_url_param(self, kwargs: dict):
82
- if 'params' in kwargs:
83
- kwargs['params']['beta'] = 'true'
84
- else:
85
- kwargs['params'] = {'beta': 'true'}
86
-
87
79
  def my(self, params: dict, pages=1) -> dict:
88
80
  final_resp = dict()
89
81
 
@@ -85,9 +85,9 @@ class Preseeds:
85
85
  """
86
86
  return self.api.search.by_exact_key(key, details)
87
87
 
88
- def update(self, key, status):
88
+ def update(self, key, status, comment=None):
89
89
  """Update the status of an existing preseed.
90
-
90
+
91
91
  Only the status field can be meaningfully updated for preseeds. This allows
92
92
  you to activate, freeze, or mark preseeds for deletion without recreating them.
93
93
  The preseed must exist before it can be updated.
@@ -101,24 +101,29 @@ class Preseeds:
101
101
  - 'FR' (FROZEN_REJECTED): Preseed is frozen and rejected
102
102
  - 'P' (PENDING): Preseed is pending activation
103
103
  :type status: str
104
+ :param comment: Optional comment to include with the update (stored in History field)
105
+ :type comment: str or None
104
106
  :return: The updated preseed object with new status
105
107
  :rtype: dict
106
108
  :raises: Prints error message if preseed with the specified key is not found
107
109
 
108
110
  **Example Usage:**
109
-
111
+
110
112
  .. code-block:: python
111
-
113
+
114
+ # Update status only
112
115
  sdk.preseeds.update(
113
116
  "#preseed#whois+company#Example Company#example company",
114
117
  "A"
115
118
  )
116
-
119
+
120
+ # Update status with comment
117
121
  sdk.preseeds.update(
118
122
  "#preseed#dns+subdomain#API Subdomain#api.example.com",
119
- "F"
123
+ "F",
124
+ comment="Temporarily frozen pending review"
120
125
  )
121
-
126
+
122
127
  sdk.preseeds.update(
123
128
  "#preseed#whois+company#Old Company#old company",
124
129
  "D"
@@ -130,7 +135,13 @@ class Preseeds:
130
135
  """
131
136
  preseed = self.api.search.by_exact_key(key)
132
137
  if preseed:
133
- return self.api.update('preseed', dict(key=key, status=status))
138
+ update_payload = {'key': key, 'status': status}
139
+
140
+ # Include comment if provided
141
+ if comment is not None:
142
+ update_payload['comment'] = comment
143
+
144
+ return self.api.update('preseed', update_payload)
134
145
  else:
135
146
  error(f'Pre-seed {key} is not found.')
136
147
 
@@ -201,4 +201,4 @@ def get_note_entry_indices(history):
201
201
 
202
202
 
203
203
  def is_note_entry(entry):
204
- return entry.get('comment') and entry.get('from') is None
204
+ return entry.get('comment') is not None
@@ -69,26 +69,46 @@ class Seeds:
69
69
  return None
70
70
  return results[0]
71
71
 
72
- def update(self, key, status=None):
72
+ def update(self, key, status=None, comment=None):
73
73
  """
74
74
  Update seed fields dynamically.
75
-
75
+
76
76
  :param key: Seed/Asset key (e.g., '#seed#domain#example.com' or '#asset#domain#example.com')
77
77
  :type key: str
78
78
  :param status: Status for backward compatibility (can be positional)
79
79
  :type status: str or None
80
+ :param comment: Optional comment to include with the update (stored in History field)
81
+ :type comment: str or None
80
82
  :param kwargs: Fields to update
81
83
  :return: The updated seed, or None if the seed was not found
82
84
  :rtype: dict or None
85
+
86
+ **Example Usage:**
87
+
88
+ .. code-block:: python
89
+
90
+ # Update status only
91
+ sdk.seeds.update("#asset#domain#example.com", "A")
92
+
93
+ # Update status with comment
94
+ sdk.seeds.update(
95
+ "#asset#domain#example.com",
96
+ "A",
97
+ comment="Activated after verification"
98
+ )
83
99
  """
84
-
100
+
85
101
  seed = self.get(key) # This already handles old key format conversion
86
102
  if seed:
87
103
  update_payload = {
88
104
  'key': key,
89
105
  'status': status
90
106
  }
91
-
107
+
108
+ # Include comment if provided
109
+ if comment is not None:
110
+ update_payload['comment'] = comment
111
+
92
112
  return self.api.upsert('seed', update_payload)
93
113
  else:
94
114
  error(f'Seed {key} not found.')
@@ -27,5 +27,15 @@ class TestPreseed:
27
27
  assert len(preseeds) > 0
28
28
  assert preseeds[0]['status'] == Preseed.FROZEN_REJECTED.value
29
29
 
30
+ def test_update_preseed_with_comment(self):
31
+ # Update preseed with comment parameter
32
+ self.sdk.preseeds.update(self.preseed_key, Preseed.ACTIVE.value, comment="Test comment for preseed update")
33
+ preseed = self.sdk.preseeds.get(self.preseed_key, details=True)
34
+ assert preseed['status'] == Preseed.ACTIVE.value
35
+ # Verify comment was stored in history
36
+ assert 'history' in preseed
37
+ assert len(preseed['history']) > 0
38
+ assert preseed['history'][0]['comment'] == "Test comment for preseed update"
39
+
30
40
  def teardown_class(self):
31
41
  clean_test_entities(self.sdk, self)
@@ -29,6 +29,16 @@ class TestSeed:
29
29
  self.sdk.seeds.update(self.seed_asset_key, Seed.ACTIVE.value)
30
30
  assert self.get_seed()['status'] == Seed.ACTIVE.value
31
31
 
32
+ def test_update_seed_with_comment(self):
33
+ # Update seed with comment parameter
34
+ self.sdk.seeds.update(self.seed_asset_key, Seed.FROZEN.value, comment="Test comment for seed update")
35
+ seed = self.get_seed()
36
+ assert seed['status'] == Seed.FROZEN.value
37
+ # Verify comment was stored in history
38
+ assert 'history' in seed
39
+ assert len(seed['history']) > 0
40
+ assert seed['history'][0]['comment'] == "Test comment for seed update"
41
+
32
42
  def test_delete_seed(self):
33
43
  self.sdk.seeds.delete(self.seed_asset_key)
34
44
  assert self.sdk.seeds.get(self.seed_asset_key)['status'] == Seed.DELETED.value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: praetorian-cli
3
- Version: 2.2.15
3
+ Version: 2.2.17
4
4
  Summary: For interacting with the Chariot API
5
5
  Home-page: https://github.com/praetorian-inc/praetorian-cli
6
6
  Author: Praetorian
@@ -25,7 +25,7 @@ praetorian_cli/scripts/utils.py,sha256=lGCf4trEpsfECa9U42pDJ-f48EimlS-hG6AjnKjNt
25
25
  praetorian_cli/scripts/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  praetorian_cli/scripts/commands/nmap-example.py,sha256=varKTkHKG4DAs9Ssf0c6SygP9GfuCG01aFxhfvixLM0,2727
27
27
  praetorian_cli/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- praetorian_cli/sdk/chariot.py,sha256=amMgs7FxX9DY0tWNoizg7XfrVYWyLixbqqcaBQsuAKg,14626
28
+ praetorian_cli/sdk/chariot.py,sha256=XRF0iWXw4ylGtlWouc6wr4g9oSR0KfzPfe8f5-3AdVY,14386
29
29
  praetorian_cli/sdk/keychain.py,sha256=KCz2mOTv09jgg6mrZQooRg1VrnvF9W0_BjRlEQhbzqU,7468
30
30
  praetorian_cli/sdk/mcp_server.py,sha256=8UoTotD4UVl-tp1gqMjkOVpO__KeGCvy7mIpKXVc8Rg,8750
31
31
  praetorian_cli/sdk/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -42,12 +42,12 @@ praetorian_cli/sdk/entities/files.py,sha256=Gw9Yt_Cm2xR-Vu8vjaekMHbGldhe930WJjje
42
42
  praetorian_cli/sdk/entities/integrations.py,sha256=NVaW_dWbnMkMIs-EYr2W7QAeamPVwLhmM2ppdMJmsK0,3176
43
43
  praetorian_cli/sdk/entities/jobs.py,sha256=k4QFw4qR5MdVyMAYstfnRIWr_ZH4q1PwDyUEGC-qBSM,8269
44
44
  praetorian_cli/sdk/entities/keys.py,sha256=PgoGa3xyLMzWrIIQ8zgi7bfZiUFFumPtMDo64GjhdjE,6089
45
- praetorian_cli/sdk/entities/preseeds.py,sha256=SeSY4K6diJMQzsjCBxYK3N9Lz0fUz3B_LMBOAAcBSLg,8890
46
- praetorian_cli/sdk/entities/risks.py,sha256=_MQlMo0y82DunwI04IjscZU2bNWyu8UM9YTazCGf_Jk,8291
45
+ praetorian_cli/sdk/entities/preseeds.py,sha256=C_FdoUnU5afwEgd7TWpeh4DMMXgEdlaIVTVJGqPGqO8,9298
46
+ praetorian_cli/sdk/entities/risks.py,sha256=D2A-Ikl91QeNiRrWwozLFD61uQ0LJ6oYeCW-8qy5iyo,8273
47
47
  praetorian_cli/sdk/entities/scanners.py,sha256=QCr5QlBy4jfBh8HRvZt9CoZTgNqLNnKNrI4sdfJf0jE,423
48
48
  praetorian_cli/sdk/entities/schema.py,sha256=CPVws1CdRHyOAI7oT9A20WGOCZozTFqZnfo5ox3v0HQ,807
49
49
  praetorian_cli/sdk/entities/search.py,sha256=9vTy9HZY2BTlqf5Zwpdl8HCRIfSEvWDRij2_-rAp2Ng,16938
50
- praetorian_cli/sdk/entities/seeds.py,sha256=eYDFtfgzIX_o9c5wuPiz9I2xDfTz7k9PZPzL7A7x1CM,5404
50
+ praetorian_cli/sdk/entities/seeds.py,sha256=4YMOOGDJHsSO4O7GMTm8p2nkTOdUTBxXr8V7y6e-Yjc,6010
51
51
  praetorian_cli/sdk/entities/settings.py,sha256=F-pRCA6UvbdtnjHOLpEG2lN9ws8dcnBNcep-DFlXeTY,2750
52
52
  praetorian_cli/sdk/entities/statistics.py,sha256=gtX-NN7r_RsNjDjlQ-zspmzG_0bzBqBFarCuM4NO-EA,7085
53
53
  praetorian_cli/sdk/entities/webhook.py,sha256=7Bqt20GlJFbZTlmQwYTuUadsUQvydym6S4kGn9zYa50,6220
@@ -72,10 +72,10 @@ praetorian_cli/sdk/test/test_file.py,sha256=ZpFBSKbfq9kzfQdy_tmwCH8rwYxW6GB4NlhT
72
72
  praetorian_cli/sdk/test/test_job.py,sha256=J7VqnVxRfvbpxNnYN9Rt3LvxmbNvSKwVqsSZxFEW1xc,1916
73
73
  praetorian_cli/sdk/test/test_key.py,sha256=yDrR0-JLwMB3eDx-tI-ss8GGbiJaJijE4dAK8-FUuzc,1425
74
74
  praetorian_cli/sdk/test/test_mcp.py,sha256=Ltg283j4Q12dcfCgUgDMKk6neRdDaThcndyywZl5XWs,938
75
- praetorian_cli/sdk/test/test_preseed.py,sha256=VhKSbSB6OmCYnVOrI6RDsYKBs1PekEuv0KOjbTt_k14,1186
75
+ praetorian_cli/sdk/test/test_preseed.py,sha256=ju82GVVcRguNcuGKxmCO6E5KoBXCdDHmPYs_2EEB8cA,1739
76
76
  praetorian_cli/sdk/test/test_risk.py,sha256=WuVTPxL9yj84nJx84oXVAlz0KshLxs8GG3tDeSe3QZU,3000
77
77
  praetorian_cli/sdk/test/test_search.py,sha256=SB9Tgo_N3CCpfvla898oLB9IZyGK9Dju1r9REK6Wmek,1996
78
- praetorian_cli/sdk/test/test_seed.py,sha256=WfnEPZwMXHFtt4jyVT-1JitIW1zTrl7rwlX8jXz22vY,1303
78
+ praetorian_cli/sdk/test/test_seed.py,sha256=nGyNsV5bKUGxm5AILY19zp-JNCw6q0IfmefRSLicgsQ,1785
79
79
  praetorian_cli/sdk/test/test_setting.py,sha256=hdPQj71rjSYxa-PODG2D-kJd8C9gkAg1jQXnqYU4P6A,1326
80
80
  praetorian_cli/sdk/test/test_webhook.py,sha256=FQJY76QQ6Yg2iLCGpxgKiXGI8TtmB4zTpMIM2SpYKCc,2228
81
81
  praetorian_cli/sdk/test/test_webpage.py,sha256=jgKrsobD3ONibDIbbOT-yy7V_NmC5-LwEZmEYdYu0LI,1779
@@ -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.15.dist-info/licenses/LICENSE,sha256=Zv97QripiVALv-WokW_Elsiz9vtOfbtNt1aLZhhk67I,1067
100
- praetorian_cli-2.2.15.dist-info/METADATA,sha256=tFrGUx-JASajeDC0bE5j-btCN4Lru3dM93aLyt7hrF0,7752
101
- praetorian_cli-2.2.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
102
- praetorian_cli-2.2.15.dist-info/entry_points.txt,sha256=uJbDvZdkYaLiCh2DMvXPUGKFm2p5ZfzJCizUK3-PUEE,56
103
- praetorian_cli-2.2.15.dist-info/top_level.txt,sha256=QbUdRPGEj_TyHO-E7AD5BxFfR8ore37i273jP4Gn43c,15
104
- praetorian_cli-2.2.15.dist-info/RECORD,,
99
+ praetorian_cli-2.2.17.dist-info/licenses/LICENSE,sha256=Zv97QripiVALv-WokW_Elsiz9vtOfbtNt1aLZhhk67I,1067
100
+ praetorian_cli-2.2.17.dist-info/METADATA,sha256=XOCMfdaoaMsfTLoXCNZCXwx0HBRju2Og-0mX1sm4q_Q,7752
101
+ praetorian_cli-2.2.17.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
102
+ praetorian_cli-2.2.17.dist-info/entry_points.txt,sha256=uJbDvZdkYaLiCh2DMvXPUGKFm2p5ZfzJCizUK3-PUEE,56
103
+ praetorian_cli-2.2.17.dist-info/top_level.txt,sha256=QbUdRPGEj_TyHO-E7AD5BxFfR8ore37i273jP4Gn43c,15
104
+ praetorian_cli-2.2.17.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5