hackagent 0.3.1__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.
Files changed (183) hide show
  1. hackagent/__init__.py +12 -0
  2. hackagent/agent.py +214 -0
  3. hackagent/api/__init__.py +1 -0
  4. hackagent/api/agent/__init__.py +1 -0
  5. hackagent/api/agent/agent_create.py +347 -0
  6. hackagent/api/agent/agent_destroy.py +140 -0
  7. hackagent/api/agent/agent_list.py +242 -0
  8. hackagent/api/agent/agent_partial_update.py +361 -0
  9. hackagent/api/agent/agent_retrieve.py +235 -0
  10. hackagent/api/agent/agent_update.py +361 -0
  11. hackagent/api/apilogs/__init__.py +1 -0
  12. hackagent/api/apilogs/apilogs_list.py +170 -0
  13. hackagent/api/apilogs/apilogs_retrieve.py +162 -0
  14. hackagent/api/attack/__init__.py +1 -0
  15. hackagent/api/attack/attack_create.py +275 -0
  16. hackagent/api/attack/attack_destroy.py +146 -0
  17. hackagent/api/attack/attack_list.py +254 -0
  18. hackagent/api/attack/attack_partial_update.py +289 -0
  19. hackagent/api/attack/attack_retrieve.py +247 -0
  20. hackagent/api/attack/attack_update.py +289 -0
  21. hackagent/api/checkout/__init__.py +1 -0
  22. hackagent/api/checkout/checkout_create.py +225 -0
  23. hackagent/api/generate/__init__.py +1 -0
  24. hackagent/api/generate/generate_create.py +253 -0
  25. hackagent/api/judge/__init__.py +1 -0
  26. hackagent/api/judge/judge_create.py +253 -0
  27. hackagent/api/key/__init__.py +1 -0
  28. hackagent/api/key/key_create.py +179 -0
  29. hackagent/api/key/key_destroy.py +103 -0
  30. hackagent/api/key/key_list.py +170 -0
  31. hackagent/api/key/key_retrieve.py +162 -0
  32. hackagent/api/organization/__init__.py +1 -0
  33. hackagent/api/organization/organization_create.py +208 -0
  34. hackagent/api/organization/organization_destroy.py +104 -0
  35. hackagent/api/organization/organization_list.py +170 -0
  36. hackagent/api/organization/organization_me_retrieve.py +126 -0
  37. hackagent/api/organization/organization_partial_update.py +222 -0
  38. hackagent/api/organization/organization_retrieve.py +163 -0
  39. hackagent/api/organization/organization_update.py +222 -0
  40. hackagent/api/prompt/__init__.py +1 -0
  41. hackagent/api/prompt/prompt_create.py +171 -0
  42. hackagent/api/prompt/prompt_destroy.py +104 -0
  43. hackagent/api/prompt/prompt_list.py +185 -0
  44. hackagent/api/prompt/prompt_partial_update.py +185 -0
  45. hackagent/api/prompt/prompt_retrieve.py +163 -0
  46. hackagent/api/prompt/prompt_update.py +185 -0
  47. hackagent/api/result/__init__.py +1 -0
  48. hackagent/api/result/result_create.py +175 -0
  49. hackagent/api/result/result_destroy.py +106 -0
  50. hackagent/api/result/result_list.py +249 -0
  51. hackagent/api/result/result_partial_update.py +193 -0
  52. hackagent/api/result/result_retrieve.py +167 -0
  53. hackagent/api/result/result_trace_create.py +177 -0
  54. hackagent/api/result/result_update.py +189 -0
  55. hackagent/api/run/__init__.py +1 -0
  56. hackagent/api/run/run_create.py +187 -0
  57. hackagent/api/run/run_destroy.py +112 -0
  58. hackagent/api/run/run_list.py +291 -0
  59. hackagent/api/run/run_partial_update.py +201 -0
  60. hackagent/api/run/run_result_create.py +177 -0
  61. hackagent/api/run/run_retrieve.py +179 -0
  62. hackagent/api/run/run_run_tests_create.py +187 -0
  63. hackagent/api/run/run_update.py +201 -0
  64. hackagent/api/user/__init__.py +1 -0
  65. hackagent/api/user/user_create.py +212 -0
  66. hackagent/api/user/user_destroy.py +106 -0
  67. hackagent/api/user/user_list.py +174 -0
  68. hackagent/api/user/user_me_retrieve.py +126 -0
  69. hackagent/api/user/user_me_update.py +196 -0
  70. hackagent/api/user/user_partial_update.py +226 -0
  71. hackagent/api/user/user_retrieve.py +167 -0
  72. hackagent/api/user/user_update.py +226 -0
  73. hackagent/attacks/AdvPrefix/__init__.py +41 -0
  74. hackagent/attacks/AdvPrefix/completions.py +416 -0
  75. hackagent/attacks/AdvPrefix/config.py +259 -0
  76. hackagent/attacks/AdvPrefix/evaluation.py +745 -0
  77. hackagent/attacks/AdvPrefix/evaluators.py +564 -0
  78. hackagent/attacks/AdvPrefix/generate.py +711 -0
  79. hackagent/attacks/AdvPrefix/utils.py +307 -0
  80. hackagent/attacks/__init__.py +35 -0
  81. hackagent/attacks/advprefix.py +507 -0
  82. hackagent/attacks/base.py +106 -0
  83. hackagent/attacks/strategies.py +906 -0
  84. hackagent/cli/__init__.py +19 -0
  85. hackagent/cli/commands/__init__.py +20 -0
  86. hackagent/cli/commands/agent.py +100 -0
  87. hackagent/cli/commands/attack.py +417 -0
  88. hackagent/cli/commands/config.py +301 -0
  89. hackagent/cli/commands/results.py +327 -0
  90. hackagent/cli/config.py +249 -0
  91. hackagent/cli/main.py +515 -0
  92. hackagent/cli/tui/__init__.py +31 -0
  93. hackagent/cli/tui/actions_logger.py +200 -0
  94. hackagent/cli/tui/app.py +288 -0
  95. hackagent/cli/tui/base.py +137 -0
  96. hackagent/cli/tui/logger.py +318 -0
  97. hackagent/cli/tui/views/__init__.py +33 -0
  98. hackagent/cli/tui/views/agents.py +488 -0
  99. hackagent/cli/tui/views/attacks.py +624 -0
  100. hackagent/cli/tui/views/config.py +244 -0
  101. hackagent/cli/tui/views/dashboard.py +307 -0
  102. hackagent/cli/tui/views/results.py +1210 -0
  103. hackagent/cli/tui/widgets/__init__.py +24 -0
  104. hackagent/cli/tui/widgets/actions.py +346 -0
  105. hackagent/cli/tui/widgets/logs.py +435 -0
  106. hackagent/cli/utils.py +276 -0
  107. hackagent/client.py +286 -0
  108. hackagent/errors.py +37 -0
  109. hackagent/logger.py +83 -0
  110. hackagent/models/__init__.py +109 -0
  111. hackagent/models/agent.py +223 -0
  112. hackagent/models/agent_request.py +129 -0
  113. hackagent/models/api_token_log.py +184 -0
  114. hackagent/models/attack.py +154 -0
  115. hackagent/models/attack_request.py +82 -0
  116. hackagent/models/checkout_session_request_request.py +76 -0
  117. hackagent/models/checkout_session_response.py +59 -0
  118. hackagent/models/choice.py +81 -0
  119. hackagent/models/choice_message.py +67 -0
  120. hackagent/models/evaluation_status_enum.py +14 -0
  121. hackagent/models/generate_error_response.py +59 -0
  122. hackagent/models/generate_request_request.py +212 -0
  123. hackagent/models/generate_success_response.py +115 -0
  124. hackagent/models/generic_error_response.py +70 -0
  125. hackagent/models/message_request.py +67 -0
  126. hackagent/models/organization.py +102 -0
  127. hackagent/models/organization_minimal.py +68 -0
  128. hackagent/models/organization_request.py +71 -0
  129. hackagent/models/paginated_agent_list.py +123 -0
  130. hackagent/models/paginated_api_token_log_list.py +123 -0
  131. hackagent/models/paginated_attack_list.py +123 -0
  132. hackagent/models/paginated_organization_list.py +123 -0
  133. hackagent/models/paginated_prompt_list.py +123 -0
  134. hackagent/models/paginated_result_list.py +123 -0
  135. hackagent/models/paginated_run_list.py +123 -0
  136. hackagent/models/paginated_user_api_key_list.py +123 -0
  137. hackagent/models/paginated_user_profile_list.py +123 -0
  138. hackagent/models/patched_agent_request.py +128 -0
  139. hackagent/models/patched_attack_request.py +92 -0
  140. hackagent/models/patched_organization_request.py +71 -0
  141. hackagent/models/patched_prompt_request.py +125 -0
  142. hackagent/models/patched_result_request.py +237 -0
  143. hackagent/models/patched_run_request.py +138 -0
  144. hackagent/models/patched_user_profile_request.py +99 -0
  145. hackagent/models/prompt.py +220 -0
  146. hackagent/models/prompt_request.py +126 -0
  147. hackagent/models/result.py +294 -0
  148. hackagent/models/result_list_evaluation_status.py +14 -0
  149. hackagent/models/result_request.py +232 -0
  150. hackagent/models/run.py +233 -0
  151. hackagent/models/run_list_status.py +12 -0
  152. hackagent/models/run_request.py +133 -0
  153. hackagent/models/status_enum.py +12 -0
  154. hackagent/models/step_type_enum.py +14 -0
  155. hackagent/models/trace.py +121 -0
  156. hackagent/models/trace_request.py +94 -0
  157. hackagent/models/usage.py +75 -0
  158. hackagent/models/user_api_key.py +201 -0
  159. hackagent/models/user_api_key_request.py +73 -0
  160. hackagent/models/user_profile.py +135 -0
  161. hackagent/models/user_profile_minimal.py +76 -0
  162. hackagent/models/user_profile_request.py +99 -0
  163. hackagent/router/__init__.py +25 -0
  164. hackagent/router/adapters/__init__.py +20 -0
  165. hackagent/router/adapters/base.py +63 -0
  166. hackagent/router/adapters/google_adk.py +671 -0
  167. hackagent/router/adapters/litellm_adapter.py +524 -0
  168. hackagent/router/adapters/openai_adapter.py +426 -0
  169. hackagent/router/router.py +969 -0
  170. hackagent/router/types.py +54 -0
  171. hackagent/tracking/__init__.py +42 -0
  172. hackagent/tracking/context.py +163 -0
  173. hackagent/tracking/decorators.py +299 -0
  174. hackagent/tracking/tracker.py +441 -0
  175. hackagent/types.py +54 -0
  176. hackagent/utils.py +194 -0
  177. hackagent/vulnerabilities/__init__.py +13 -0
  178. hackagent/vulnerabilities/prompts.py +81 -0
  179. hackagent-0.3.1.dist-info/METADATA +122 -0
  180. hackagent-0.3.1.dist-info/RECORD +183 -0
  181. hackagent-0.3.1.dist-info/WHEEL +4 -0
  182. hackagent-0.3.1.dist-info/entry_points.txt +2 -0
  183. hackagent-0.3.1.dist-info/licenses/LICENSE +202 -0
