Skip to content

Commit b150dfa

Browse files
committed
master
1 parent f5d043f commit b150dfa

29 files changed

Lines changed: 2439 additions & 89 deletions

README.md

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ ghidrainsight analyze --file binary.elf --ai-powered
4444
- **Symbol Recovery**: Function name inference and type reconstruction
4545

4646
### 🤖 AI-Powered Analysis
47-
- **LLM Integration**: Function name generation, automatic comments, vulnerability explanations
48-
- **ChatGPT/Claude Integration**: Ask natural language questions about binaries
47+
- **Multi-LLM Support**: Claude, GPT-4, Gemini, and more - choose the best model for your needs
48+
- **Context Optimization**: Automatic context truncation for cheaper inference costs
49+
- **Function Name Generation**: AI-powered function name generation from disassembly/pseudocode
50+
- **Automatic Comments**: Intelligent comment generation for better code understanding
51+
- **Vulnerability Explanations**: Natural language explanations of detected vulnerabilities
4952
- **Automated Vulnerability Scanning**: CVSS scores with AI-powered remediation
5053
- **Pattern Recognition**: ML-based anomaly and weakness detection
5154
- **Intelligent Code Summarization**: Automatic function and module descriptions
@@ -54,7 +57,7 @@ ghidrainsight analyze --file binary.elf --ai-powered
5457
- **Web Dashboard**: Intuitive React UI with real-time analysis
5558
- **Python SDK**: Programmatic access with async support
5659
- **CLI Tools**: Command-line interface for automation
57-
- **MCP Protocol**: Seamless LLM integration (Claude, ChatGPT)
60+
- **MCP Protocol**: Seamless LLM integration (Claude, GPT-4, Gemini, and more)
5861
- **REST API**: RESTful endpoints for custom integrations
5962
- **🦙 Local AI**: Ollama and other local models support (NEW)
6063

@@ -331,27 +334,45 @@ ghidrainsight config list
331334

332335
---
333336

334-
### 4. LLM Integration (ChatGPT / Claude)
337+
### 4. LLM Integration (Multi-Provider Support)
335338

336339
**Perfect for**: AI assistants, automated security reviews
337340

338-
#### With Claude Desktop
341+
GhidraInsight supports multiple LLM providers with automatic context optimization:
342+
343+
#### Claude (Anthropic)
339344
```bash
340-
# Configure Claude to use GhidraInsight
341-
ghidrainsight integrate --provider claude --api-key $ANTHROPIC_API_KEY
345+
# Setup Claude integration
346+
export ANTHROPIC_API_KEY=your-key-here
347+
ghidrainsight integrate --provider anthropic --api-key $ANTHROPIC_API_KEY
342348

343-
# Binary analysis now available in Claude Desktop
349+
# Use Claude for analysis
350+
ghidrainsight analyze --file binary.elf --ai-provider anthropic --ai-model claude-3-haiku
344351
```
345352

346-
#### With ChatGPT / OpenAI
353+
#### OpenAI (GPT-4, GPT-3.5)
347354
```bash
348355
# Setup OpenAI integration
356+
export OPENAI_API_KEY=your-key-here
349357
ghidrainsight integrate --provider openai --api-key $OPENAI_API_KEY
350358

351-
# Now you can upload binaries in ChatGPT for analysis
359+
# Use GPT-4 for analysis
360+
ghidrainsight analyze --file binary.elf --ai-provider openai --ai-model gpt-4
361+
```
362+
363+
#### Google Gemini
364+
```bash
365+
# Setup Google Gemini integration
366+
export GOOGLE_API_KEY=your-key-here
367+
ghidrainsight integrate --provider google --api-key $GOOGLE_API_KEY
368+
369+
# Use Gemini for analysis
370+
ghidrainsight analyze --file binary.elf --ai-provider google --ai-model gemini-pro
352371
```
353372

354-
See [examples/CLAUDE_INTEGRATION.md](examples/CLAUDE_INTEGRATION.md) and [examples/OPENAI_INTEGRATION.md](examples/OPENAI_INTEGRATION.md) for detailed setup.
373+
**Context Optimization**: Automatically enabled to reduce token usage and costs. Long contexts are intelligently truncated while preserving key information.
374+
375+
See [examples/CLAUDE_INTEGRATION.md](examples/CLAUDE_INTEGRATION.md), [examples/OPENAI_INTEGRATION.md](examples/OPENAI_INTEGRATION.md), and [docs/AI_INTEGRATIONS.md](docs/AI_INTEGRATIONS.md) for detailed setup.
355376

356377
---
357378

@@ -612,6 +633,10 @@ npm install && npm start
612633
- ✅ Web dashboard
613634
- ✅ MCP integration
614635
- ✅ Docker support
636+
- ✅ Multi-LLM support (Claude, GPT-4, Gemini)
637+
- ✅ Context optimization for cost reduction
638+
- ✅ Function name generation from IL
639+
- ✅ Automatic comment generation
615640

