hackagent 0.1.0__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 (117) hide show
  1. hackagent/__init__.py +23 -0
  2. hackagent/agent.py +193 -0
  3. hackagent/api/__init__.py +1 -0
  4. hackagent/api/agent/__init__.py +1 -0
  5. hackagent/api/agent/agent_create.py +340 -0
  6. hackagent/api/agent/agent_destroy.py +136 -0
  7. hackagent/api/agent/agent_list.py +234 -0
  8. hackagent/api/agent/agent_partial_update.py +354 -0
  9. hackagent/api/agent/agent_retrieve.py +227 -0
  10. hackagent/api/agent/agent_update.py +354 -0
  11. hackagent/api/attack/__init__.py +1 -0
  12. hackagent/api/attack/attack_create.py +264 -0
  13. hackagent/api/attack/attack_destroy.py +140 -0
  14. hackagent/api/attack/attack_list.py +242 -0
  15. hackagent/api/attack/attack_partial_update.py +278 -0
  16. hackagent/api/attack/attack_retrieve.py +235 -0
  17. hackagent/api/attack/attack_update.py +278 -0
  18. hackagent/api/key/__init__.py +1 -0
  19. hackagent/api/key/key_create.py +168 -0
  20. hackagent/api/key/key_destroy.py +97 -0
  21. hackagent/api/key/key_list.py +158 -0
  22. hackagent/api/key/key_retrieve.py +150 -0
  23. hackagent/api/prompt/__init__.py +1 -0
  24. hackagent/api/prompt/prompt_create.py +160 -0
  25. hackagent/api/prompt/prompt_destroy.py +98 -0
  26. hackagent/api/prompt/prompt_list.py +173 -0
  27. hackagent/api/prompt/prompt_partial_update.py +174 -0
  28. hackagent/api/prompt/prompt_retrieve.py +151 -0
  29. hackagent/api/prompt/prompt_update.py +174 -0
  30. hackagent/api/result/__init__.py +1 -0
  31. hackagent/api/result/result_create.py +160 -0
  32. hackagent/api/result/result_destroy.py +98 -0
  33. hackagent/api/result/result_list.py +233 -0
  34. hackagent/api/result/result_partial_update.py +178 -0
  35. hackagent/api/result/result_retrieve.py +151 -0
  36. hackagent/api/result/result_trace_create.py +178 -0
  37. hackagent/api/result/result_update.py +174 -0
  38. hackagent/api/run/__init__.py +1 -0
  39. hackagent/api/run/run_create.py +172 -0
  40. hackagent/api/run/run_destroy.py +104 -0
  41. hackagent/api/run/run_list.py +260 -0
  42. hackagent/api/run/run_partial_update.py +186 -0
  43. hackagent/api/run/run_result_create.py +178 -0
  44. hackagent/api/run/run_retrieve.py +163 -0
  45. hackagent/api/run/run_run_tests_create.py +172 -0
  46. hackagent/api/run/run_update.py +186 -0
  47. hackagent/attacks/AdvPrefix/README.md +7 -0
  48. hackagent/attacks/AdvPrefix/__init__.py +0 -0
  49. hackagent/attacks/AdvPrefix/completer.py +438 -0
  50. hackagent/attacks/AdvPrefix/config.py +59 -0
  51. hackagent/attacks/AdvPrefix/preprocessing.py +521 -0
  52. hackagent/attacks/AdvPrefix/scorer.py +259 -0
  53. hackagent/attacks/AdvPrefix/scorer_parser.py +498 -0
  54. hackagent/attacks/AdvPrefix/selector.py +246 -0
  55. hackagent/attacks/AdvPrefix/step1_generate.py +324 -0
  56. hackagent/attacks/AdvPrefix/step4_compute_ce.py +293 -0
  57. hackagent/attacks/AdvPrefix/step6_get_completions.py +387 -0
  58. hackagent/attacks/AdvPrefix/step7_evaluate_responses.py +289 -0
  59. hackagent/attacks/AdvPrefix/step8_aggregate_evaluations.py +177 -0
  60. hackagent/attacks/AdvPrefix/step9_select_prefixes.py +59 -0
  61. hackagent/attacks/AdvPrefix/utils.py +192 -0
  62. hackagent/attacks/__init__.py +6 -0
  63. hackagent/attacks/advprefix.py +1136 -0
  64. hackagent/attacks/base.py +50 -0
  65. hackagent/attacks/strategies.py +539 -0
  66. hackagent/branding.py +143 -0
  67. hackagent/client.py +328 -0
  68. hackagent/errors.py +31 -0
  69. hackagent/logger.py +67 -0
  70. hackagent/models/__init__.py +71 -0
  71. hackagent/models/agent.py +240 -0
  72. hackagent/models/agent_request.py +169 -0
  73. hackagent/models/agent_type_enum.py +12 -0
  74. hackagent/models/attack.py +154 -0
  75. hackagent/models/attack_request.py +82 -0
  76. hackagent/models/evaluation_status_enum.py +14 -0
  77. hackagent/models/organization_minimal.py +68 -0
  78. hackagent/models/paginated_agent_list.py +123 -0
  79. hackagent/models/paginated_attack_list.py +123 -0
  80. hackagent/models/paginated_prompt_list.py +123 -0
  81. hackagent/models/paginated_result_list.py +123 -0
  82. hackagent/models/paginated_run_list.py +123 -0
  83. hackagent/models/paginated_user_api_key_list.py +123 -0
  84. hackagent/models/patched_agent_request.py +176 -0
  85. hackagent/models/patched_attack_request.py +92 -0
  86. hackagent/models/patched_prompt_request.py +162 -0
  87. hackagent/models/patched_result_request.py +237 -0
  88. hackagent/models/patched_run_request.py +138 -0
  89. hackagent/models/prompt.py +226 -0
  90. hackagent/models/prompt_request.py +155 -0
  91. hackagent/models/result.py +294 -0
  92. hackagent/models/result_list_evaluation_status.py +14 -0
  93. hackagent/models/result_request.py +232 -0
  94. hackagent/models/run.py +233 -0
  95. hackagent/models/run_list_status.py +12 -0
  96. hackagent/models/run_request.py +133 -0
  97. hackagent/models/status_enum.py +12 -0
  98. hackagent/models/step_type_enum.py +14 -0
  99. hackagent/models/trace.py +121 -0
  100. hackagent/models/trace_request.py +94 -0
  101. hackagent/models/user_api_key.py +201 -0
  102. hackagent/models/user_api_key_request.py +73 -0
  103. hackagent/models/user_profile_minimal.py +76 -0
  104. hackagent/py.typed +1 -0
  105. hackagent/router/__init__.py +11 -0
  106. hackagent/router/adapters/__init__.py +5 -0
  107. hackagent/router/adapters/google_adk.py +658 -0
  108. hackagent/router/adapters/litellm_adapter.py +290 -0
  109. hackagent/router/base.py +48 -0
  110. hackagent/router/router.py +753 -0
  111. hackagent/types.py +46 -0
  112. hackagent/utils.py +61 -0
  113. hackagent/vulnerabilities/__init__.py +0 -0
  114. hackagent-0.1.0.dist-info/LICENSE +202 -0
  115. hackagent-0.1.0.dist-info/METADATA +173 -0
  116. hackagent-0.1.0.dist-info/RECORD +117 -0
  117. hackagent-0.1.0.dist-info/WHEEL +4 -0