@@ -0,0 +1,289 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.attack import Attack
10
+ from ...models.patched_attack_request import PatchedAttackRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: UUID,
16
+ *,
17
+ body: PatchedAttackRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "patch",
23
+ "url": f"/attack/{id}",
24
+ }
25
+
26
+ _kwargs["json"] = body.to_dict()
27
+
28
+ headers["Content-Type"] = "application/json"
29
+
30
+ _kwargs["headers"] = headers
31
+ return _kwargs
32
+
33
+
34
+ def _parse_response(
35
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36
+ ) -> Optional[Attack]:
37
+ if response.status_code == 200:
38
+ response_200 = Attack.from_dict(response.json())
39
+
40
+ return response_200
41
+ if client.raise_on_unexpected_status:
42
+ raise errors.UnexpectedStatus(response.status_code, response.content)
43
+ else:
44
+ return None
45
+
46
+
47
+ def _build_response(
48
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
49
+ ) -> Response[Attack]:
50
+ return Response(
51
+ status_code=HTTPStatus(response.status_code),
52
+ content=response.content,
53
+ headers=response.headers,
54
+ parsed=_parse_response(client=client, response=response),
55
+ )
56
+
57
+
58
+ def sync_detailed(
59
+ id: UUID,
60
+ *,
61
+ client: AuthenticatedClient,
62
+ body: PatchedAttackRequest,
63
+ ) -> Response[Attack]:
64
+ """Manages Attack configurations through standard CRUD operations.
65
+
66
+ This ViewSet allows clients to:
67
+ - Create new Attack configurations.
68
+ - List existing Attack configurations (with filtering based on user/org).
69
+ - Retrieve details of a specific Attack configuration.
70
+ - Update an existing Attack configuration.
71
+ - Delete an Attack configuration.
72
+
73
+ The actual execution of an attack based on these configurations, and the
74
+ management of run statuses or results, are handled by other parts of the API
75
+ (e.g., potentially a RunViewSet or similar).
76
+
77
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
78
+ Auth0 authentication is supported as fallback for web dashboard use.
79
+
80
+ Attributes:
81
+ queryset: The base queryset, retrieving all Attack objects with related
82
+ entities (agent, owner, organization) pre-fetched.
83
+ serializer_class: The serializer (`AttackSerializer`) used for data
84
+ conversion for Attack configurations.
85
+ authentication_classes: API Key (primary) + Auth0 (fallback) authentication.
86
+ permission_classes: List of permission enforcement classes.
87
+ parser_classes: List of parsers for request data (JSONParser).
88
+ lookup_field: The model field used for looking up individual instances ('id').
89
+
90
+ Args:
91
+ id (UUID):
92
+ body (PatchedAttackRequest): Serializer for the Attack model, which represents an Attack
93
+ configuration.
94
+
95
+ Handles the conversion of Attack configuration instances to JSON (and vice-versa)
96
+ for API requests and responses. It includes read-only fields for related
97
+ object names (like agent_name, owner_username) for convenience in API outputs.
98
+
99
+ Raises:
100
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
101
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
102
+
103
+ Returns:
104
+ Response[Attack]
105
+ """
106
+
107
+ kwargs = _get_kwargs(
108
+ id=id,
109
+ body=body,
110
+ )
111
+
112
+ response = client.get_httpx_client().request(
113
+ **kwargs,
114
+ )
115
+
116
+ return _build_response(client=client, response=response)
117
+
118
+
119
+ def sync(
120
+ id: UUID,
121
+ *,
122
+ client: AuthenticatedClient,
123
+ body: PatchedAttackRequest,
124
+ ) -> Optional[Attack]:
125
+ """Manages Attack configurations through standard CRUD operations.
126
+
127
+ This ViewSet allows clients to:
128
+ - Create new Attack configurations.
129
+ - List existing Attack configurations (with filtering based on user/org).
130
+ - Retrieve details of a specific Attack configuration.
131
+ - Update an existing Attack configuration.
132
+ - Delete an Attack configuration.
133
+
134
+ The actual execution of an attack based on these configurations, and the
135
+ management of run statuses or results, are handled by other parts of the API
136
+ (e.g., potentially a RunViewSet or similar).
137
+
138
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
139
+ Auth0 authentication is supported as fallback for web dashboard use.
140
+
141
+ Attributes:
142
+ queryset: The base queryset, retrieving all Attack objects with related
143
+ entities (agent, owner, organization) pre-fetched.
144
+ serializer_class: The serializer (`AttackSerializer`) used for data
145
+ conversion for Attack configurations.
146
+ authentication_classes: API Key (primary) + Auth0 (fallback) authentication.
147
+ permission_classes: List of permission enforcement classes.
148
+ parser_classes: List of parsers for request data (JSONParser).
149
+ lookup_field: The model field used for looking up individual instances ('id').
150
+
151
+ Args:
152
+ id (UUID):
153
+ body (PatchedAttackRequest): Serializer for the Attack model, which represents an Attack
154
+ configuration.
155
+
156
+ Handles the conversion of Attack configuration instances to JSON (and vice-versa)
157
+ for API requests and responses. It includes read-only fields for related
158
+ object names (like agent_name, owner_username) for convenience in API outputs.
159
+
160
+ Raises:
161
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
162
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
163
+
164
+ Returns:
165
+ Attack
166
+ """
167
+
168
+ return sync_detailed(
169
+ id=id,
170
+ client=client,
171
+ body=body,
172
+ ).parsed
173
+
174
+
175
+ async def asyncio_detailed(
176
+ id: UUID,
177
+ *,
178
+ client: AuthenticatedClient,
179
+ body: PatchedAttackRequest,
180
+ ) -> Response[Attack]:
181
+ """Manages Attack configurations through standard CRUD operations.
182
+
183
+ This ViewSet allows clients to:
184
+ - Create new Attack configurations.
185
+ - List existing Attack configurations (with filtering based on user/org).
186
+ - Retrieve details of a specific Attack configuration.
187
+ - Update an existing Attack configuration.
188
+ - Delete an Attack configuration.
189
+
190
+ The actual execution of an attack based on these configurations, and the
191
+ management of run statuses or results, are handled by other parts of the API
192
+ (e.g., potentially a RunViewSet or similar).
193
+
194
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
195
+ Auth0 authentication is supported as fallback for web dashboard use.
196
+
197
+ Attributes:
198
+ queryset: The base queryset, retrieving all Attack objects with related
199
+ entities (agent, owner, organization) pre-fetched.
200
+ serializer_class: The serializer (`AttackSerializer`) used for data
201
+ conversion for Attack configurations.
202
+ authentication_classes: API Key (primary) + Auth0 (fallback) authentication.
203
+ permission_classes: List of permission enforcement classes.
204
+ parser_classes: List of parsers for request data (JSONParser).
205
+ lookup_field: The model field used for looking up individual instances ('id').
206
+
207
+ Args:
208
+ id (UUID):
209
+ body (PatchedAttackRequest): Serializer for the Attack model, which represents an Attack
210
+ configuration.
211
+
212
+ Handles the conversion of Attack configuration instances to JSON (and vice-versa)
213
+ for API requests and responses. It includes read-only fields for related
214
+ object names (like agent_name, owner_username) for convenience in API outputs.
215
+
216
+ Raises:
217
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
218
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
219
+
220
+ Returns:
221
+ Response[Attack]
222
+ """
223
+
224
+ kwargs = _get_kwargs(
225
+ id=id,
226
+ body=body,
227
+ )
228
+
229
+ response = await client.get_async_httpx_client().request(**kwargs)
230
+
231
+ return _build_response(client=client, response=response)
232
+
233
+
234
+ async def asyncio(
235
+ id: UUID,
236
+ *,
237
+ client: AuthenticatedClient,
238
+ body: PatchedAttackRequest,
239
+ ) -> Optional[Attack]:
240
+ """Manages Attack configurations through standard CRUD operations.
241
+
242
+ This ViewSet allows clients to:
243
+ - Create new Attack configurations.
244
+ - List existing Attack configurations (with filtering based on user/org).
245
+ - Retrieve details of a specific Attack configuration.
246
+ - Update an existing Attack configuration.
247
+ - Delete an Attack configuration.
248
+
249
+ The actual execution of an attack based on these configurations, and the
250
+ management of run statuses or results, are handled by other parts of the API
251
+ (e.g., potentially a RunViewSet or similar).
252
+
253
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
254
+ Auth0 authentication is supported as fallback for web dashboard use.
255
+
256
+ Attributes:
257
+ queryset: The base queryset, retrieving all Attack objects with related
258
+ entities (agent, owner, organization) pre-fetched.
259
+ serializer_class: The serializer (`AttackSerializer`) used for data
260
+ conversion for Attack configurations.
261
+ authentication_classes: API Key (primary) + Auth0 (fallback) authentication.
262
+ permission_classes: List of permission enforcement classes.
263
+ parser_classes: List of parsers for request data (JSONParser).
264
+ lookup_field: The model field used for looking up individual instances ('id').
265
+
266
+ Args:
267
+ id (UUID):
268
+ body (PatchedAttackRequest): Serializer for the Attack model, which represents an Attack
269
+ configuration.
270
+
271
+ Handles the conversion of Attack configuration instances to JSON (and vice-versa)
272
+ for API requests and responses. It includes read-only fields for related
273
+ object names (like agent_name, owner_username) for convenience in API outputs.
274
+
275
+ Raises:
276
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
277
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
278
+
279
+ Returns:
280
+ Attack
281
+ """
282
+
283
+ return (
284
+ await asyncio_detailed(
285
+ id=id,
286
+ client=client,
287
+ body=body,
288
+ )
289
+ ).parsed
@@ -0,0 +1,247 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.attack import Attack
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ id: UUID,
15
+ ) -> dict[str, Any]:
16
+ _kwargs: dict[str, Any] = {
17
+ "method": "get",
18
+ "url": f"/attack/{id}",
19
+ }
20
+
21
+ return _kwargs
22
+
23
+
24
+ def _parse_response(
25
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
26
+ ) -> Optional[Attack]:
27
+ if response.status_code == 200:
28
+ response_200 = Attack.from_dict(response.json())
29
+
30
+ return response_200
31
+ if client.raise_on_unexpected_status:
32
+ raise errors.UnexpectedStatus(response.status_code, response.content)
33
+ else:
34
+ return None
35
+
36
+
37
+ def _build_response(
38
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
39
+ ) -> Response[Attack]:
40
+ return Response(
41
+ status_code=HTTPStatus(response.status_code),
42
+ content=response.content,
43
+ headers=response.headers,
44
+ parsed=_parse_response(client=client, response=response),
45
+ )
46
+
47
+
48
+ def sync_detailed(
49
+ id: UUID,
50
+ *,
51
+ client: AuthenticatedClient,
52
+ ) -> Response[Attack]:
53
+ """Manages Attack configurations through standard CRUD operations.
54
+
55
+ This ViewSet allows clients to:
56
+ - Create new Attack configurations.
57
+ - List existing Attack configurations (with filtering based on user/org).
58
+ - Retrieve details of a specific Attack configuration.
59
+ - Update an existing Attack configuration.
60
+ - Delete an Attack configuration.
61
+
62
+ The actual execution of an attack based on these configurations, and the
63
+ management of run statuses or results, are handled by other parts of the API
64
+ (e.g., potentially a RunViewSet or similar).
65
+
66
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
67
+ Auth0 authentication is supported as fallback for web dashboard use.
68
+
69
+ Attributes:
70
+ queryset: The base queryset, retrieving all Attack objects with related
71
+ entities (agent, owner, organization) pre-fetched.
72
+ serializer_class: The serializer (`AttackSerializer`) used for data
73
+ conversion for Attack configurations.
74
+ authentication_classes: API Key (primary) + Auth0 (fallback) authentication.
75
+ permission_classes: List of permission enforcement classes.
76
+ parser_classes: List of parsers for request data (JSONParser).
77
+ lookup_field: The model field used for looking up individual instances ('id').
78
+
79
+ Args:
80
+ id (UUID):
81
+
82
+ Raises:
83
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
84
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
85
+
86
+ Returns:
87
+ Response[Attack]
88
+ """
89
+
90
+ kwargs = _get_kwargs(
91
+ id=id,
92
+ )
93
+
94
+ response = client.get_httpx_client().request(
95
+ **kwargs,
96
+ )
97
+
98
+ return _build_response(client=client, response=response)
99
+
100
+
101
+ def sync(
102
+ id: UUID,
103
+ *,
104
+ client: AuthenticatedClient,
105
+ ) -> Optional[Attack]:
106
+ """Manages Attack configurations through standard CRUD operations.
107
+
108
+ This ViewSet allows clients to:
109
+ - Create new Attack configurations.
110
+ - List existing Attack configurations (with filtering based on user/org).
111
+ - Retrieve details of a specific Attack configuration.
112
+ - Update an existing Attack configuration.
113
+ - Delete an Attack configuration.
114
+
115
+ The actual execution of an attack based on these configurations, and the
116
+ management of run statuses or results, are handled by other parts of the API
117
+ (e.g., potentially a RunViewSet or similar).
118
+
119
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
120
+ Auth0 authentication is supported as fallback for web dashboard use.
121
+
122
+ Attributes:
123
+ queryset: The base queryset, retrieving all Attack objects with related
124
+ entities (agent, owner, organization) pre-fetched.
125
+ serializer_class: The serializer (`AttackSerializer`) used for data
126
+ conversion for Attack configurations.
127
+ authentication_classes: API Key (primary) + Auth0 (fallback) authentication.
128
+ permission_classes: List of permission enforcement classes.
129
+ parser_classes: List of parsers for request data (JSONParser).
130
+ lookup_field: The model field used for looking up individual instances ('id').
131
+
132
+ Args:
133
+ id (UUID):
134
+
135
+ Raises:
136
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
137
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
138
+
139
+ Returns:
140
+ Attack
141
+ """
142
+
143
+ return sync_detailed(
144
+ id=id,
145
+ client=client,
146
+ ).parsed
147
+
148
+
149
+ async def asyncio_detailed(
150
+ id: UUID,
151
+ *,
152
+ client: AuthenticatedClient,
153
+ ) -> Response[Attack]:
154
+ """Manages Attack configurations through standard CRUD operations.
155
+
156
+ This ViewSet allows clients to:
157
+ - Create new Attack configurations.
158
+ - List existing Attack configurations (with filtering based on user/org).
159
+ - Retrieve details of a specific Attack configuration.
160
+ - Update an existing Attack configuration.
161
+ - Delete an Attack configuration.
162
+
163
+ The actual execution of an attack based on these configurations, and the
164
+ management of run statuses or results, are handled by other parts of the API
165
+ (e.g., potentially a RunViewSet or similar).
166
+
167
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
168
+ Auth0 authentication is supported as fallback for web dashboard use.
169
+
170
+ Attributes:
171
+ queryset: The base queryset, retrieving all Attack objects with related
172
+ entities (agent, owner, organization) pre-fetched.
173
+ serializer_class: The serializer (`AttackSerializer`) used for data
174
+ conversion for Attack configurations.
175
+ authentication_classes: API Key (primary) + Auth0 (fallback) authentication.
176
+ permission_classes: List of permission enforcement classes.
177
+ parser_classes: List of parsers for request data (JSONParser).
178
+ lookup_field: The model field used for looking up individual instances ('id').
179
+
180
+ Args:
181
+ id (UUID):
182
+
183
+ Raises:
184
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
185
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
186
+
187
+ Returns:
188
+ Response[Attack]
189
+ """
190
+
191
+ kwargs = _get_kwargs(
192
+ id=id,
193
+ )
194
+
195
+ response = await client.get_async_httpx_client().request(**kwargs)
196
+
197
+ return _build_response(client=client, response=response)
198
+
199
+
200
+ async def asyncio(
201
+ id: UUID,
202
+ *,
203
+ client: AuthenticatedClient,
204
+ ) -> Optional[Attack]:
205
+ """Manages Attack configurations through standard CRUD operations.
206
+
207
+ This ViewSet allows clients to:
208
+ - Create new Attack configurations.
209
+ - List existing Attack configurations (with filtering based on user/org).
210
+ - Retrieve details of a specific Attack configuration.
211
+ - Update an existing Attack configuration.
212
+ - Delete an Attack configuration.
213
+
214
+ The actual execution of an attack based on these configurations, and the
215
+ management of run statuses or results, are handled by other parts of the API
216
+ (e.g., potentially a RunViewSet or similar).
217
+
218
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
219
+ Auth0 authentication is supported as fallback for web dashboard use.
220
+
221
+ Attributes:
222
+ queryset: The base queryset, retrieving all Attack objects with related
223
+ entities (agent, owner, organization) pre-fetched.
224
+ serializer_class: The serializer (`AttackSerializer`) used for data
225
+ conversion for Attack configurations.
226
+ authentication_classes: API Key (primary) + Auth0 (fallback) authentication.
227
+ permission_classes: List of permission enforcement classes.
228
+ parser_classes: List of parsers for request data (JSONParser).
229
+ lookup_field: The model field used for looking up individual instances ('id').
230
+
231
+ Args:
232
+ id (UUID):
233
+
234
+ Raises:
235
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
236
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
237
+
238
+ Returns:
239
+ Attack
240
+ """
241
+
242
+ return (
243
+ await asyncio_detailed(
244
+ id=id,
245
+ client=client,
246
+ )
247
+ ).parsed