spidey121's picture
fix round 1
52b9084
|
Raw
History Blame Contribute Delete
4.5 kB
---
title: AI Deception OpenEnv
emoji: πŸ›‘οΈ
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
---
# πŸ›‘οΈ AI Cyber Deception OpenEnv
## Overview
AI Cyber Deception OpenEnv is a real-world cybersecurity simulation environment where an AI agent learns to detect, deceive, and mitigate cyber attacks.
This environment simulates production-like cybersecurity defense scenarios including brute force attacks, port scanning, SQL injection, directory traversal, and credential stuffing.
The environment follows the **OpenEnv specification** and supports:
- `reset()`
- `step()`
- `state()`
---
## 🎯 Real-World Task
Simulate cybersecurity defense in a production-like environment:
- Detect brute force attacks
- Detect port scanning
- Detect SQL injection
- Detect directory traversal
- Deploy deception mechanisms
- Block malicious attackers
---
## βš™οΈ Action Space
The AI agent can perform the following actions:
- `detect_attack`
- `deploy_honeypot`
- `fake_database`
- `block_ip`
---
## πŸ‘οΈ Observation Space
Environment returns structured observation:
- `failed_logins`
- `port_scans`
- `suspicious_ips`
- `total_requests`
- `attack_types`
---
## 🧠 Tasks
### Easy Task
Detect cyber attack
Goal:
- Detect suspicious activity
- Identify attack patterns
---
### Medium Task
Detect attack and deploy deception
Goal:
- Detect cyber attack
- Deploy honeypot or fake database
---
### Hard Task
Full cyber defense workflow
Goal:
- Detect attack
- Deploy deception
- Block attacker
---
## πŸ† Reward Function
| Action | Reward |
|--------|--------|
| detect_attack | 0.15–0.45 |
| deploy_honeypot | 0.30 |
| fake_database | 0.20 |
| block_ip (correct) | 0.70 |
| early block | 0.05 |
Reward range normalized between **0.0 – 1.0**
---
## 🌐 API Endpoints
Available endpoints:
- `/reset`
- `/step`
- `/state`
- `/logs`
- `/status`
Example:
POST /reset
POST /step
GET /state
---
## πŸš€ Run Locally
Install dependencies:
```bash
pip install -r requirements.txt
Run inference:
python inference.py
🐳 Docker
Build:
docker build -t ai-deception .
Run:
docker run -p 7860:7860 ai-deception
πŸ€— Hugging Face Deployment
Live Space:
https://bytecore1-ai-deception-openenv.hf.space/
Endpoints:
https://bytecore1-ai-deception-openenv.hf.space/reset
https://bytecore1-ai-deception-openenv.hf.space/state
https://bytecore1-ai-deception-openenv.hf.space/status
https://bytecore1-ai-deception-openenv.hf.space/logs
πŸ“Š Baseline Results
Example run:
[START] task=easy env=ai-deception-openenv model=Qwen
[STEP] step=1 action=detect_attack reward=0.45 done=false error=null
[STEP] step=2 action=deploy_honeypot reward=0.30 done=false error=null
[STEP] step=3 action=block_ip reward=0.70 done=true error=null
[END] success=true steps=3 score=0.48 rewards=0.45,0.30,0.70
πŸ—οΈ Architecture
Attacker
↓
Fake Server
↓
AI Agent (Inference)
↓
Defense Actions
↓
Reward
πŸ“¦ Project Structure
ai-deception-openenv/
β”‚
β”œβ”€β”€ env/
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ attacker.py
β”‚ β”œβ”€β”€ deception.py
β”‚ β”œβ”€β”€ env.py
β”‚ β”œβ”€β”€ fake_server.py
β”‚ β”œβ”€β”€ test_env.py
β”‚ └── test_server.py
β”‚
β”œβ”€β”€ tasks/
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚
β”‚ β”œβ”€β”€ easy/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ β”œβ”€β”€ task.py
β”‚ β”‚ └── grader.py
β”‚ β”‚
β”‚ β”œβ”€β”€ medium/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ β”œβ”€β”€ task.py
β”‚ β”‚ └── grader.py
β”‚ β”‚
β”‚ β”œβ”€β”€ hard/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ β”œβ”€β”€ task.py
β”‚ β”‚ └── grader.py
β”‚ β”‚
β”‚ └── test_tasks.py
β”‚
β”œβ”€β”€ server/
β”‚ └── app.py
β”‚
β”œβ”€β”€ inference.py
β”œβ”€β”€ app.py
β”œβ”€β”€ models.py
β”œβ”€β”€ openenv.yaml
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ uv.lock
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ .gitignore
└── .gitattributes
βœ… OpenEnv Compliance
reset() implemented
step() implemented
state() implemented
Docker support
Structured logs
Multiple tasks
Reward normalization
πŸ‘¨β€πŸ’» Use Case
This environment can be used for:
Cybersecurity research
Reinforcement learning
AI defense strategy training
Red team vs blue team simulations
πŸ›‘οΈ AI Cyber Deception
This project demonstrates how AI can:
Detect attackers
Deploy deception
Block malicious actors
Learn defensive strategies
License
MIT License