Update README.md
Browse files
README.md
CHANGED
|
@@ -1,92 +1,17 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
```
|
| 17 |
-
|
| 18 |
-
Allowed `category` values:
|
| 19 |
-
|
| 20 |
-
- `brute_force`
|
| 21 |
-
- `malware`
|
| 22 |
-
- `phishing`
|
| 23 |
-
- `dos_attack`
|
| 24 |
-
- `normal`
|
| 25 |
-
|
| 26 |
-
Allowed `severity` values:
|
| 27 |
-
|
| 28 |
-
- `low`
|
| 29 |
-
- `medium`
|
| 30 |
-
- `high`
|
| 31 |
-
|
| 32 |
-
`action` should be a short, concrete mitigation step.
|
| 33 |
-
|
| 34 |
-
## API endpoints
|
| 35 |
-
|
| 36 |
-
- `GET /reset` returns a random sample plus `instructions`, `allowed_categories`,
|
| 37 |
-
`allowed_severities`, `response_example`, and `agent_prompt`.
|
| 38 |
-
- `POST /step` accepts the agent JSON payload and returns the normalized reward.
|
| 39 |
-
- `GET /state` returns the current step count.
|
| 40 |
-
- `GET /tasks` describes the task tiers and output contract.
|
| 41 |
-
- `POST /grader` scores a `predicted` payload against an `expected` payload.
|
| 42 |
-
- `GET /baseline` runs one simple baseline action against a fresh sample.
|
| 43 |
-
|
| 44 |
-
## Local setup
|
| 45 |
-
|
| 46 |
-
```bash
|
| 47 |
-
python -m venv .venv
|
| 48 |
-
. .venv/Scripts/activate
|
| 49 |
-
pip install -r requirements.txt
|
| 50 |
-
uvicorn app:app --host 0.0.0.0 --port 7860
|
| 51 |
-
```
|
| 52 |
-
|
| 53 |
-
For PowerShell activation, use:
|
| 54 |
-
|
| 55 |
-
```powershell
|
| 56 |
-
.venv\Scripts\Activate.ps1
|
| 57 |
-
```
|
| 58 |
-
|
| 59 |
-
## Agent evaluation runner
|
| 60 |
-
|
| 61 |
-
`test_grader.py` is the local runner that calls a chat completions API, parses the
|
| 62 |
-
model output, grades it, and appends a record to `agent_eval_log.jsonl`.
|
| 63 |
-
|
| 64 |
-
Create a local `.env` file with:
|
| 65 |
-
|
| 66 |
-
```env
|
| 67 |
-
AGENT_API_KEY=your_api_key
|
| 68 |
-
AGENT_API_URL=https://api.openai.com/v1/chat/completions
|
| 69 |
-
```
|
| 70 |
-
|
| 71 |
-
Then run:
|
| 72 |
-
|
| 73 |
-
```bash
|
| 74 |
-
python test_grader.py
|
| 75 |
-
```
|
| 76 |
-
|
| 77 |
-
## Docker
|
| 78 |
-
|
| 79 |
-
Build and run the API container with:
|
| 80 |
-
|
| 81 |
-
```bash
|
| 82 |
-
docker build -t security-log-env .
|
| 83 |
-
docker run --rm -p 7860:7860 security-log-env
|
| 84 |
-
```
|
| 85 |
-
|
| 86 |
-
## Scoring
|
| 87 |
-
|
| 88 |
-
Scoring uses cosine similarity between vectorized predicted and expected responses.
|
| 89 |
-
The raw cosine value is mapped from `[-1, 1]` into the reward range `[0, 1]`:
|
| 90 |
-
|
| 91 |
-
- aligned vectors score `1`
|
| 92 |
-
- opposite vectors score `0`
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Security Log OpenEnv
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# π Security Log Analysis OpenEnv
|
| 11 |
+
|
| 12 |
+
This project implements a **production-ready OpenEnv environment** for cybersecurity log analysis.
|
| 13 |
+
|
| 14 |
+
An AI agent interacts with this environment using the standard:
|
| 15 |
+
|
| 16 |
+
```python
|
| 17 |
+
reset() β step(action) β state()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|