616641
### v1.1 (Q1 2026)
617642
- 🔄 Advanced ML models for pattern detection
@@ -661,7 +686,7 @@ If GhidraInsight is helpful, please:
661686
| API Endpoints | 20+ |
662687
| Test Coverage | 80%+ |
663688
| Supported Formats | ELF, PE, Mach-O |
664-
| LLM Integrations | Claude, ChatGPT, OpenAI |
689+
| LLM Integrations | Claude, GPT-4, Gemini, OpenAI (with context optimization) |
665690

666691
---
667692

docs/BACKUP_AND_RECOVERY.md

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
# Backup and Disaster Recovery
2+
3+
Comprehensive backup and recovery procedures for GhidraInsight.
4+
5+
## Overview
6+
7+
GhidraInsight backup strategy includes:
8+
- Database backups (PostgreSQL)
9+
- Configuration backups
10+
- Binary analysis cache backups
11+
- Disaster recovery procedures
12+
13+
## Database Backup
14+
15+
### Automated Backups
16+
17+
#### PostgreSQL (Docker)
18+
19+
```bash
20+
# Create backup script
21+
cat > scripts/backup-db.sh << 'EOF'
22+
#!/bin/bash
23+
BACKUP_DIR="/backups/postgres"
24+
DATE=$(date +%Y%m%d_%H%M%S)
25+
mkdir -p $BACKUP_DIR
26+
27+
# Backup database
28+
docker exec postgres pg_dump -U ghidrauser ghidrainsight | gzip > $BACKUP_DIR/ghidrainsight_$DATE.sql.gz
29+
30+
# Keep only last 30 days
31+
find $BACKUP_DIR -name "*.sql.gz" -mtime +30 -delete
32+
EOF
33+
34+
chmod +x scripts/backup-db.sh
35+
36+
# Add to crontab (daily at 2 AM)
37+
echo "0 2 * * * /path/to/scripts/backup-db.sh" | crontab -
38+
```
39+
40+
#### PostgreSQL (Kubernetes)
41+
42+
```yaml
43+
# k8s/postgres-backup-job.yaml
44+
apiVersion: batch/v1
45+
kind: CronJob
46+
metadata:
47+
name: postgres-backup
48+
namespace: ghidrainsight
49+
spec:
50+
schedule: "0 2 * * *" # Daily at 2 AM
51+
jobTemplate:
52+
spec:
53+
template:
54+
spec:
55+
containers:
56+
- name: postgres-backup
57+
image: postgres:15-alpine
58+
command:
59+
- /bin/sh
60+
- -c
61+
- |
62+
pg_dump -h postgres -U ghidrauser ghidrainsight | gzip > /backup/ghidrainsight_$(date +%Y%m%d_%H%M%S).sql.gz
63+
env:
64+
- name: PGPASSWORD
65+
valueFrom:
66+
secretKeyRef:
67+
name: postgres-secret
68+
key: password
69+
volumeMounts:
70+
- name: backup-storage
71+
mountPath: /backup
72+
volumes:
73+
- name: backup-storage
74+
persistentVolumeClaim:
75+
claimName: backup-pvc
76+
restartPolicy: OnFailure
77+
```
78+
79+
### Manual Backup
80+
81+
```bash
82+
# Docker
83+
docker exec postgres pg_dump -U ghidrauser ghidrainsight > backup.sql
84+
85+
# Kubernetes
86+
kubectl exec -it postgres-xxx -n ghidrainsight -- pg_dump -U ghidrauser ghidrainsight > backup.sql
87+
88+
# Direct connection
89+
pg_dump -h localhost -U ghidrauser ghidrainsight > backup.sql
90+
```
91+
92+
## Database Restore
93+
94+
### From Backup File
95+
96+
```bash
97+
# Docker
98+
gunzip -c backup.sql.gz | docker exec -i postgres psql -U ghidrauser ghidrainsight
99+
100+
# Kubernetes
101+
gunzip -c backup.sql.gz | kubectl exec -i postgres-xxx -n ghidrainsight -- psql -U ghidrauser ghidrainsight
102+
103+
# Direct connection
104+
gunzip -c backup.sql.gz | psql -h localhost -U ghidrauser ghidrainsight
105+
```
106+
107+
## Configuration Backup
108+
109+
### Backup Configuration Files
110+
111+
```bash
112+
# Create backup script
113+
cat > scripts/backup-config.sh << 'EOF'
114+
#!/bin/bash
115+
BACKUP_DIR="/backups/config"
116+
DATE=$(date +%Y%m%d_%H%M%S)
117+
mkdir -p $BACKUP_DIR
118+
119+
# Backup docker-compose.yml
120+
cp docker-compose.yml $BACKUP_DIR/docker-compose_$DATE.yml
121+
122+
# Backup .env files
123+
cp .env $BACKUP_DIR/env_$DATE 2>/dev/null || true
124+
125+
# Backup Kubernetes configs
126+
tar -czf $BACKUP_DIR/k8s_$DATE.tar.gz k8s/ helm/ 2>/dev/null || true
127+
128+
# Keep only last 30 days
129+
find $BACKUP_DIR -type f -mtime +30 -delete
130+
EOF
131+
132+
chmod +x scripts/backup-config.sh
133+
```
134+
135+
## Cloud Storage Backups
136+
137+
### AWS S3
138+
139+
```bash
140+
# Install AWS CLI
141+
pip install awscli
142+
143+
# Configure
144+
aws configure
145+
146+
# Backup to S3
147+
aws s3 sync /backups/postgres s3://ghidrainsight-backups/postgres/
148+
aws s3 sync /backups/config s3://ghidrainsight-backups/config/
149+
```
150+
151+
### Google Cloud Storage
152+
153+
```bash
154+
# Install gsutil
155+
pip install gsutil
156+
157+
# Configure
158+
gcloud auth login
159+
160+
# Backup to GCS
161+
gsutil -m cp -r /backups/postgres gs://ghidrainsight-backups/
162+
gsutil -m cp -r /backups/config gs://ghidrainsight-backups/
163+
```
164+
165+
### Azure Blob Storage
166+
167+
```bash
168+
# Install Azure CLI
169+
az storage blob upload-batch \
170+
--account-name ghidrainsight \
171+
--destination backups \
172+
--source /backups/postgres
173+
```
174+
175+
## Disaster Recovery
176+
177+
### Recovery Procedures
178+
179+
#### 1. Full System Recovery
180+
181+
```bash
182+
# 1. Restore database
183+
gunzip -c backup.sql.gz | psql -h localhost -U ghidrauser ghidrainsight
184+
185+
# 2. Restore configuration
186+
cp /backups/config/docker-compose_YYYYMMDD.yml docker-compose.yml
187+
cp /backups/config/env_YYYYMMDD .env
188+
189+
# 3. Restart services
190+
docker-compose down
191+
docker-compose up -d
192+
```
193+
194+
#### 2. Point-in-Time Recovery
195+
196+
```bash
197+
# Enable WAL archiving in postgresql.conf
198+
wal_level = replica
199+
archive_mode = on
200+
archive_command = 'cp %p /backups/wal/%f'
201+
202+
# Restore to specific time
203+
pg_basebackup -D /restore -Ft -z -P
204+
# Then apply WAL files up to target time
205+
```
206+
207+
#### 3. Multi-Region Recovery
208+
209+
```bash
210+
# Setup replication
211+
# Primary: us-east-1
212+
# Standby: us-west-2
213+
214+
# Promote standby to primary
215+
pg_ctl promote -D /var/lib/postgresql/data
216+
```
217+
218+
## Backup Verification
219+
220+
### Test Restore
221+
222+
```bash
223+
# Create test database
224+
createdb ghidrainsight_test
225+
226+
# Restore backup
227+
gunzip -c backup.sql.gz | psql ghidrainsight_test
228+
229+
# Verify
230+
psql ghidrainsight_test -c "SELECT COUNT(*) FROM binary_analyses;"
231+
```
232+
233+
## Automation
234+
235+
### Backup Monitoring
236+
237+
```python
238+
# scripts/backup-monitor.py
239+
import os
240+
import subprocess
241+
from datetime import datetime, timedelta
242+
243+
def check_backup_age(backup_dir):
244+
"""Check if backups are recent."""
245+
files = os.listdir(backup_dir)
246+
if not files:
247+
return False
248+
249+
latest = max(files, key=lambda f: os.path.getmtime(os.path.join(backup_dir, f)))
250+
latest_time = datetime.fromtimestamp(os.path.getmtime(os.path.join(backup_dir, latest)))
251+
252+
return datetime.now() - latest_time < timedelta(days=1)
253+
254+
if __name__ == "__main__":
255+
if not check_backup_age("/backups/postgres"):
256+
print("WARNING: No recent backup found!")
257+
# Send alert
258+
```
259+
260+
## Best Practices
261+
262+
1. **Automate Backups**: Use cron jobs or Kubernetes CronJobs
263+
2. **Test Restores**: Regularly test backup restoration
264+
3. **Offsite Storage**: Store backups in cloud storage
265+
4. **Encryption**: Encrypt sensitive backups
266+
5. **Retention Policy**: Keep backups for appropriate duration
267+
6. **Monitoring**: Monitor backup success/failure
268+
7. **Documentation**: Document recovery procedures
269+
270+
## Recovery Time Objectives (RTO)
271+
272+
- **Database**: < 1 hour
273+
- **Configuration**: < 15 minutes
274+
- **Full System**: < 4 hours
275+
276+
## Recovery Point Objectives (RPO)
277+
278+
- **Database**: < 24 hours (daily backups)
279+
- **Configuration**: < 1 hour (version control)
280+
- **Cache**: Acceptable to lose (can regenerate)

0 commit comments

Comments
 (0)