Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
856a402
Uploaded changes in branch
Jul 16, 2024
1d1d777
Merge remote-tracking branch 'refs/remotes/origin/development' into w…
DianaStrauss Sep 3, 2024
923d6ec
fixed shortening of prompt
DianaStrauss Sep 3, 2024
234e6ef
Merge remote-tracking branch 'refs/remotes/origin/development' into w…
DianaStrauss Sep 3, 2024
629489a
Merged development into web_api_testing
DianaStrauss Sep 3, 2024
64699e3
Fixed shorten prompt bug from merge
DianaStrauss Sep 3, 2024
c141954
Updated Tree of thought so that documentation works like chain of tho…
DianaStrauss Oct 8, 2024
3dc2c4b
Implemented in-context learning for documentation
DianaStrauss Oct 15, 2024
53e5c42
refined openapi generation
DianaStrauss Oct 16, 2024
ea8795b
Updated Tree of thought so that documentation works like chain of tho…
DianaStrauss Oct 16, 2024
4409f4b
Updated Tree of thought so that documentation works like chain of tho…
DianaStrauss Oct 16, 2024
8ef5f8b
Adjusted to only record valid information of rest api
DianaStrauss Oct 23, 2024
8eb5048
optimized prompt generation
DianaStrauss Oct 24, 2024
294ca7c
Added configs for documentation and testing
DianaStrauss Oct 25, 2024
98b510f
Added way of retrieving spotify token
DianaStrauss Oct 25, 2024
975ae85
Refactored code to work with spotify benchmark
DianaStrauss Nov 11, 2024
c70a23b
Refined test cases
DianaStrauss Nov 13, 2024
1fbb37b
Added new security endpoint for testing
DianaStrauss Nov 13, 2024
6fa891d
Added new security endpoint for testing
DianaStrauss Nov 13, 2024
86f8b06
Added more testing information for documentation testing and pentesting
DianaStrauss Nov 15, 2024
cee0726
Added evaluations
DianaStrauss Nov 16, 2024
e210104
Refactored code to be more understandable
DianaStrauss Nov 18, 2024
e228cd8
Added evaluation to documentation
DianaStrauss Nov 18, 2024
3b4b4c4
Refactored code
DianaStrauss Nov 19, 2024
2908860
Restructured testing
DianaStrauss Nov 20, 2024
b1f01dc
Refactored code
DianaStrauss Nov 22, 2024
22e64ff
Refactored code so that more endpoints are found
DianaStrauss Nov 25, 2024
b103831
Refactored code to be clearer
DianaStrauss Nov 28, 2024
e4bbdfa
Added owasp config file and owas openapi sepc
DianaStrauss Dec 2, 2024
f5ef612
Fixed some small bgs
DianaStrauss Dec 4, 2024
c6d33fe
Adjusted test cases to get better analysis
DianaStrauss Dec 4, 2024
96a400d
Added setup for automatic testing
DianaStrauss Dec 5, 2024
b0162fc
refactored test cases
DianaStrauss Dec 5, 2024
3e50596
refactored test cases
DianaStrauss Dec 6, 2024
9306dc6
refactored test cases
DianaStrauss Dec 6, 2024
0f8f445
Refactored tree of thought prompt
DianaStrauss Dec 8, 2024
b62bb01
adjusted gitignore
DianaStrauss Dec 11, 2024
dd0c17e
Refactored classification of endpoints
DianaStrauss Dec 11, 2024
1af2564
Adjusted test cases for better testing
DianaStrauss Dec 12, 2024
340280e
made continuous testing easier
DianaStrauss Dec 12, 2024
04ebcfa
Adjusted prompts to be more tailored
DianaStrauss Dec 15, 2024
1ff5fa2
Refactored and adjusted code to work also for crapi benchmark
DianaStrauss Dec 20, 2024
4dca56d
Cleaned up code
DianaStrauss Jan 9, 2025
5535eb0
Refactored test cases for better vulnerability coverage
DianaStrauss Jan 30, 2025
4ea54fc
Refactored code
DianaStrauss Feb 7, 2025
bf3395b
Added test case
DianaStrauss Feb 17, 2025
1aba1b7
adjusted report
Feb 19, 2025
b4e683b
Refactored code
DianaStrauss Mar 17, 2025
285ca9e
Anonymized readme
Mar 17, 2025
90f4028
Cleaned up code from prints and unnecessary code
DianaStrauss Mar 25, 2025
f9e09b5
Merge remote-tracking branch 'origin/web-api-testing' into web-api-te…
DianaStrauss Mar 25, 2025
b0c2b8b
Merge remote-tracking branch 'origin/development' into merge_web_api_…
DianaStrauss Apr 7, 2025
01ee69e
Adjusted code to work with web_api_testing
DianaStrauss Apr 7, 2025
32b73ab
Refactored code for better readability and testing
DianaStrauss Apr 13, 2025
303baf6
added configuration handler to better test
DianaStrauss Apr 13, 2025
4276f0f
Adjusted test of prompt engineer
DianaStrauss Apr 13, 2025
40f4ff1
Adjusted code for test
DianaStrauss Apr 13, 2025
c6b7ecd
Adjusted code and tests
Apr 14, 2025
44710f3
Adjusted tests and refactored code for better readability
Apr 14, 2025
a695971
Added test cases for pentesting information and test handler + refact…
DianaStrauss Apr 17, 2025
6f05e75
Removed unnecessary prints and added documentation
DianaStrauss Apr 22, 2025
ac58b5a
Removed unnecessary comments
DianaStrauss Apr 22, 2025
02c861f
Fixed Linter issue
DianaStrauss Apr 22, 2025
3a22053
Fixed test imports for pipeline
DianaStrauss Apr 22, 2025
0d34191
Added needed dependencies to pyproject.toml
DianaStrauss Apr 22, 2025
970b72d
Added needed dependencies to pyproject.toml
DianaStrauss Apr 22, 2025
4366132
Added needed dependencies to pyproject.toml
DianaStrauss Apr 22, 2025
9d16710
Removed test case that breaks pipeline
DianaStrauss Apr 22, 2025
9b78c6c
Adjusted init for test_handler
DianaStrauss Apr 22, 2025
9ea050b
Added needed dependencies to pyproject.toml
DianaStrauss Apr 22, 2025
424c989
Merge branch 'development' into merge_web_api_testing_development
DianaStrauss Apr 22, 2025
dbfef99
Added missing dependency
DianaStrauss Apr 22, 2025
696e395
Added missing dependency
DianaStrauss Apr 22, 2025
5e3b112
Added imports in __init__
DianaStrauss Apr 22, 2025
a6653ad
Added files
DianaStrauss Apr 22, 2025
ca17dd0
Moved config files to proper locatin
DianaStrauss Apr 22, 2025
5df1e20
updated README.md with correct image
Qsan1 May 1, 2025
a0977af
Merge pull request #120 from CoralStack/development
andreashappe May 1, 2025
e1b70ab
Merge branch 'development' into merge_web_api_testing_development
DianaStrauss May 13, 2025
78b681d
fixed syntax error in .toml
DianaStrauss May 13, 2025
8ae94fb
Fix linting
DianaStrauss May 13, 2025
9c4842f
Fix linting
DianaStrauss May 13, 2025
4d5122f
Fixed wrong import
DianaStrauss May 13, 2025
600ed43
Fixed import in testing
DianaStrauss May 13, 2025
f33c154
Fixed input variables
DianaStrauss May 13, 2025
e1c8cb4
Fixed input variables
DianaStrauss May 13, 2025
be0ff19
Fixed input variables
DianaStrauss May 13, 2025
985d740
Removed helper files
DianaStrauss May 14, 2025
19afc59
Fixed typo in parsed_information.py name
DianaStrauss May 14, 2025
b5f5688
Fixed typo in parsed_information.py name
DianaStrauss May 14, 2025
f748d5f
Update src/hackingBuddyGPT/usecases/web_api_testing/documentation/par…
DianaStrauss May 14, 2025
8d8a72c
Merge pull request #114 from ipa-lab/merge_web_api_testing_development
andreashappe May 14, 2025
290b148
moved prompt generation into utils and adjusted prompt engineer and p…
DianaStrauss May 20, 2025
bb2bd3b
Added prompt file and added logging of prompt
DianaStrauss May 23, 2025
fdf3d71
Added comments to icl
DianaStrauss May 23, 2025
aecb0be
fixed tests
DianaStrauss May 23, 2025
84f6795
Merge pull request #122 from ipa-lab/adapt_prompt_engineer
andreashappe May 23, 2025
f40bbc2
complete tmux local shell integration
ShreyasMahajann Aug 8, 2025
9ee831b
Merge branch 'development' into production
ShreyasMahajann Aug 8, 2025
bc22dff
Merge pull request #127 from ShreyasMahajann/production
andreashappe Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ scripts/mac_ansible_hosts.ini
scripts/mac_ansible_id_rsa
scripts/mac_ansible_id_rsa.pub
.aider*

