mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-06-24 22:29:56 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1217eecdbd | |||
| 0a07fc54d6 | |||
| 2f1151d44d | |||
| d0353e3ab9 | |||
| 926c583a17 |
@@ -245,7 +245,20 @@ def load_jailbreak_v28k() -> ProbeDataset:
|
|||||||
return create_probe_dataset("JailbreakV-28K/JailBreakV-28k", [])
|
return create_probe_dataset("JailbreakV-28K/JailBreakV-28k", [])
|
||||||
|
|
||||||
|
|
||||||
@cache_to_disk()
|
@cache_to_disk(1)
|
||||||
|
def file_dataset(file) -> list[str]:
|
||||||
|
prompts = []
|
||||||
|
try:
|
||||||
|
df = pd.read_csv(os.path.join("./datasets", file), encoding_errors="ignore")
|
||||||
|
if "prompt" in df.columns:
|
||||||
|
prompts = df["prompt"].tolist()
|
||||||
|
else:
|
||||||
|
logger.warning(f"File {file} lacks a suitable prompt column")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error reading {file}: {e}")
|
||||||
|
return prompts
|
||||||
|
|
||||||
|
|
||||||
def load_local_csv() -> ProbeDataset:
|
def load_local_csv() -> ProbeDataset:
|
||||||
"""Load prompts from local CSV files."""
|
"""Load prompts from local CSV files."""
|
||||||
os.makedirs("./datasets", exist_ok=True)
|
os.makedirs("./datasets", exist_ok=True)
|
||||||
@@ -254,35 +267,16 @@ def load_local_csv() -> ProbeDataset:
|
|||||||
|
|
||||||
prompts = []
|
prompts = []
|
||||||
for file in csv_files:
|
for file in csv_files:
|
||||||
try:
|
prompts.extend(file_dataset(file))
|
||||||
df = pd.read_csv(os.path.join("./datasets", file), encoding_errors="ignore")
|
|
||||||
if "prompt" in df.columns:
|
|
||||||
prompts.extend(df["prompt"].tolist())
|
|
||||||
else:
|
|
||||||
logger.warning(f"File {file} lacks a suitable prompt column")
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Error reading {file}: {e}")
|
|
||||||
|
|
||||||
return create_probe_dataset("Local CSV", prompts, {"src": str(csv_files)})
|
return create_probe_dataset("Local CSV", prompts, {"src": str(csv_files)})
|
||||||
|
|
||||||
|
|
||||||
@cache_to_disk(1)
|
|
||||||
def load_csv(file: str) -> ProbeDataset:
|
def load_csv(file: str) -> ProbeDataset:
|
||||||
"""Load prompts from local CSV files."""
|
"""Load prompts from local CSV files."""
|
||||||
prompts = []
|
prompts = file_dataset(file)
|
||||||
try:
|
|
||||||
df = pd.read_csv(os.path.join("./datasets", file), encoding_errors="ignore")
|
|
||||||
prompts = df["prompt"].tolist()
|
|
||||||
if "prompt" in df.columns:
|
|
||||||
prompts.extend(df["prompt"].tolist())
|
|
||||||
else:
|
|
||||||
logger.warning(f"File {file} lacks a suitable prompt column")
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Error reading {file}: {e}")
|
|
||||||
return create_probe_dataset(f"fs://{file}", prompts, {"src": str(file)})
|
return create_probe_dataset(f"fs://{file}", prompts, {"src": str(file)})
|
||||||
|
|
||||||
|
|
||||||
@cache_to_disk(1)
|
|
||||||
def load_local_csv_files() -> list[ProbeDataset]:
|
def load_local_csv_files() -> list[ProbeDataset]:
|
||||||
"""Load prompts from local CSV files and return a list of ProbeDataset objects."""
|
"""Load prompts from local CSV files and return a list of ProbeDataset objects."""
|
||||||
csv_files = [f for f in os.listdir("./datasets") if f.endswith(".csv")]
|
csv_files = [f for f in os.listdir("./datasets") if f.endswith(".csv")]
|
||||||
@@ -291,16 +285,7 @@ def load_local_csv_files() -> list[ProbeDataset]:
|
|||||||
datasets = []
|
datasets = []
|
||||||
|
|
||||||
for file in csv_files:
|
for file in csv_files:
|
||||||
try:
|
datasets.append(create_probe_dataset(file, file_dataset(file), {"src": file}))
|
||||||
df = pd.read_csv(os.path.join("./datasets", file), encoding_errors="ignore")
|
|
||||||
if "prompt" in df.columns:
|
|
||||||
prompts = df["prompt"].tolist()
|
|
||||||
datasets.append(create_probe_dataset(file, prompts, {"src": file}))
|
|
||||||
else:
|
|
||||||
logger.warning(f"File {file} lacks a suitable prompt column")
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Error reading {file}: {e}")
|
|
||||||
|
|
||||||
return datasets
|
return datasets
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+36
-5
@@ -1,23 +1,54 @@
|
|||||||
# Getting Started
|
# Getting Started
|
||||||
|
|
||||||
Welcome to Agentic Security! This guide will help you get started with using the tool.
|
Welcome to Agentic Security! This guide will help you orient yourself within the project and start using the tool quickly.
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
Agentic Security is an open-source vulnerability scanner for Large Language Models (LLMs). It provides both a command line interface and a FastAPI server so you can probe models for weaknesses such as jailbreaks or refusal patterns. The tool supports multimodal attacks, multi-step scans and reinforcement-learning based probes.
|
||||||
|
|
||||||
|
## Repository Layout
|
||||||
|
|
||||||
|
```
|
||||||
|
agentic_security/
|
||||||
|
├── __main__.py - CLI entry point
|
||||||
|
├── app.py - FastAPI app assembly
|
||||||
|
├── lib.py - SecurityScanner and utilities
|
||||||
|
├── config.py - Configuration handling
|
||||||
|
├── core/ - app state and logging helpers
|
||||||
|
├── probe_actor/ - scanning logic and RL modules
|
||||||
|
├── probe_data/ - dataset registry and loaders
|
||||||
|
├── routes/ - API endpoints
|
||||||
|
└── ui/ - Web UI assets (Vue)
|
||||||
|
```
|
||||||
|
|
||||||
|
`tests/` contains unit tests, and `docs/` houses the project documentation.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
1. Ensure you have completed the [installation](installation.md) steps.
|
1. Ensure you have completed the [installation](installation.md) steps.
|
||||||
1. Run the following command to start the application:
|
2. Run the following command to start the application:
|
||||||
```bash
|
```bash
|
||||||
agentic_security
|
agentic_security
|
||||||
```
|
```
|
||||||
1. Access the application at `http://localhost:8718`.
|
The server will start on `http://localhost:8718`.
|
||||||
|
3. Explore available commands with:
|
||||||
|
```bash
|
||||||
|
agentic_security --help
|
||||||
|
```
|
||||||
|
|
||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
- To view available commands, use:
|
- To view available commands, run:
|
||||||
```bash
|
```bash
|
||||||
agentic_security --help
|
agentic_security --help
|
||||||
```
|
```
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
Explore the [Configuration](configuration.md) section to customize your setup.
|
- Review the [Quickstart Guide](quickstart.md) for a fast setup walkthrough.
|
||||||
|
- Check [http_spec.md](http_spec.md) to learn how LLM endpoints are described.
|
||||||
|
- Browse the `probe_actor` and `probe_data` modules to understand how scanning works and how datasets are loaded.
|
||||||
|
- Explore the [Configuration](configuration.md) section to customize your setup.
|
||||||
|
- Run the tests in `tests/` to verify your environment once dependencies are installed.
|
||||||
|
|
||||||
|
This guide should give you a solid foundation for exploring and extending Agentic Security. For more details, see the rest of the documentation.
|
||||||
|
|||||||
Generated
+208
-39
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "agentic_security"
|
name = "agentic_security"
|
||||||
version = "0.7.3"
|
version = "0.7.4"
|
||||||
description = "Agentic LLM vulnerability scanner"
|
description = "Agentic LLM vulnerability scanner"
|
||||||
authors = ["Alexander Miasoiedov <msoedov@gmail.com>"]
|
authors = ["Alexander Miasoiedov <msoedov@gmail.com>"]
|
||||||
maintainers = ["Alexander Miasoiedov <msoedov@gmail.com>"]
|
maintainers = ["Alexander Miasoiedov <msoedov@gmail.com>"]
|
||||||
|
|||||||
Reference in New Issue
Block a user