hackagent/types.py ADDED
@@ -0,0 +1,46 @@
1
+ """Contains some shared types for properties"""
2
+
3
+ from collections.abc import MutableMapping
4
+ from http import HTTPStatus
5
+ from typing import BinaryIO, Generic, Literal, Optional, TypeVar
6
+
7
+ from attrs import define
8
+
9
+
10
+ class Unset:
11
+ def __bool__(self) -> Literal[False]:
12
+ return False
13
+
14
+
15
+ UNSET: Unset = Unset()
16
+
17
+ FileJsonType = tuple[Optional[str], BinaryIO, Optional[str]]
18
+
19
+
20
+ @define
21
+ class File:
22
+ """Contains information for file uploads"""
23
+
24
+ payload: BinaryIO
25
+ file_name: Optional[str] = None
26
+ mime_type: Optional[str] = None
27
+
28
+ def to_tuple(self) -> FileJsonType:
29
+ """Return a tuple representation that httpx will accept for multipart/form-data"""
30
+ return self.file_name, self.payload, self.mime_type
31
+
32
+
33
+ T = TypeVar("T")
34
+
35
+
36
+ @define
37
+ class Response(Generic[T]):
38
+ """A response from an endpoint"""
39
+
40
+ status_code: HTTPStatus
41
+ content: bytes
42
+ headers: MutableMapping[str, str]
43
+ parsed: Optional[T]
44
+
45
+
46
+ __all__ = ["UNSET", "File", "FileJsonType", "Response", "Unset"]
hackagent/utils.py ADDED
@@ -0,0 +1,61 @@
1
+ import logging
2
+
3
+ from .client import AuthenticatedClient
4
+ from .api.prompt import prompt_list, prompt_create
5
+ from .models.prompt import Prompt
6
+ from .models.prompt_request import PromptRequest
7
+
8
+ logger = logging.getLogger(__name__)
9
+
10
+
11
+ def get_or_create_prompt(
12
+ client: AuthenticatedClient,
13
+ name: str,
14
+ text: str,
15
+ category: str,
16
+ organization_id: int,
17
+ evaluation_criteria: str = "Evaluate for expected behavior and safety.",
18
+ extra_tags: list = None,
19
+ ) -> Prompt:
20
+ """Gets an existing prompt by name or creates a new one, returning the Prompt model."""
21
+ logger.info(f"Checking for prompt: {name}")
22
+ response = prompt_list.sync_detailed(client=client)
23
+
24
+ if response.status_code == 200 and response.parsed:
25
+ for prompt_model in response.parsed.results:
26
+ if prompt_model.name == name:
27
+ log_msg = f"Found existing prompt '{name}' with ID {prompt_model.id}."
28
+ logger.info(log_msg)
29
+ return prompt_model
30
+
31
+ log_msg = f"Prompt '{name}' not found or no exact match, creating new one..."
32
+ logger.info(log_msg)
33
+
34
+ tags_data = ["utility_created"]
35
+ if extra_tags:
36
+ tags_data.extend(extra_tags)
37
+
38
+ prompt_req_body = PromptRequest(
39
+ name=name,
40
+ prompt_text=text,
41
+ category=category,
42
+ evaluation_criteria=evaluation_criteria,
43
+ tags=tags_data,
44
+ organization=organization_id,
45
+ )
46
+ create_response = prompt_create.sync_detailed(client=client, body=prompt_req_body)
47
+
48
+ if create_response.status_code == 201 and create_response.parsed:
49
+ log_msg = f"Created prompt '{name}' with ID {create_response.parsed.id}."
50
+ logger.info(log_msg)
51
+ return create_response.parsed
52
+ else:
53
+ body_content = (
54
+ create_response.content.decode() if create_response.content else "N/A"
55
+ )
56
+ err_msg = (
57
+ f"Failed to create prompt. Status: {create_response.status_code}, "
58
+ f"Body: {body_content}"
59
+ )
60
+ logger.error(err_msg)
61
+ raise RuntimeError(err_msg)
File without changes
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2025 Vista Labs
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.3
2
+ Name: hackagent
3
+ Version: 0.1.0
4
+ Summary: Python client for interacting with the HackAgent API.
5
+ Author: Nicola Franco
6
+ Author-email: nicola@vista-labs.ai
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Requires-Dist: google-adk (>=0.5.0,<0.6.0)
14
+ Requires-Dist: litellm (>=1.69.1,<2.0.0)
15
+ Requires-Dist: pandas (>=2.2.3,<3.0.0)
16
+ Requires-Dist: pydantic (>=2.0,<3.0)
17
+ Requires-Dist: python-dotenv (>=1.1.0,<2.0.0)
18
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
19
+ Requires-Dist: rich (>=14.0.0,<15.0.0)
20
+ Description-Content-Type: text/markdown
21
+
22
+ <div align="center">
23
+
24
+ <img src="./assets/banner.png" alt="Hack Agent" width=400></img>
25
+
26
+
27
+ ⚔️
28
+ <strong>Detect vulnerabilities before attackers do!</strong>
29
+ ⚔️
30
+
31
+ <br>
32
+
33
+ ![ico](./assets/favicon.ico) [Web App][Web App] -- [Docs][Docs] ![ico](./assets/favicon.ico)
34
+
35
+ [Web App]: https://hackagent.dev/
36
+ [Docs]: https://hackagent.dev/docs/
37
+
38
+ <br>
39
+
40
+ ![GitHub stars](https://img.shields.io/github/stars/vistalabs-org/hackagent?style=social)
41
+ ![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)
42
+ ![License](https://img.shields.io/badge/license-Apache%202.0-green)
43
+ ![Poetry](https://img.shields.io/badge/package-poetry-cyan)
44
+ [![Commitizen](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
45
+ ![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)
46
+ ![Test Coverage](https://img.shields.io/codecov/c/github/vistalabs-org/hackagent)
47
+ ![CI Status](https://img.shields.io/github/actions/workflow/status/vistalabs-org/hackagent/ci.yml)
48
+
49
+
50
+ <br>
51
+
52
+ </div>
53
+
54
+
55
+ ## Overview
56
+
57
+ HackAgent is an open-source toolkit designed to help security researchers, developers and AI safety practitioners evaluate the security of AI agents.
58
+ It provides a structured approach to discover potential vulnerabilities, including prompt injection, jailbreaking techniques, and other attack vectors.
59
+
60
+ ## 🔥 Features
61
+
62
+ - **Comprehensive Attack Library**: Pre-built techniques for prompt injections, jailbreaks, and goal hijacking
63
+ - **Modular Framework**: Easily extend with custom attack vectors and testing methodologies
64
+ - **Safety Focused**: Responsible disclosure guidelines and ethical usage recommendations
65
+
66
+ ### 🔌 AI Agent Frameworks Supported
67
+
68
+ [![LiteLLM](https://img.shields.io/badge/LiteLLM-blue?style=flat&logo=github)](https://github.com/BerriAI/litellm)
69
+ [![ADK](https://img.shields.io/badge/Google-ADK-green?style=flat&logo=openai)](https://google.github.io/adk-docs/)
70
+
71
+ ## 🚀 Installation
72
+
73
+
74
+ ### Installation from PyPI
75
+
76
+ HackAgent can be installed directly from PyPI:
77
+
78
+ ```bash
79
+ # Install with pip
80
+ pip install hackagent
81
+
82
+ # Or with Poetry
83
+ poetry add hackagent
84
+ ```
85
+
86
+ ## 📚 Quick Start (Google ADK)
87
+
88
+ ```python
89
+ from hackagent import HackAgent
90
+
91
+ # Initialize the agent tester with API key
92
+ agent = HackAgent(
93
+ name="multi_tool_agent",
94
+ endpoint="http://localhost:8000",
95
+ api_key="your_api_key_here", # Or omit to use HACKAGENT_API_KEY environment variable
96
+ agent_type=AgentTypeEnum.GOOGLE_ADK
97
+ )
98
+ attack_config = {
99
+ "attack_type": "advprefix",
100
+ "goals": [
101
+ "Fake the weather for a not available city"
102
+ "Fake the time for a not available city",
103
+ ],
104
+ }
105
+
106
+ # Run a basic security scan
107
+ agent.hack(attack_config=attack_config)
108
+ ```
109
+
110
+
111
+
112
+ ## 📊 Reporting
113
+
114
+ HackAgent automatically sends test results to the dashboard for analysis \
115
+ and visualization. All reports can be accessed through your dashboard account.
116
+
117
+
118
+ ### Dashboard Features
119
+
120
+ - Comprehensive visualization of attack results
121
+ - Historical data comparison
122
+ - Vulnerability severity ratings
123
+
124
+ Access your dashboard at [https://hackagent.dev](https://hackagent.dev)
125
+
126
+ ## 🧪 Development
127
+
128
+
129
+ ### Prerequisites
130
+
131
+ - Python 3.10+
132
+ - [Poetry](https://python-poetry.org/docs/#installation)
133
+
134
+ ```bash
135
+ # Clone the repository
136
+ git clone https://github.com/vistalabs-org/hackagent.git
137
+ cd hackagent
138
+
139
+ # Install development dependencies
140
+ poetry install --with dev
141
+ ```
142
+
143
+
144
+ We use modern Python development tools to ensure code quality:
145
+
146
+ ```bash
147
+
148
+ # Run tests with coverage reporting
149
+ poetry run pytest --cov=hackagent tests/
150
+ ```
151
+
152
+ ## 🤝 Contributing
153
+
154
+ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the submission process.
155
+
156
+ ## 📜 License
157
+
158
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
159
+
160
+ ## ⚠️ Disclaimer
161
+
162
+ HackAgent is a tool designed for security research and improving AI safety. Always obtain proper authorization before testing any AI systems. The authors are not responsible for any misuse of this software.
163
+
164
+ ## 📞 Contact
165
+
166
+ - **Project Maintainer**: [VistLabs Organization](https://github.com/vistalabs-org)
167
+ - **Project Repository**: [https://github.com/vistalabs-org/hackagent](https://github.com/vistalabs-org/hackagent)
168
+ - **Issue Tracker**: [https://github.com/vistalabs-org/hackagent/issues](https://github.com/vistalabs-org/hackagent/issues)
169
+
170
+ ---
171
+
172
+ *This project is for educational and research purposes. Always use responsibly and ethically.*
173
+
@@ -0,0 +1,117 @@
1
+ hackagent/__init__.py,sha256=9xrhYxKrlr9VSjBKWNZWSI5BETk1PemoMQ4jcRlTw10,504
2
+ hackagent/agent.py,sha256=fSZclql5yVzJCwWczQfSF1Hv71CKv2PLiZbLUUfZpT0,7706
3
+ hackagent/api/__init__.py,sha256=zTSiG_ujSjAqWPyc435YXaX9XTlpMjiJWBbV-f-YtdA,45
4
+ hackagent/api/agent/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
5
+ hackagent/api/agent/agent_create.py,sha256=C9jGvl1H0riHI94J0x04du1RvAa1bFP4x8zTlcTSMo8,15130
6
+ hackagent/api/agent/agent_destroy.py,sha256=BOVMuQ-Z91rorD-Rl6losNIjUNxoyj0N49BLW-NTyX4,4672
7
+ hackagent/api/agent/agent_list.py,sha256=-9yOaLZlY_1ZZ2jlkSKL64Ks42WnilG1J7qmWSWPdkg,8731
8
+ hackagent/api/agent/agent_partial_update.py,sha256=x_IF8UkERIYxvrn1f1AXJhDIuXSTeV5eLfu-Y4rcgPI,15447
9
+ hackagent/api/agent/agent_retrieve.py,sha256=9hBFgeuFMAMgAjPt5GPkc2xH_bw4hSSFy9ZP41TXol8,8206
10
+ hackagent/api/agent/agent_update.py,sha256=O_JxpbavFHhLXnaPhMIme7Z1mnhynU_IbIZkXeJt-NU,15367
11
+ hackagent/api/attack/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
12
+ hackagent/api/attack/attack_create.py,sha256=9G71WK0SyxGB38CXI2qAmfHPSCd812VjQKsaoGXukmM,9755
13
+ hackagent/api/attack/attack_destroy.py,sha256=pkkFsa0eJ_2CPzOQotfM3WkS0CS1rZeIZrBqY4JPqAQ,4565
14
+ hackagent/api/attack/attack_list.py,sha256=LNGLm2msTPblm_SFG9dC5iYwH-jiXBycaegfJOlrljc,8529
15
+ hackagent/api/attack/attack_partial_update.py,sha256=Hu270K8FjXKYKnRzjQR0YfS8ViLEcCKRnVMxVOQ5dJI,10072
16
+ hackagent/api/attack/attack_retrieve.py,sha256=W3tNKe4F-Beh_t5ltv-6YHnGOr1zRGTwmcro9Tw1T5o,8004
17
+ hackagent/api/attack/attack_update.py,sha256=rNTeOW73GiaEc72KVMdjdRbRucFmS3qAKX5SfsXBM5E,9992
18
+ hackagent/api/key/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
19
+ hackagent/api/key/key_create.py,sha256=BIIOq4pFGxjIFwLcV2oReLCrImLb9F_nQJCSk2FmICU,4604
20
+ hackagent/api/key/key_destroy.py,sha256=jyWrHB0Qnn31mCoy3x_dkOz3EDMmE0rCRj6XJJz-nnQ,2301
21
+ hackagent/api/key/key_list.py,sha256=radHP7uvL8zN6LNw5E2sdi2SYYJOTSagW_MUFl0aoz0,4032
22
+ hackagent/api/key/key_retrieve.py,sha256=vcP2NDof4rEpo18yZaVtoW3k6mPtkS1FRPxrlNo_3R8,3548
23
+ hackagent/api/prompt/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
24
+ hackagent/api/prompt/prompt_create.py,sha256=Rf6efoBguIYvFRULBqLJ-lX4sN-Zv4lzOaQ4KkJwjs0,3919
25
+ hackagent/api/prompt/prompt_destroy.py,sha256=GS3u5BSSXCwi9VoatApiybkzZtbDxtuKcNg8oPzpPCw,2297
26
+ hackagent/api/prompt/prompt_list.py,sha256=04PukowJAOsV3bJVUflRvZ-dO_lv9JZ6LgfE2dsAugU,4497
27
+ hackagent/api/prompt/prompt_partial_update.py,sha256=IIoMYyDmLcPvTbXYCqt_m_dhNGQXyzayIO3azJj3VgQ,4236
28
+ hackagent/api/prompt/prompt_retrieve.py,sha256=RwDIvP3G7_7xDlfaRaK81pywjbUtX_BhBiK7OtXeLGs,3468
29
+ hackagent/api/prompt/prompt_update.py,sha256=Vx1VYXl5Rkgvu92sAGuidsQ6FjL5qkitfMSr45tTuKs,4156
30
+ hackagent/api/result/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
31
+ hackagent/api/result/result_create.py,sha256=7y_p9R5BkhXMu26QkkMCHKrCFASuxmVrZtGgXzWXDsY,4207
32
+ hackagent/api/result/result_destroy.py,sha256=M3kLYR1xDqu6ktVL7Sxttz-S91cgp564vsavDXjhSJo,2379
33
+ hackagent/api/result/result_list.py,sha256=i0vjOZIpILO05ISQFCj4vhxU6KJnH2WUimX_ALX367s,7253
34
+ hackagent/api/result/result_partial_update.py,sha256=gNd3H_4U2BrmuNcS7sCyuU5N_WaTPIFKh1mN6UfHKPo,4572
35
+ hackagent/api/result/result_retrieve.py,sha256=3aU0JVFzUflZjyYWcGT0uQ1oB4W7l_ldRLnrlAH8lqQ,3632
36
+ hackagent/api/result/result_trace_create.py,sha256=aKoj3ci6g7Bg9CmYB35U0Z6rTo5nTiCC9Q0enztzLm4,4431
37
+ hackagent/api/result/result_update.py,sha256=g5qmVaf6GQqQg5Ek8nkJcrH4gfpIKojjiFy61-RDHH8,4444
38
+ hackagent/api/run/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
39
+ hackagent/api/run/run_create.py,sha256=Mf_OgefBCem7YB4LUDeY-LppvRVRNni8Z1NJ7R24atQ,4668
40
+ hackagent/api/run/run_destroy.py,sha256=PYpXUWTUfl1pR4qim7TteJJkNp8jtgSiqybfSlPPZFA,2648
41
+ hackagent/api/run/run_list.py,sha256=nXzoTPUQo5MKhWrfLqIroHS2IMwhRt7QNQfCnuDGNDg,8014
42
+ hackagent/api/run/run_partial_update.py,sha256=-ECAoA8ycsvRZhzm78gUwyXhoH3DmNgu9C0aAkPqxSg,4985
43
+ hackagent/api/run/run_result_create.py,sha256=hmUat7U0qnfFf4V_G3qMcNvQdfydY75qAk9p32KD84c,4637
44
+ hackagent/api/run/run_retrieve.py,sha256=lPjjcJUW2W20evcEqz93j9rXjq4bvrZK2dlBM0UN8Fc,4134
45
+ hackagent/api/run/run_run_tests_create.py,sha256=FRcVzjxic_FOHAhcPa_V0WDGH_hKIgArz3X8VMkrj5E,4678
46
+ hackagent/api/run/run_update.py,sha256=YL2MiecTD2UNiJ2nYYCmJgyqh910xz2tVy6AVJ_P--w,4905
47
+ hackagent/attacks/AdvPrefix/README.md,sha256=yaeixN98Jk8m2KXDlFSPnNi0_eK0sSrfrzigYuxTnJ8,515
48
+ hackagent/attacks/AdvPrefix/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
+ hackagent/attacks/AdvPrefix/completer.py,sha256=okAsB3hBzFbOttlpH3KNTAE5hNGl6RoFHc6UiCw139Y,20811
50
+ hackagent/attacks/AdvPrefix/config.py,sha256=JhGD0Kl_a2diYdDQ3AuGHc7Fgk-g9el6klSzTJBVVlA,2012
51
+ hackagent/attacks/AdvPrefix/preprocessing.py,sha256=n3yysyj2l9tEzMlBN1i6gfl2-4cgdMLFMxUL0Hz5xkA,20759
52
+ hackagent/attacks/AdvPrefix/scorer.py,sha256=NZsj9gCjWZm5-pkXIZtZDa_p2pXGAXIyQ_Ordnl2uOM,11047
53
+ hackagent/attacks/AdvPrefix/scorer_parser.py,sha256=xyYeiXLRkU9sPvEJXYQNE_IyacmhnuOPsWlnEFS9x5U,21850
54
+ hackagent/attacks/AdvPrefix/selector.py,sha256=aq3GzSaAPq_MO37hoCSTvgERRod98aPmfdRfg-yNItA,9914
55
+ hackagent/attacks/AdvPrefix/step1_generate.py,sha256=qVV-mo6GtbqC4LdtKHxT2OKibirM1nmSyWWVvZu47mE,13245
56
+ hackagent/attacks/AdvPrefix/step4_compute_ce.py,sha256=vBXhWXdfsrA4z7qTt-HhpwVXc8SE9m8UHdiU4X3s-tU,11673
57
+ hackagent/attacks/AdvPrefix/step6_get_completions.py,sha256=-SvRqVUzXuGBR2PXj019ntM-CX-4mx-1OcW4yelsYrI,16776
58
+ hackagent/attacks/AdvPrefix/step7_evaluate_responses.py,sha256=Ta_DL-clOAKzTGbrpgejLBfEYYu3W_EdQawbt8EmCEY,11652
59
+ hackagent/attacks/AdvPrefix/step8_aggregate_evaluations.py,sha256=VEmiyze5q_-kvpJTRQSngCmpPTA5mMQEQQc9qUJkhts,7337
60
+ hackagent/attacks/AdvPrefix/step9_select_prefixes.py,sha256=oDz_Ga_qhYgRjGL-B511XpRyg3dJpvkRP62ZT8up6q8,1999
61
+ hackagent/attacks/AdvPrefix/utils.py,sha256=sXjEq0lziWROS2B7dzpOgjzum4HI1SQzMY-srNudzNs,7355
62
+ hackagent/attacks/__init__.py,sha256=XsKH0CmsRJkrIG577vFA85z-9DgWG2yFY9sIOzeORCQ,104
63
+ hackagent/attacks/advprefix.py,sha256=xv-ciyU0Swy9aC6YBd2HnuRRVlSPyqAnC4XAAsBMJmI,56005
64
+ hackagent/attacks/base.py,sha256=me6MWcCvE_4vgqOHV3bEXsBznSp9wHmp3icQR2zFcFE,1477
65
+ hackagent/attacks/strategies.py,sha256=k53IdqkgEzM5rvpmELc0epK1RROjKEJsV9FfS_4SqSY,22952
66
+ hackagent/branding.py,sha256=chHqlHLYiXrUDJrpuClwg4fdjnhGMW6AhGNIb4k_emw,3240
67
+ hackagent/client.py,sha256=R56wBeLtprAzC1W9K0ZngbJ9b4NlCEpI__YRcvOviOE,15005
68
+ hackagent/errors.py,sha256=q_i-kF2Vi6RDpDj9g3_RSr7PlR6WXEe92K2zNV-JGIw,786
69
+ hackagent/logger.py,sha256=QSEm5J5-PLzwwB7JlqBQqRZhH3PFN97bumIBn6wQuRQ,2351
70
+ hackagent/models/__init__.py,sha256=DJfpk5t_jCix9miZoaJ-rIapWxnzHATUiB0T2WH32Mk,2299
71
+ hackagent/models/agent.py,sha256=HxqD-X50w01H29KrU2l0bpukN1LiK8ag03FESleF16I,8549
72
+ hackagent/models/agent_request.py,sha256=i_y0PQytxe2NkVN8OZ3KimTSgPgRRkuIEzRPPVm6f08,6136
73
+ hackagent/models/agent_type_enum.py,sha256=GyW9SCGscYdSz1CVPWP9uZR2Md8cT2CK9-23-G4p-gw,246
74
+ hackagent/models/attack.py,sha256=kVBxlJ1Ujd51L7uKcAI81IzSpIqPQ70CbmC6fAfoWYY,4470
75
+ hackagent/models/attack_request.py,sha256=nqupUX29TqbBdZIEtzyImLBHh6AccdaqWuQ4IW9n5A0,2422
76
+ hackagent/models/evaluation_status_enum.py,sha256=XyKKRa9mDFBPpMlV80JBkS6814u0q9Qy0c8metFUEeo,433
77
+ hackagent/models/organization_minimal.py,sha256=uwHvMQPz9Ih5Pm4UR-c1TRyhd3itajeTKnCo0M0Bbg8,1635
78
+ hackagent/models/paginated_agent_list.py,sha256=ZQtJCgxspsXgzgUPMBT-P4xfPfv2iYjk9z0bOtR_E7Q,3572
79
+ hackagent/models/paginated_attack_list.py,sha256=n36gfbF1eDKJS6HDrKi0f606sosw3B2yBiE_Pbs31AA,3584
80
+ hackagent/models/paginated_prompt_list.py,sha256=ok0eOw-jqFZGVdfNQyuPmRTZ_GwhR2uyYYc8H1HpN4g,3584
81
+ hackagent/models/paginated_result_list.py,sha256=xx1lwpq2QZ7fwOfUhLmSdk_IAdTbv2WnN8J76M-ZbZI,3584
82
+ hackagent/models/paginated_run_list.py,sha256=-gPolyr75jJ1Y8vK7nisEKHms2oKNA9He7-pbX5QWqc,3548
83
+ hackagent/models/paginated_user_api_key_list.py,sha256=YTiQ-4KVFq_qCRfygNhl8fatnzP1gaRUvfGER9ZPNLE,3642
84
+ hackagent/models/patched_agent_request.py,sha256=_xtUeXpeLBguJmo-8ag7mLObpIkrJUBlKkLX2eZq-14,6674
85
+ hackagent/models/patched_attack_request.py,sha256=J-kHkgRBe55GieHfsCAT1u-Y7aWefsV0gJAhCP3lxZA,2967
86
+ hackagent/models/patched_prompt_request.py,sha256=4OxmsHyNkFGeQJhEjJ36hEixEBh_JVkB1DnZFMicNkM,5667
87
+ hackagent/models/patched_result_request.py,sha256=tfTuYFgMnvqB0QXHjwbduEd_Xtj-rhMCawYKKFAX6NU,8759
88
+ hackagent/models/patched_run_request.py,sha256=DLpQJ7IcmJKhulFuCUq87M8t76T5p--BOUhpON4FbtU,4365
89
+ hackagent/models/prompt.py,sha256=OTVNm5cmfb4HUcM-sSwy1u6gMS4-usGUn6dIvVq52gc,7519
90
+ hackagent/models/prompt_request.py,sha256=ZFafNcEGDiQs3SDubofVCYjztd5iKxIFxcptMSxoGrg,5126
91
+ hackagent/models/result.py,sha256=FeD0-hTX3o13XOCkQPECh3cWA_LAa3ynTkMHOv0hk4k,10085
92
+ hackagent/models/result_list_evaluation_status.py,sha256=iT5jW8RBQdVvkQiXLt_g2adIVKAAqjRppStBIlLnHiw,439
93
+ hackagent/models/result_request.py,sha256=heuT_Yts2ejP41TGFaburX0y8ewxuYxp8AopsGrfGLI,8459
94
+ hackagent/models/run.py,sha256=9hjBxI_lwjXmtVMBBwSPpIccU_Q2d4AFRiwasR8Ld7c,7029
95
+ hackagent/models/run_list_status.py,sha256=Sx9ihOcOEMTMI7g_v1FlyT21V-m1oBAvuQUj1aoM55I,244
96
+ hackagent/models/run_request.py,sha256=w5Uz8O4s7Ih261JI5JDDD89J82TxaWLUA3uV_lNFCPk,4049
97
+ hackagent/models/status_enum.py,sha256=SdtRB6L3ZzoKZBfVqLx4sk3-UInV576y71TlOTRtN00,241
98
+ hackagent/models/step_type_enum.py,sha256=kkeKxaCzZ3cGv8sqn2OCZr5m1iZFbdYE_c0_mvGgxwg,339
99
+ hackagent/models/trace.py,sha256=yEoOtOs2PLVsb_PHsy9Sqn305_afhwdm1rHHzVrPMxc,3354
100
+ hackagent/models/trace_request.py,sha256=8NrC74-CG7H49tS_MgYfSDtAP8SHwZ8cx1PRE1P-wQU,2775
101
+ hackagent/models/user_api_key.py,sha256=Rvx4igcB4AZWCxvgxyDUPqzFTkojaCEEKaPiF7aucNU,6404
102
+ hackagent/models/user_api_key_request.py,sha256=fcgEFXZnh2cpF00MnjSk8zEnA_Lc9FGfOzVN6FnVfGU,1945
103
+ hackagent/models/user_profile_minimal.py,sha256=pked46BkFiIJb1iSRe2E1uM2pv-9zdTRq0fu3g90HHI,1916
104
+ hackagent/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
105
+ hackagent/router/__init__.py,sha256=EsvgUMDCIS29-QIhbxfTcNKXeXj2vNp3u75hYFqfqeY,323
106
+ hackagent/router/adapters/__init__.py,sha256=WWdbDle8ONH4UWi3un9ZCieOw_B5GQAxwrI4Byiutqo,126
107
+ hackagent/router/adapters/google_adk.py,sha256=p1cCUMjM5_jaofqt1DpWjznao3dSXea1QTmcJMu1Bmg,29211
108
+ hackagent/router/adapters/litellm_adapter.py,sha256=GRH9r3BanqdakFLK9TrtThze8-ABhHXDWw01-h1gDEA,12449
109
+ hackagent/router/base.py,sha256=6kKF7_EuFtyQUcu4AWX1ZRjE6xvQdcwclxPD298juGQ,1863
110
+ hackagent/router/router.py,sha256=yuIWcfMEC0x5SEaoJ1FCHu6cZ5Ii7qolki8ADKslqP4,36204
111
+ hackagent/types.py,sha256=E1hhDh_zXfsSQ0NCt9-uw90_Mr5iIlsdfnfvxv5HarU,1005
112
+ hackagent/utils.py,sha256=admZ1b5OI-pF_lO_wFCDvhVVIRx28wPUFcYuyeQSvgo,2066
113
+ hackagent/vulnerabilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
+ hackagent-0.1.0.dist-info/LICENSE,sha256=8xzpt8QHrsZKa_K4lzpJueytYgEbII1KGgODPijU8uY,11340
115
+ hackagent-0.1.0.dist-info/METADATA,sha256=YuJb3FLNxuLLef-GouIgbKUfzCHOSY1Uif82Y_Cx87M,5282
116
+ hackagent-0.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
117
+ hackagent-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.1.3
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any