Skip to content

Commit 9ee831b

Browse files
Merge branch 'development' into production
2 parents f40bbc2 + 84f6795 commit 9ee831b

File tree

64 files changed

+10958
-1741
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+10958
-1741
lines changed

‎.gitignore‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ scripts/mac_ansible_hosts.ini
2525
scripts/mac_ansible_id_rsa
2626
scripts/mac_ansible_id_rsa.pub
2727
.aider*
28+
29+
src/hackingBuddyGPT/usecases/web_api_testing/documentation/openapi_spec/
30+
src/hackingBuddyGPT/usecases/web_api_testing/documentation/reports/
31+
src/hackingBuddyGPT/usecases/web_api_testing/retrieve_spotify_token.py
32+
config/my_configs/*
33+
config/configs/*
34+
config/configs/

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ the use of LLMs for web penetration-testing and web api testing.
7676
| [linux-privesc](https://docs.hackingbuddy.ai/docs/usecases/linux-priv-esc) | Given a connection (SSH or local shell) for a low-privilege user, task the LLM to become the root user. This would be a typical Linux privilege escalation attack. We published two academic papers about this: [paper #1](https://arxiv.org/abs/2308.00121) and [paper #2](https://arxiv.org/abs/2310.11409) | ![Example wintermute run](https://docs.hackingbuddy.ai/run_archive/2024-04-06_linux.png) |
7777
| [web-pentest (WIP)](https://docs.hackingbuddy.ai/docs/usecases/web) | Directly hack a webpage. Currently in heavy development and pre-alpha stage. | ![Test Run for a simple Blog Page](https://docs.hackingbuddy.ai/run_archive/2024-05-03_web.png) |
7878
| [web-api-pentest (WIP)](https://docs.hackingbuddy.ai/docs/usecases/web-api) | Directly test a REST API. Currently in heavy development and pre-alpha stage. (Documentation and testing of REST API.) | Documentation:![web_api_documentation.png](https://docs.hackingbuddy.ai/run_archive/2024-05-15_web-api_documentation.png) Testing:![web_api_testing.png](https://docs.hackingbuddy.ai/run_archive/2024-05-15_web-api.png) |
79-
| [extended linux-privesc](https://docs.hackingbuddy.ai/docs/usecases/extended-linux-privesc) | This usecases extends linux-privesc with additional features such as retrieval augmented generation (RAG) or chain-of-thought (CoT) | ![Extended Linux Privilege Escalation Run](https://docs.hackingbuddy.ai/run_archive/2025-4-14_extended_privesc_usecase_1.png) ![Extended Linux Privilege Escalation Run](https://docs.hackingbuddy.ai/run_archive/2025-4-14_extended_privesc_usecase_1.png) |
79+
| [extended linux-privesc](https://docs.hackingbuddy.ai/docs/usecases/extended-linux-privesc) | This usecases extends linux-privesc with additional features such as retrieval augmented generation (RAG) or chain-of-thought (CoT) | ![Extended Linux Privilege Escalation Run](https://docs.hackingbuddy.ai/run_archive/2025-4-14_extended_privesc_usecase_1.png) ![Extended Linux Privilege Escalation Run](https://docs.hackingbuddy.ai/run_archive/2025-4-14_extended_privesc_usecase_2.png) |
80+
8081
## Build your own Agent/Usecase
8182

8283
So you want to create your own LLM hacking agent? We've got you covered and taken care of the tedious groundwork.

‎pyproject.toml‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ dependencies = [
4545
'uvicorn[standard] == 0.30.6',
4646
'dataclasses_json == 0.6.7',
4747
'websockets == 13.1',
48-
'langchain-community',
49-
'langchain-openai',
48+
'pandas',
49+
'faker',
50+
'fpdf',
51+
'langchain_core',
52+
'langchain_community',
53+
'langchain_chroma',
54+
'langchain_openai',
5055
'markdown',
5156
'chromadb',
52-
'langchain-chroma',
5357
]
5458

5559
[project.urls]
@@ -69,7 +73,7 @@ where = ["src"]
6973
pythonpath = "src"
7074
addopts = ["--import-mode=importlib"]
7175
[project.optional-dependencies]
72-
testing = ['pytest', 'pytest-mock']
76+
testing = ['pytest', 'pytest-mock', 'pandas', 'faker', 'langchain_core']
7377
dev = [
7478
'ruff',
7579
]

‎src/hackingBuddyGPT/capabilities/http_request.py‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,11 @@ def __call__(
4545
body_is_base64: Optional[bool] = False,
4646
headers: Optional[Dict[str, str]] = None,
4747
) -> str:
48+
4849
if body is not None and body_is_base64:
4950
body = base64.b64decode(body).decode()
50-
if self.host[-1] != "/":
51+
if self.host[-1] != "/" and not path.startswith("/"):
5152
path = "/" + path
52-
resp = self._client.request(
53-
method,
54-
self.host + path,
55-
params=query,
56-
data=body,
57-
headers=headers,
58-
allow_redirects=self.follow_redirects,
59-
)
6053
try:
6154
resp = self._client.request(
6255
method,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from dataclasses import dataclass, field
2+
from typing import Dict, Any, List, Tuple
3+
from hackingBuddyGPT.capabilities import Capability
4+
5+
6+
from dataclasses import dataclass, field
7+
from typing import Any, Dict, List, Tuple
8+
9+
@dataclass
10+
class ParsedInformation(Capability):
11+
status_code: str
12+
reason_phrase: Dict[str, Any] = field(default_factory=dict)
13+
headers: Dict[str, Any] = field(default_factory=dict)
14+
response_body: Dict[str, Any] = field(default_factory=dict)
15+
registry: List[Tuple[str, str, str, str]] = field(default_factory=list)
16+
17+
def describe(self) -> str:
18+
"""
19+
Returns a description of the test case.
20+
"""
21+
return f"Parsed information for {self.status_code}, reason_phrase: {self.reason_phrase}, headers: {self.headers}, response_body: {self.response_body} "
22+
def __call__(self, status_code: str, reason_phrase: str, headers: str, response_body:str) -> dict:
23+
self.registry.append((status_code, response_body, headers,response_body))
24+
25+
return {"status_code": status_code, "reason_phrase": reason_phrase, "headers": headers, "response_body": response_body}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
from hackingBuddyGPT.capabilities import Capability
3+
4+
5+
from dataclasses import dataclass, field
6+
from typing import Any, Dict, List, Tuple
7+
8+
@dataclass
9+
class PythonTestCase(Capability):
10+
description: str
11+
input: Dict[str, Any] = field(default_factory=dict)
12+
expected_output: Dict[str, Any] = field(default_factory=dict)
13+
registry: List[Tuple[str, dict, dict]] = field(default_factory=list)
14+
15+
def describe(self) -> str:
16+
"""
17+
Returns a description of the test case.
18+
"""
19+
return f"Test Case: {self.description}\nInput: {self.input}\nExpected Output: {self.expected_output}"
20+
def __call__(self, description: str, input: dict, expected_output: dict) -> dict:
21+
self.registry.append((description, input, expected_output))
22+
return {"description": description, "input": input, "expected_output": expected_output}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
from .simple_openapi_documentation import SimpleWebAPIDocumentation
22
from .simple_web_api_testing import SimpleWebAPITesting
3+
from . import response_processing
4+
from . import documentation
5+
from . import testing

0 commit comments

Comments
 (0)