File size: 4,501 Bytes
235c3c9
 
 
 
 
 
 
 
 
9110548
 
4431575
 
 
9110548
 
52b9084
9110548
 
4431575
9110548
 
 
4431575
0f55283
4431575
9110548
4431575
0f55283
4431575
0f55283
 
52b9084
 
0f55283
9110548
4431575
0f55283
4431575
9110548
0f55283
9110548
4431575
9110548
 
 
 
4431575
0f55283
4431575
9110548
4431575
9110548
4431575
9110548
 
 
52b9084
 
4431575
0f55283
4431575
9110548
4431575
0f55283
52b9084
 
 
 
 
 
 
 
4431575
0f55283
52b9084
 
 
 
 
 
 
 
0f55283
 
52b9084
 
 
 
 
 
 
0f55283
 
4431575
9110548
4431575
0f55283
 
52b9084
9110548
 
52b9084
 
9110548
 
4431575
0f55283
 
9110548
 
 
4431575
0f55283
 
 
 
 
 
9110548
 
 
 
 
 
 
 
0f55283
4431575
9110548
0f55283
9110548
0f55283
 
 
9110548
 
 
0f55283
9110548
 
 
 
0f55283
4431575
9110548
 
 
 
52b9084
9110548
 
0f55283
9110548
 
 
 
52b9084
0f55283
52b9084
0f55283
52b9084
0f55283
 
9110548
52b9084
9110548
 
52b9084
 
9110548
52b9084
 
9110548
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52b9084
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9110548
 
54a7970
52b9084
54a7970
52b9084
 
 
 
 
 
 
 
 
 
9110548
 
 
 
 
 
 
 
 
 
 
 
52b9084
9110548
 
 
 
 
 
 
52b9084
9110548
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
---
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