src/hackingBuddyGPT/usecases/web_api_testing/documentation/openapi_spec/
src/hackingBuddyGPT/usecases/web_api_testing/documentation/reports/
src/hackingBuddyGPT/usecases/web_api_testing/retrieve_spotify_token.py
config/my_configs/*
config/configs/*
config/configs/
64 changes: 55 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

HackingBuddyGPT helps security researchers use LLMs to discover new attack vectors and save the world (or earn bug bounties) in 50 lines of code or less. In the long run, we hope to make the world a safer place by empowering security professionals to get more hacking done by using AI. The more testing they can do, the safer all of us will get.

**🆕 New Feature**: hackingBuddyGPT now supports both SSH connections to remote targets and local shell execution for easier testing and development!

**⚠️ WARNING**: This software will execute commands on live environments. When using local shell mode, commands will be executed on your local system, which could potentially lead to data loss, system modification, or security vulnerabilities. Always use appropriate precautions and consider using isolated environments or virtual machines for testing.


We aim to become **THE go-to framework for security researchers** and pen-testers interested in using LLMs or LLM-based autonomous agents for security testing. To aid their experiments, we also offer re-usable [linux priv-esc benchmarks](https://github.com/ipa-lab/benchmark-privesc-linux) and publish all our findings as open-access reports.

If you want to use hackingBuddyGPT and need help selecting the best LLM for your tasks, [we have a paper comparing multiple LLMs](https://arxiv.org/abs/2310.11409).
Expand Down Expand Up @@ -68,18 +73,19 @@ the use of LLMs for web penetration-testing and web api testing.
| Name | Description | Screenshot |
|------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [minimal](https://docs.hackingbuddy.ai/docs/dev-guide/dev-quickstart) | A minimal 50 LoC Linux Priv-Esc example. This is the usecase from [Build your own Agent/Usecase](#build-your-own-agentusecase) | ![A very minimal run](https://docs.hackingbuddy.ai/run_archive/2024-04-29_minimal.png) |
| [linux-privesc](https://docs.hackingbuddy.ai/docs/usecases/linux-priv-esc) | Given an SSH-connection 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) |
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |

## Build your own Agent/Usecase

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

Create a new usecase and implement `perform_round` containing all system/LLM interactions. We provide multiple helper and base classes so that a new experiment can be implemented in a few dozen lines of code. Tedious tasks, such as
connecting to the LLM, logging, etc. are taken care of by our framework. Check our [developer quickstart quide](https://docs.hackingbuddy.ai/docs/dev-guide/dev-quickstart) for more information.

The following would create a new (minimal) linux privilege-escalation agent. Through using our infrastructure, this already uses configurable LLM-connections (e.g., for testing OpenAI or locally run LLMs), logs trace data to a local sqlite database for each run, implements a round limit (after which the agent will stop if root has not been achieved until then) and can connect to a linux target over SSH for fully-autonomous command execution (as well as password guessing).
The following would create a new (minimal) linux privilege-escalation agent. Through using our infrastructure, this already uses configurable LLM-connections (e.g., for testing OpenAI or locally run LLMs), logs trace data to a local sqlite database for each run, implements a round limit (after which the agent will stop if root has not been achieved until then) and can connect to a target system either locally or over SSH for fully-autonomous command execution (as well as password guessing).

~~~ python
template_dir = pathlib.Path(__file__).parent
Expand Down Expand Up @@ -155,7 +161,9 @@ We try to keep our python dependencies as light as possible. This should allow f

1. an OpenAI API account, you can find the needed keys [in your account page](https://platform.openai.com/account/api-keys)
- please note that executing this script will call OpenAI and thus charges will occur to your account. Please keep track of those.
2. a potential target that is accessible over SSH. You can either use a deliberately vulnerable machine such as [Lin.Security.1](https://www.vulnhub.com/entry/) or a security benchmark such as our [linux priv-esc benchmark](https://github.com/ipa-lab/benchmark-privesc-linux).
2. a target environment to test against. You have two options:
- **Local Shell**: Use your local system (useful for testing and development)
- **SSH Target**: A remote machine accessible over SSH. You can use a deliberately vulnerable machine such as [Lin.Security.1](https://www.vulnhub.com/entry/) or a security benchmark such as our [linux priv-esc benchmark](https://github.com/ipa-lab/benchmark-privesc-linux).

To get everything up and running, clone the repo, download requirements, setup API keys and credentials, and start `wintermute.py`:

Expand Down Expand Up @@ -229,11 +237,45 @@ usage: src/hackingBuddyGPT/cli/wintermute.py LinuxPrivesc [--help] [--config con
--conn.port='2222' (default from .env file, alternatives: 22 from builtin)
```

### Provide a Target Machine over SSH
### Connection Options: Local Shell vs SSH

hackingBuddyGPT now supports two connection modes:

#### Local Shell Mode
Use your local system for testing and development. This is useful for quick experimentation without needing a separate target machine.

**Setup Steps:**
1. First, create a new tmux session with a specific name:
```bash
$ tmux new-session -s <session_name>
```

2. Once you have the tmux shell running, use hackingBuddyGPT to interact with it:
```bash
# Local shell with tmux session
$ python src/hackingBuddyGPT/cli/wintermute.py LinuxPrivesc --conn=local_shell --conn.tmux_session=<session_name>
```

**Example:**
```bash
# Step 1: Create tmux session named "hacking_session"
$ tmux new-session -s hacking_session

# Step 2: In another terminal, run hackingBuddyGPT
$ python src/hackingBuddyGPT/cli/wintermute.py LinuxPrivesc --conn=local_shell --conn.tmux_session=hacking_session
```

#### SSH Mode
Connect to a remote target machine over SSH. This is the traditional mode for testing against vulnerable VMs.

```bash
# SSH connection (note the updated format with --conn=ssh)
$ python src/hackingBuddyGPT/cli/wintermute.py LinuxPrivesc --conn=ssh --conn.host=192.168.122.151 --conn.username=lowpriv --conn.password=trustno1
```

The next important part is having a machine that we can run our agent against. In our case, the target machine will be situated at `192.168.122.151`.
When using SSH mode, the target machine should be situated at your specified IP address (e.g., `192.168.122.151` in the example above).

We are using vulnerable Linux systems running in Virtual Machines for this. Never run this against real systems.
We are using vulnerable Linux systems running in Virtual Machines for SSH testing. Never run this against real production systems.

> 💡 **We also provide vulnerable machines!**
>
Expand Down Expand Up @@ -277,9 +319,13 @@ Finally we can run hackingBuddyGPT against our provided test VM. Enjoy!
With that out of the way, let's look at an example hackingBuddyGPT run. Each run is structured in rounds. At the start of each round, hackingBuddyGPT asks a LLM for the next command to execute (e.g., `whoami`) for the first round. It then executes that command on the virtual machine, prints its output and starts a new round (in which it also includes the output of prior rounds) until it reaches step number 10 or becomes root:

```bash
# start wintermute, i.e., attack the configured virtual machine
$ python src/hackingBuddyGPT/cli/wintermute.py LinuxPrivesc --llm.api_key=sk...ChangeMeToYourOpenAiApiKey --llm.model=gpt-4-turbo --llm.context_size=8192 --conn.host=192.168.122.151 --conn.username=lowpriv --conn.password=trustno1 --conn.hostname=test1
# Example 1: Using local shell with tmux session
# First create the tmux session: tmux new-session -s hacking_session
# Then run hackingBuddyGPT:
$ python src/hackingBuddyGPT/cli/wintermute.py LinuxPrivesc --llm.api_key=sk...ChangeMeToYourOpenAiApiKey --llm.model=gpt-4-turbo --llm.context_size=8192 --conn=local_shell --conn.tmux_session=hacking_session

# Example 2: Using SSH connection (updated format)
$ python src/hackingBuddyGPT/cli/wintermute.py LinuxPrivesc --llm.api_key=sk...ChangeMeToYourOpenAiApiKey --llm.model=gpt-4-turbo --llm.context_size=8192 --conn=ssh --conn.host=192.168.122.151 --conn.username=lowpriv --conn.password=trustno1 --conn.hostname=test1

# install dependencies for testing if you want to run the tests
$ pip install '.[testing]'
Expand Down
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ dependencies = [
'uvicorn[standard] == 0.30.6',
'dataclasses_json == 0.6.7',
'websockets == 13.1',
'langchain-community',
'langchain-openai',
'pandas',
'faker',
'fpdf',
'langchain_core',
'langchain_community',
'langchain_chroma',
'langchain_openai',
'markdown',
'chromadb',
'langchain-chroma',
]

[project.urls]
Expand All @@ -69,7 +73,7 @@ where = ["src"]
pythonpath = "src"
addopts = ["--import-mode=importlib"]
[project.optional-dependencies]
testing = ['pytest', 'pytest-mock']
testing = ['pytest', 'pytest-mock', 'pandas', 'faker', 'langchain_core']
dev = [
'ruff',
]
Expand Down
11 changes: 2 additions & 9 deletions src/hackingBuddyGPT/capabilities/http_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,11 @@ def __call__(
body_is_base64: Optional[bool] = False,
headers: Optional[Dict[str, str]] = None,
) -> str:

if body is not None and body_is_base64:
body = base64.b64decode(body).decode()
if self.host[-1] != "/":
if self.host[-1] != "/" and not path.startswith("/"):
path = "/" + path
resp = self._client.request(
method,
self.host + path,
params=query,
data=body,
headers=headers,
allow_redirects=self.follow_redirects,
)
try:
resp = self._client.request(
method,
Expand Down
37 changes: 37 additions & 0 deletions src/hackingBuddyGPT/capabilities/local_shell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import re
from dataclasses import dataclass
from typing import Tuple

from hackingBuddyGPT.capabilities import Capability
from hackingBuddyGPT.utils.local_shell import LocalShellConnection


@dataclass
class LocalShellCapability(Capability):
conn: LocalShellConnection

def describe(self) -> str:
return "give a command to be executed and I will respond with the terminal output when running this command on the shell via tmux. The given command must not require user interaction. Do not use quotation marks in front and after your command."

def get_name(self):
return "local_exec"

def _got_root(self, output: str) -> bool:
"""Check if we got root access based on the command output."""
if not output.strip():
return False

lines = output.strip().split('\n')
last_line = lines[-1] if lines else ''

# Check for common root indicators
return (
"root" in output.lower() or
last_line.strip().endswith("#") or
"root@" in last_line or
last_line.strip() == "#"
)

def __call__(self, cmd: str) -> Tuple[str, bool]:
out, _, _ = self.conn.run(cmd) # This is CORRECT - use the commented version
return out, self._got_root(out)
25 changes: 25 additions & 0 deletions src/hackingBuddyGPT/capabilities/parsed_information.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from dataclasses import dataclass, field
from typing import Dict, Any, List, Tuple
from hackingBuddyGPT.capabilities import Capability


from dataclasses import dataclass, field
from typing import Any, Dict, List, Tuple

@dataclass
class ParsedInformation(Capability):
status_code: str
reason_phrase: Dict[str, Any] = field(default_factory=dict)
headers: Dict[str, Any] = field(default_factory=dict)
response_body: Dict[str, Any] = field(default_factory=dict)
registry: List[Tuple[str, str, str, str]] = field(default_factory=list)

def describe(self) -> str:
"""
Returns a description of the test case.
"""
return f"Parsed information for {self.status_code}, reason_phrase: {self.reason_phrase}, headers: {self.headers}, response_body: {self.response_body} "
def __call__(self, status_code: str, reason_phrase: str, headers: str, response_body:str) -> dict:
self.registry.append((status_code, response_body, headers,response_body))

return {"status_code": status_code, "reason_phrase": reason_phrase, "headers": headers, "response_body": response_body}
22 changes: 22 additions & 0 deletions src/hackingBuddyGPT/capabilities/python_test_case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

from hackingBuddyGPT.capabilities import Capability


from dataclasses import dataclass, field
from typing import Any, Dict, List, Tuple

@dataclass
class PythonTestCase(Capability):
description: str
input: Dict[str, Any] = field(default_factory=dict)
expected_output: Dict[str, Any] = field(default_factory=dict)
registry: List[Tuple[str, dict, dict]] = field(default_factory=list)

def describe(self) -> str:
"""
Returns a description of the test case.
"""
return f"Test Case: {self.description}\nInput: {self.input}\nExpected Output: {self.expected_output}"
def __call__(self, description: str, input: dict, expected_output: dict) -> dict:
self.registry.append((description, input, expected_output))
return {"description": description, "input": input, "expected_output": expected_output}
14 changes: 10 additions & 4 deletions src/hackingBuddyGPT/usecases/privesc/linux.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
from hackingBuddyGPT.capabilities import SSHRunCommand, SSHTestCredential
from hackingBuddyGPT.capabilities.local_shell import LocalShellCapability
from hackingBuddyGPT.usecases.base import AutonomousAgentUseCase, use_case
from hackingBuddyGPT.utils import SSHConnection

from hackingBuddyGPT.utils.local_shell import LocalShellConnection
from typing import Union
from .common import Privesc


class LinuxPrivesc(Privesc):
conn: SSHConnection = None
conn: Union[SSHConnection, LocalShellConnection] = None
system: str = "linux"

def init(self):
super().init()
self.add_capability(SSHRunCommand(conn=self.conn), default=True)
self.add_capability(SSHTestCredential(conn=self.conn))
if isinstance(self.conn, LocalShellConnection):
self.add_capability(LocalShellCapability(conn=self.conn), default=True)
self.add_capability(SSHTestCredential(conn=self.conn))
else:
self.add_capability(SSHRunCommand(conn=self.conn), default=True)
self.add_capability(SSHTestCredential(conn=self.conn))


@use_case("Linux Privilege Escalation")
Expand Down
3 changes: 3 additions & 0 deletions src/hackingBuddyGPT/usecases/web_api_testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
from .simple_openapi_documentation import SimpleWebAPIDocumentation
from .simple_web_api_testing import SimpleWebAPITesting
from . import response_processing
from . import documentation
from . import testing
Loading
Loading