Share
## https://sploitus.com/exploit?id=AB0ED908-D04D-5EC4-9051-75A6F88BBFC3
# 🎯 AI-POWERED AUTOMATED EXPLOIT GENERATION (AEG) SYSTEM
**Version 5.1-alpha.3 (Iteration 7 In Progress)**
Hệ thống penetration testing tự động với AI Agent Loop workflow. Trạng thái hiện tại đã hoàn thành:
- Iteration 1: Phase 0 Scoping
- Iteration 2: Phase 4 Vulnerability Validation
- Iteration 3: Parallel Layer 1 execution (optional)
- Iteration 4: Adaptive Exploit Retry
- Iteration 5: Enhanced Post-Exploitation
- Iteration 6: Reporting Enhancement
- Iteration 7: Polish & Testing (in progress)
---
## 📋 Quick Start
### Install dependencies
```bash
pip install -r requirements.txt
```
### Configure `.env`
```bash
CLAUDE_KEY=your_claude_api_key
CLAUDE_GATEWAY=http://localhost:3001
CLAUDE_MODEL=claude-sonnet-4-6
```
### Run interactive workflow
```bash
python3 main2.py
```
### Run Iteration 7 smoke tests
```bash
python3 test_phase7_smoke.py
```
### Run performance benchmark
```bash
python3 benchmark/run_benchmark.py
```
Results saved to `benchmark/run_YYYYMMDD_HHMMSS/timings.json` and `benchmark/latest.json`.
---
AI AEG hiện hoạt động theo workflow 7 phases:
1. **Phase 0 - Scoping & Threat Modeling**
2. **Phase 1 - Passive Reconnaissance**
3. **Phase 2 - Active Recon Layer 1**
4. **Phase 3 - Deep Scan Layer 2**
5. **Phase 4 - Vulnerability Validation**
6. **Phase 5 - Exploitation Planning**
7. **Phase 6 - Exploitation**
8. **Phase 7 - Post-Exploitation**
Trong iteration hiện tại, phần đã được hoàn thiện và kiểm thử kỹ nhất là luồng **Phase 0 → Phase 5**.
---
## Kiến trúc hiện tại
```text
main2.py
↓
AIAgentLoop
├─ Phase 0: Scoping
├─ Phase 1: Passive Recon
├─ Phase 2: Active Recon L1
├─ Phase 3: Deep Scan L2
├─ Phase 4: Validation
├─ Phase 5: Exploit Planning
├─ Phase 6: Exploitation
└─ Phase 7: Post-Exploitation
ClaudeOrchestrator
├─ analyze_attack_surface()
├─ analyze_target_and_suggest_recon_strategy()
├─ analyze_passive_recon_results()
├─ analyze_tech_stack_and_recommend_tools()
├─ generate_validation_tests()
├─ suggest_cross_verification()
└─ analyze_recon_for_exploits()
```
**Orchestrator = Think**
**Agent Loop = Execute workflow**
---
## Luồng dữ liệu hiện tại
### Phase 0 → Phase 1
Phase 0 hiện lưu:
- `session.data['scope']`
- `session.data['attack_surface']`
- `session.data['recon_results']['phase0_strategy']`
`phase0_strategy` được dùng lại ở Phase 1 và Phase 2, nên không còn bị đứt flow như trước.
### Phase 1 → Phase 2
Phase 1 lưu:
- `recon_data['passive']`
Phase 2 dùng:
- `phase0_strategy` để lấy tool recommendations
- `recon_data['passive']` để enrich context
### Phase 2 → Phase 3
Phase 2 hiện lưu vào [core/ai_agent_loop.py](core/ai_agent_loop.py):
- `recon_data['layer1']['findings']`
- `recon_data['layer1']['total']`
- `recon_data['layer1']['passive_results']`
- `recon_data['layer1']['tech_stack']`
Phase 3 đọc `layer1.tech_stack` để recommend deep scan tools.
### Phase 3 → Phase 4
Phase 3 merge findings thành:
- `recon_data['vulnerabilities']`
Phase 4 dùng danh sách này để validation.
### Phase 4 → Phase 5
Phase 4 tạo:
- `self.validated_vulns`
- `recon_data['validated_vulns']`
Phase 5 ưu tiên dùng `validated_vulns` để tạo exploit strategy.
---
## Phase 4 - Vulnerability Validation
Iteration 2 đã thêm validation pipeline với các khả năng chính:
- severity filtering: chỉ giữ `Critical`, `High`, `Medium`
- AI gợi ý cross-verification strategy
- AI tạo validation tests cho từng vulnerability
- chạy validation methods kiểu `curl_test`
- phát hiện false positive indicators
- lưu evidence cho từng vulnerability
- phân loại trạng thái:
- `validated`
- `false_positive`
- `pending_manual`
---
## Tech stack fingerprinting
Workflow hiện có heuristic fingerprinting tại [core/ai_agent_loop.py](core/ai_agent_loop.py) để suy ra:
- CMS
- framework
- language
- server
- database
Output đã được normalize để tránh duplicate casing, ví dụ:
- `Apache` thay vì `apache` + `Apache`
- `PHP` thay vì `php` + `PHP`
- `WordPress`, `MySQL`, `ASP.NET` theo canonical label
---
## Trạng thái hiện tại của project
### Đã hoàn thành
- Phase 0 Scoping
- Phase 4 Validation
- Data flow Phase 0 → Phase 5
- Mock workflow testing cho luồng hiện tại
- Dry-run direct phase invocation cho Phase 0 → Phase 5
### Bonus: Blue Team Analyst (Iteration 6 - Reporting Enhancement)
- Module: [core/analyst_engine2.py](core/analyst_engine2.py)
- Tạo bộ báo cáo chuyên nghiệp (Markdown + JSON):
- `solution/report_technical.md`
- `solution/report_executive.md`
- `solution/report_remediation.md`
- `solution/report_technical.json`
- `solution/report_executive.json`
- `solution/report_remediation.json`
- Ticketing exports:
- `solution/tickets_github_issues.json`
- `solution/tickets_jira.json`
- CVSS automation:
- ưu tiên CVSS/vector có sẵn,
- fallback AI-inferred vector,
- cuối cùng fallback theo severity mapping (có cờ `estimated`).
---
## Cài đặt
```bash
pip install -r requirements.txt
```
Cấu hình `.env`:
```bash
CLAUDE_KEY=your_claude_api_key
CLAUDE_GATEWAY=http://localhost:3001
CLAUDE_MODEL=claude-sonnet-4-6
```
---
## Chạy chương trình
```bash
python3 main2.py
```
---
## Cấu trúc project hiện tại
```text
AI_AEG_Project/
├── core/
│ ├── ai_agent_loop.py
│ ├── ai_orchestrator2.py
│ ├── analyst_engine2.py
│ ├── exploit_handle.py
│ ├── passive_recon.py
│ ├── payload_generator.py
│ ├── post_exploit.py
│ ├── recon_engine.py
│ ├── session_manager.py
│ └── schemas/
├── data/
├── gateway/
├── solution/
├── targets/
├── guide.md
├── main2.py
├── README.md
├── requirements.txt
└── updatePlan.md
```
---
## Tài liệu giữ lại
- [updatePlan.md](updatePlan.md) - roadmap phát triển
- [guide.md](guide.md) - tài liệu hướng dẫn nội bộ
---
## Lưu ý
Project hiện đang ở giai đoạn alpha, phù hợp cho:
- local lab
- research
- educational testing
- workflow validation
Chưa nên coi là production-ready cho môi trường thật.