grim-reaper 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +511 -0
- data/bin/grim +397 -0
- data/docs/AI_MACHINE_LEARNING.md +373 -0
- data/docs/BACKUP_RECOVERY.md +477 -0
- data/docs/CLOUD_DISTRIBUTED_SYSTEMS.md +502 -0
- data/docs/DEVELOPMENT_TOOLS_INFRASTRUCTURE.md +547 -0
- data/docs/PERFORMANCE_OPTIMIZATION.md +515 -0
- data/docs/SECURITY_COMPLIANCE.md +535 -0
- data/docs/SYSTEM_MAINTENANCE_OPERATIONS.md +520 -0
- data/docs/SYSTEM_MONITORING_HEALTH.md +502 -0
- data/docs/TESTING_QUALITY_ASSURANCE.md +526 -0
- data/docs/WEB_SERVICES_APIS.md +573 -0
- data/lib/grim_reaper/core.rb +130 -0
- data/lib/grim_reaper/go_module.rb +151 -0
- data/lib/grim_reaper/installer.rb +485 -0
- data/lib/grim_reaper/python_module.rb +172 -0
- data/lib/grim_reaper/security_module.rb +180 -0
- data/lib/grim_reaper/shell_module.rb +156 -0
- data/lib/grim_reaper/version.rb +5 -0
- data/lib/grim_reaper.rb +41 -0
- metadata +247 -0
@@ -0,0 +1,573 @@
|
|
1
|
+
////////////////////////////////////////////
|
2
|
+
// curl -fsSL https://grim.so | sudo bash //
|
3
|
+
// ██████╗ ██████╗ ██╗███╗ ███╗ //
|
4
|
+
// ██╔════╝ ██╔══██╗██║████╗ ████║ //
|
5
|
+
// ██║ ███╗██████╔╝██║██╔████╔██║ //
|
6
|
+
// ██║ ██║██╔══██╗██║██║╚██╔╝██║ //
|
7
|
+
// ╚██████╔╝██║ ██║██║██║ ╚═╝ ██║ //
|
8
|
+
// ╚═════╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ //
|
9
|
+
// Death Defying Data Protection //
|
10
|
+
////////////////////////////////////////////
|
11
|
+
|
12
|
+
# 🌐 Web Services & APIs
|
13
|
+
|
14
|
+
**The Digital Interface of Grim Reaper** - High-performance web services and REST APIs that provide seamless access to all Grim Reaper capabilities through modern web interfaces, real-time dashboards, and comprehensive API endpoints.
|
15
|
+
|
16
|
+
## Overview
|
17
|
+
|
18
|
+
The Web Services & APIs category provides modern web interfaces, REST APIs, and real-time monitoring capabilities. It includes FastAPI-based web services, interactive dashboards, API gateways, and WebSocket support for real-time communication and monitoring.
|
19
|
+
|
20
|
+
## Architecture
|
21
|
+
|
22
|
+
```
|
23
|
+
🌐 WEB SERVICES & APIs LAYER
|
24
|
+
|
|
25
|
+
┌──────┼──────┐
|
26
|
+
│ │ │
|
27
|
+
FastAPI Dashboard API
|
28
|
+
Services Interface Gateway
|
29
|
+
```
|
30
|
+
|
31
|
+
## Core Components
|
32
|
+
|
33
|
+
### 🚀 FastAPI Web Services (sh_grim/dashboard.sh + py_grim/dashboard integration)
|
34
|
+
|
35
|
+
**Purpose:** High-performance web dashboard with real-time monitoring and management interface.
|
36
|
+
|
37
|
+
#### Key Features
|
38
|
+
- **Interactive Dashboard**: Real-time system monitoring and control
|
39
|
+
- **REST API Integration**: Full API access to all system functions
|
40
|
+
- **Real-time Updates**: Live data streaming and updates
|
41
|
+
- **Responsive Design**: Mobile-friendly responsive interface
|
42
|
+
- **User Management**: Multi-user access and role management
|
43
|
+
- **Customizable Views**: Configurable dashboard layouts
|
44
|
+
|
45
|
+
#### Commands
|
46
|
+
```bash
|
47
|
+
grim dashboard start # Start web dashboard
|
48
|
+
grim dashboard stop # Stop dashboard
|
49
|
+
grim dashboard restart # Restart dashboard
|
50
|
+
grim dashboard status # Check dashboard status
|
51
|
+
grim dashboard config # Configure dashboard
|
52
|
+
grim dashboard init # Initialize dashboard
|
53
|
+
grim dashboard setup # Run setup wizard
|
54
|
+
grim dashboard logs # View dashboard logs
|
55
|
+
grim dashboard help # Display dashboard help
|
56
|
+
```
|
57
|
+
|
58
|
+
#### Dashboard Features
|
59
|
+
- **System Overview**: Real-time system status and metrics
|
60
|
+
- **Performance Monitoring**: Live performance data and graphs
|
61
|
+
- **Backup Management**: Backup status and management interface
|
62
|
+
- **Security Dashboard**: Security status and threat monitoring
|
63
|
+
- **Configuration Management**: System configuration interface
|
64
|
+
- **Log Viewer**: Real-time log viewing and analysis
|
65
|
+
|
66
|
+
#### Configuration
|
67
|
+
```yaml
|
68
|
+
dashboard_configuration:
|
69
|
+
server:
|
70
|
+
host: "0.0.0.0"
|
71
|
+
port: 8080
|
72
|
+
workers: 4
|
73
|
+
timeout: 30
|
74
|
+
|
75
|
+
security:
|
76
|
+
ssl_enabled: false
|
77
|
+
authentication: true
|
78
|
+
session_timeout: 3600
|
79
|
+
|
80
|
+
features:
|
81
|
+
real_time_updates: true
|
82
|
+
websocket_enabled: true
|
83
|
+
api_access: true
|
84
|
+
|
85
|
+
customization:
|
86
|
+
theme: "dark"
|
87
|
+
refresh_interval: 5
|
88
|
+
max_data_points: 1000
|
89
|
+
```
|
90
|
+
|
91
|
+
### 🌐 FastAPI Web Server (py_grim/grim_web/* via throne)
|
92
|
+
|
93
|
+
**Purpose:** High-performance FastAPI web server with comprehensive REST API endpoints.
|
94
|
+
|
95
|
+
#### Key Features
|
96
|
+
- **FastAPI Framework**: Modern, fast web framework
|
97
|
+
- **REST API**: Comprehensive REST API endpoints
|
98
|
+
- **OpenAPI Documentation**: Auto-generated API documentation
|
99
|
+
- **WebSocket Support**: Real-time bidirectional communication
|
100
|
+
- **Middleware Support**: CORS, authentication, rate limiting
|
101
|
+
- **Async Support**: High-performance async operations
|
102
|
+
|
103
|
+
#### Commands
|
104
|
+
```bash
|
105
|
+
grim web start # Start FastAPI web server
|
106
|
+
grim web stop # Stop all web services
|
107
|
+
grim web restart # Restart web server
|
108
|
+
grim web gateway # Start API gateway with load balancing
|
109
|
+
grim web api # Start API application
|
110
|
+
grim web status # Show web services status
|
111
|
+
grim web help # Display web help
|
112
|
+
```
|
113
|
+
|
114
|
+
#### API Endpoints
|
115
|
+
- **Health Check**: `GET /health` - System health status
|
116
|
+
- **Root Endpoint**: `GET /` - API documentation and root
|
117
|
+
- **TuskLang Integration**: `GET /tusktsk/*` - TuskLang integration endpoints
|
118
|
+
- **REST API**: `GET /api/*` - Comprehensive REST API endpoints
|
119
|
+
- **WebSocket**: `ws://localhost:8080/ws` - Real-time monitoring
|
120
|
+
|
121
|
+
#### API Documentation
|
122
|
+
```yaml
|
123
|
+
api_endpoints:
|
124
|
+
health:
|
125
|
+
path: "/health"
|
126
|
+
method: "GET"
|
127
|
+
description: "System health check"
|
128
|
+
|
129
|
+
metrics:
|
130
|
+
path: "/api/metrics"
|
131
|
+
method: "GET"
|
132
|
+
description: "System metrics"
|
133
|
+
|
134
|
+
status:
|
135
|
+
path: "/api/status"
|
136
|
+
method: "GET"
|
137
|
+
description: "Service status"
|
138
|
+
|
139
|
+
backup:
|
140
|
+
path: "/api/backup"
|
141
|
+
method: "POST"
|
142
|
+
description: "Create backup"
|
143
|
+
|
144
|
+
restore:
|
145
|
+
path: "/api/restore"
|
146
|
+
method: "POST"
|
147
|
+
description: "Restore from backup"
|
148
|
+
```
|
149
|
+
|
150
|
+
### 🚪 API Gateway (py_grim/grim_gateway/gateway.py via throne)
|
151
|
+
|
152
|
+
**Purpose:** Load-balanced API gateway with advanced routing and security features.
|
153
|
+
|
154
|
+
#### Key Features
|
155
|
+
- **Load Balancing**: Intelligent load balancing across services
|
156
|
+
- **Rate Limiting**: API rate limiting and throttling
|
157
|
+
- **Authentication**: Centralized authentication and authorization
|
158
|
+
- **Request Routing**: Advanced request routing and filtering
|
159
|
+
- **Monitoring**: Gateway performance monitoring
|
160
|
+
- **Security**: API security and protection features
|
161
|
+
|
162
|
+
#### Commands
|
163
|
+
```bash
|
164
|
+
grim gateway start # Start API gateway
|
165
|
+
grim gateway stop # Stop gateway
|
166
|
+
grim gateway status # Gateway status
|
167
|
+
grim gateway config # Configure gateway
|
168
|
+
grim gateway help # Display gateway help
|
169
|
+
```
|
170
|
+
|
171
|
+
#### Gateway Features
|
172
|
+
- **Load Balancing**: Round-robin, least connections, weighted
|
173
|
+
- **Health Checks**: Service health monitoring and failover
|
174
|
+
- **SSL Termination**: SSL/TLS termination and management
|
175
|
+
- **Request Filtering**: Request validation and filtering
|
176
|
+
- **Response Caching**: Intelligent response caching
|
177
|
+
- **Logging**: Comprehensive request/response logging
|
178
|
+
|
179
|
+
### 🔌 WebSocket Support
|
180
|
+
|
181
|
+
**Purpose:** Real-time bidirectional communication for live monitoring and updates.
|
182
|
+
|
183
|
+
#### Key Features
|
184
|
+
- **Real-time Updates**: Live data streaming and updates
|
185
|
+
- **Bidirectional Communication**: Full-duplex communication
|
186
|
+
- **Connection Management**: Automatic connection management
|
187
|
+
- **Event Broadcasting**: Broadcast events to multiple clients
|
188
|
+
- **Authentication**: WebSocket authentication and security
|
189
|
+
- **Performance Optimization**: Optimized for high-performance
|
190
|
+
|
191
|
+
#### WebSocket Endpoints
|
192
|
+
- **Monitoring**: `ws://localhost:8080/ws/monitoring` - Real-time monitoring
|
193
|
+
- **Alerts**: `ws://localhost:8080/ws/alerts` - Real-time alerts
|
194
|
+
- **Logs**: `ws://localhost:8080/ws/logs` - Live log streaming
|
195
|
+
- **Metrics**: `ws://localhost:8080/ws/metrics` - Live metrics
|
196
|
+
|
197
|
+
#### WebSocket Events
|
198
|
+
```json
|
199
|
+
{
|
200
|
+
"type": "system_update",
|
201
|
+
"timestamp": "2024-01-15T10:30:00Z",
|
202
|
+
"data": {
|
203
|
+
"cpu_usage": 45.2,
|
204
|
+
"memory_usage": 67.8,
|
205
|
+
"disk_usage": 23.1
|
206
|
+
}
|
207
|
+
}
|
208
|
+
```
|
209
|
+
|
210
|
+
## API Reference
|
211
|
+
|
212
|
+
### Core API Endpoints
|
213
|
+
|
214
|
+
#### System Management
|
215
|
+
```http
|
216
|
+
GET /api/system/status # Get system status
|
217
|
+
GET /api/system/health # Get system health
|
218
|
+
GET /api/system/info # Get system information
|
219
|
+
POST /api/system/restart # Restart system services
|
220
|
+
```
|
221
|
+
|
222
|
+
#### Backup Management
|
223
|
+
```http
|
224
|
+
GET /api/backup/list # List all backups
|
225
|
+
POST /api/backup/create # Create new backup
|
226
|
+
GET /api/backup/{id}/status # Get backup status
|
227
|
+
POST /api/backup/{id}/restore # Restore from backup
|
228
|
+
DELETE /api/backup/{id} # Delete backup
|
229
|
+
```
|
230
|
+
|
231
|
+
#### Monitoring
|
232
|
+
```http
|
233
|
+
GET /api/monitoring/metrics # Get system metrics
|
234
|
+
GET /api/monitoring/alerts # Get active alerts
|
235
|
+
POST /api/monitoring/start # Start monitoring
|
236
|
+
POST /api/monitoring/stop # Stop monitoring
|
237
|
+
```
|
238
|
+
|
239
|
+
#### Security
|
240
|
+
```http
|
241
|
+
GET /api/security/scan # Run security scan
|
242
|
+
GET /api/security/status # Get security status
|
243
|
+
POST /api/security/fix # Fix security issues
|
244
|
+
GET /api/security/report # Get security report
|
245
|
+
```
|
246
|
+
|
247
|
+
### Authentication & Authorization
|
248
|
+
|
249
|
+
#### API Authentication
|
250
|
+
```http
|
251
|
+
POST /api/auth/login # Login
|
252
|
+
POST /api/auth/logout # Logout
|
253
|
+
GET /api/auth/status # Check authentication status
|
254
|
+
POST /api/auth/refresh # Refresh token
|
255
|
+
```
|
256
|
+
|
257
|
+
#### API Keys
|
258
|
+
```http
|
259
|
+
GET /api/keys/list # List API keys
|
260
|
+
POST /api/keys/create # Create new API key
|
261
|
+
DELETE /api/keys/{id} # Delete API key
|
262
|
+
```
|
263
|
+
|
264
|
+
### Response Formats
|
265
|
+
|
266
|
+
#### Success Response
|
267
|
+
```json
|
268
|
+
{
|
269
|
+
"success": true,
|
270
|
+
"data": {
|
271
|
+
"id": "backup_123",
|
272
|
+
"status": "completed",
|
273
|
+
"size": "1.2GB",
|
274
|
+
"created_at": "2024-01-15T10:30:00Z"
|
275
|
+
},
|
276
|
+
"message": "Backup created successfully"
|
277
|
+
}
|
278
|
+
```
|
279
|
+
|
280
|
+
#### Error Response
|
281
|
+
```json
|
282
|
+
{
|
283
|
+
"success": false,
|
284
|
+
"error": {
|
285
|
+
"code": "BACKUP_FAILED",
|
286
|
+
"message": "Backup operation failed",
|
287
|
+
"details": "Insufficient disk space"
|
288
|
+
},
|
289
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
290
|
+
}
|
291
|
+
```
|
292
|
+
|
293
|
+
## Integration Patterns
|
294
|
+
|
295
|
+
### Complete Web Service Setup
|
296
|
+
```bash
|
297
|
+
# 1. Initialize web services
|
298
|
+
grim web init
|
299
|
+
|
300
|
+
# 2. Start FastAPI server
|
301
|
+
grim web start
|
302
|
+
|
303
|
+
# 3. Start API gateway
|
304
|
+
grim web gateway
|
305
|
+
|
306
|
+
# 4. Start dashboard
|
307
|
+
grim dashboard start
|
308
|
+
|
309
|
+
# 5. Verify services
|
310
|
+
grim web status
|
311
|
+
```
|
312
|
+
|
313
|
+
### API Integration Example
|
314
|
+
```bash
|
315
|
+
# Health check
|
316
|
+
curl http://localhost:8000/health
|
317
|
+
|
318
|
+
# Create backup via API
|
319
|
+
curl -X POST http://localhost:8000/api/backup/create \
|
320
|
+
-H "Content-Type: application/json" \
|
321
|
+
-d '{"name": "api_backup", "path": "/data"}'
|
322
|
+
|
323
|
+
# Get system metrics
|
324
|
+
curl http://localhost:8000/api/metrics
|
325
|
+
|
326
|
+
# WebSocket connection
|
327
|
+
wscat -c ws://localhost:8080/ws/monitoring
|
328
|
+
```
|
329
|
+
|
330
|
+
### Dashboard Integration
|
331
|
+
```bash
|
332
|
+
# Access dashboard
|
333
|
+
open http://localhost:8080
|
334
|
+
|
335
|
+
# API documentation
|
336
|
+
open http://localhost:8000/docs
|
337
|
+
|
338
|
+
# Health status
|
339
|
+
curl http://localhost:8000/health
|
340
|
+
|
341
|
+
# System status
|
342
|
+
curl http://localhost:8000/api/status
|
343
|
+
```
|
344
|
+
|
345
|
+
## Configuration
|
346
|
+
|
347
|
+
### Web Services Configuration
|
348
|
+
```yaml
|
349
|
+
web_services_configuration:
|
350
|
+
fastapi:
|
351
|
+
host: "0.0.0.0"
|
352
|
+
port: 8000
|
353
|
+
workers: 4
|
354
|
+
timeout: 30
|
355
|
+
reload: false
|
356
|
+
|
357
|
+
dashboard:
|
358
|
+
host: "0.0.0.0"
|
359
|
+
port: 8080
|
360
|
+
refresh_interval: 5
|
361
|
+
theme: "dark"
|
362
|
+
|
363
|
+
gateway:
|
364
|
+
host: "0.0.0.0"
|
365
|
+
port: 9000
|
366
|
+
load_balancing: true
|
367
|
+
rate_limiting: true
|
368
|
+
|
369
|
+
security:
|
370
|
+
ssl_enabled: false
|
371
|
+
authentication: true
|
372
|
+
cors_enabled: true
|
373
|
+
rate_limit: 1000
|
374
|
+
```
|
375
|
+
|
376
|
+
### API Configuration
|
377
|
+
```yaml
|
378
|
+
api_configuration:
|
379
|
+
endpoints:
|
380
|
+
health_check: "/health"
|
381
|
+
metrics: "/api/metrics"
|
382
|
+
status: "/api/status"
|
383
|
+
|
384
|
+
authentication:
|
385
|
+
enabled: true
|
386
|
+
method: "jwt"
|
387
|
+
token_expiry: 3600
|
388
|
+
|
389
|
+
rate_limiting:
|
390
|
+
enabled: true
|
391
|
+
requests_per_minute: 1000
|
392
|
+
burst_limit: 100
|
393
|
+
|
394
|
+
logging:
|
395
|
+
level: "INFO"
|
396
|
+
format: "json"
|
397
|
+
file: "/var/log/grim/api.log"
|
398
|
+
```
|
399
|
+
|
400
|
+
### Dashboard Configuration
|
401
|
+
```yaml
|
402
|
+
dashboard_configuration:
|
403
|
+
interface:
|
404
|
+
theme: "dark"
|
405
|
+
language: "en"
|
406
|
+
timezone: "UTC"
|
407
|
+
|
408
|
+
features:
|
409
|
+
real_time_updates: true
|
410
|
+
websocket_enabled: true
|
411
|
+
api_access: true
|
412
|
+
|
413
|
+
customization:
|
414
|
+
refresh_interval: 5
|
415
|
+
max_data_points: 1000
|
416
|
+
chart_types: ["line", "bar", "pie"]
|
417
|
+
|
418
|
+
security:
|
419
|
+
session_timeout: 3600
|
420
|
+
max_sessions: 10
|
421
|
+
ip_whitelist: []
|
422
|
+
```
|
423
|
+
|
424
|
+
## Best Practices
|
425
|
+
|
426
|
+
### API Design
|
427
|
+
1. **RESTful Design**: Follow REST principles
|
428
|
+
2. **Consistent Naming**: Use consistent naming conventions
|
429
|
+
3. **Error Handling**: Implement proper error handling
|
430
|
+
4. **Versioning**: Use API versioning
|
431
|
+
5. **Documentation**: Maintain comprehensive documentation
|
432
|
+
|
433
|
+
### Security
|
434
|
+
1. **Authentication**: Implement proper authentication
|
435
|
+
2. **Authorization**: Use role-based access control
|
436
|
+
3. **Rate Limiting**: Implement rate limiting
|
437
|
+
4. **Input Validation**: Validate all inputs
|
438
|
+
5. **HTTPS**: Use HTTPS in production
|
439
|
+
|
440
|
+
### Performance
|
441
|
+
1. **Caching**: Implement appropriate caching
|
442
|
+
2. **Load Balancing**: Use load balancing
|
443
|
+
3. **Monitoring**: Monitor API performance
|
444
|
+
4. **Optimization**: Optimize database queries
|
445
|
+
5. **Compression**: Use response compression
|
446
|
+
|
447
|
+
## Troubleshooting
|
448
|
+
|
449
|
+
### Common Issues
|
450
|
+
|
451
|
+
#### Web Service Failures
|
452
|
+
```bash
|
453
|
+
# Check web service status
|
454
|
+
grim web status
|
455
|
+
|
456
|
+
# View web service logs
|
457
|
+
grim log tail web.log
|
458
|
+
|
459
|
+
# Restart web services
|
460
|
+
grim web restart
|
461
|
+
|
462
|
+
# Check port availability
|
463
|
+
grim health-check network
|
464
|
+
```
|
465
|
+
|
466
|
+
#### Dashboard Issues
|
467
|
+
```bash
|
468
|
+
# Check dashboard status
|
469
|
+
grim dashboard status
|
470
|
+
|
471
|
+
# Restart dashboard
|
472
|
+
grim dashboard restart
|
473
|
+
|
474
|
+
# View dashboard logs
|
475
|
+
grim dashboard logs
|
476
|
+
|
477
|
+
# Check dashboard configuration
|
478
|
+
grim dashboard config
|
479
|
+
```
|
480
|
+
|
481
|
+
#### API Gateway Issues
|
482
|
+
```bash
|
483
|
+
# Check gateway status
|
484
|
+
grim gateway status
|
485
|
+
|
486
|
+
# Restart gateway
|
487
|
+
grim gateway restart
|
488
|
+
|
489
|
+
# Check gateway configuration
|
490
|
+
grim gateway config
|
491
|
+
|
492
|
+
# View gateway logs
|
493
|
+
grim log tail gateway.log
|
494
|
+
```
|
495
|
+
|
496
|
+
#### WebSocket Issues
|
497
|
+
```bash
|
498
|
+
# Test WebSocket connection
|
499
|
+
wscat -c ws://localhost:8080/ws/monitoring
|
500
|
+
|
501
|
+
# Check WebSocket status
|
502
|
+
grim web status --websocket
|
503
|
+
|
504
|
+
# View WebSocket logs
|
505
|
+
grim log tail websocket.log
|
506
|
+
```
|
507
|
+
|
508
|
+
## Performance Metrics
|
509
|
+
|
510
|
+
### Key Performance Indicators
|
511
|
+
- **Response Time**: <100ms for API requests
|
512
|
+
- **Throughput**: >1000 requests/second
|
513
|
+
- **Uptime**: >99.9%
|
514
|
+
- **Error Rate**: <0.1%
|
515
|
+
- **Concurrent Connections**: >1000 WebSocket connections
|
516
|
+
|
517
|
+
### Monitoring Dashboard
|
518
|
+
Access web service metrics at:
|
519
|
+
- **API Dashboard**: http://localhost:8080/api-metrics
|
520
|
+
- **Performance Dashboard**: http://localhost:8080/performance
|
521
|
+
- **Health Dashboard**: http://localhost:8080/health
|
522
|
+
- **API Documentation**: http://localhost:8000/docs
|
523
|
+
|
524
|
+
## Development
|
525
|
+
|
526
|
+
### API Development
|
527
|
+
```bash
|
528
|
+
# Start development server
|
529
|
+
grim web start --dev
|
530
|
+
|
531
|
+
# Run API tests
|
532
|
+
grim test-framework web
|
533
|
+
|
534
|
+
# Generate API documentation
|
535
|
+
grim docs generate api-docs
|
536
|
+
|
537
|
+
# Validate API schema
|
538
|
+
grim web validate-schema
|
539
|
+
```
|
540
|
+
|
541
|
+
### Dashboard Development
|
542
|
+
```bash
|
543
|
+
# Start dashboard in development mode
|
544
|
+
grim dashboard start --dev
|
545
|
+
|
546
|
+
# Customize dashboard
|
547
|
+
grim dashboard customize
|
548
|
+
|
549
|
+
# Add custom widgets
|
550
|
+
grim dashboard add-widget
|
551
|
+
|
552
|
+
# Test dashboard functionality
|
553
|
+
grim dashboard test
|
554
|
+
```
|
555
|
+
|
556
|
+
## Future Enhancements
|
557
|
+
|
558
|
+
### Planned Features
|
559
|
+
- **GraphQL Support**: GraphQL API implementation
|
560
|
+
- **Microservices**: Microservices architecture
|
561
|
+
- **Container Support**: Docker and Kubernetes support
|
562
|
+
- **Cloud Integration**: Multi-cloud API management
|
563
|
+
- **Advanced Analytics**: Advanced analytics and reporting
|
564
|
+
|
565
|
+
### Roadmap
|
566
|
+
- **Q1 2024**: GraphQL API implementation
|
567
|
+
- **Q2 2024**: Microservices architecture
|
568
|
+
- **Q3 2024**: Container support
|
569
|
+
- **Q4 2024**: Cloud integration
|
570
|
+
|
571
|
+
---
|
572
|
+
|
573
|
+
**The Web Services & APIs provide modern, high-performance interfaces for accessing all Grim Reaper capabilities through web dashboards and REST APIs.**
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "yaml"
|
5
|
+
require "open3"
|
6
|
+
|
7
|
+
module GrimReaper
|
8
|
+
# Main Grim Reaper class that orchestrates all modules
|
9
|
+
class Core
|
10
|
+
attr_reader :config, :modules, :grim_root
|
11
|
+
|
12
|
+
def initialize(config = {})
|
13
|
+
@config = config
|
14
|
+
@grim_root = find_grim_root
|
15
|
+
@modules = {}
|
16
|
+
load_modules
|
17
|
+
end
|
18
|
+
|
19
|
+
# Find Grim Reaper root directory
|
20
|
+
def find_grim_root
|
21
|
+
# Try to find from current directory
|
22
|
+
current_dir = Dir.pwd
|
23
|
+
10.times do
|
24
|
+
if File.exist?(File.join(current_dir, "throne", "grim_throne.sh")) ||
|
25
|
+
File.exist?(File.join(current_dir, "throne", "rb_grim_throne.sh")) ||
|
26
|
+
File.exist?(File.join(current_dir, "tsk_flask", "grim_admin_server.py"))
|
27
|
+
return current_dir
|
28
|
+
end
|
29
|
+
|
30
|
+
parent_dir = File.dirname(current_dir)
|
31
|
+
break if parent_dir == current_dir
|
32
|
+
current_dir = parent_dir
|
33
|
+
end
|
34
|
+
|
35
|
+
# Try common installation paths
|
36
|
+
possible_paths = [
|
37
|
+
ENV["HOME"] + "/reaper",
|
38
|
+
ENV["HOME"] + "/.reaper",
|
39
|
+
"/root/reaper",
|
40
|
+
"/root/.reaper",
|
41
|
+
"/usr/local/reaper",
|
42
|
+
"/usr/share/reaper",
|
43
|
+
Dir.pwd
|
44
|
+
]
|
45
|
+
|
46
|
+
possible_paths.each do |path|
|
47
|
+
if Dir.exist?(path) && (
|
48
|
+
File.exist?(File.join(path, "throne", "grim_throne.sh")) ||
|
49
|
+
File.exist?(File.join(path, "throne", "rb_grim_throne.sh")) ||
|
50
|
+
File.exist?(File.join(path, "tsk_flask", "grim_admin_server.py"))
|
51
|
+
)
|
52
|
+
return path
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
raise Error, "Could not find Grim Reaper root directory"
|
57
|
+
end
|
58
|
+
|
59
|
+
# Load all available Grim Reaper modules
|
60
|
+
def load_modules
|
61
|
+
@modules[:shell] = ShellModule.new(@config, @grim_root)
|
62
|
+
@modules[:python] = PythonModule.new(@config, @grim_root)
|
63
|
+
@modules[:go] = GoModule.new(@config, @grim_root)
|
64
|
+
@modules[:security] = SecurityModule.new(@config, @grim_root)
|
65
|
+
rescue LoadError => e
|
66
|
+
warn "Warning: Could not load module: #{e.message}"
|
67
|
+
end
|
68
|
+
|
69
|
+
# Execute a command across all modules
|
70
|
+
def execute(command, *args)
|
71
|
+
results = {}
|
72
|
+
@modules.each do |name, module_instance|
|
73
|
+
begin
|
74
|
+
results[name] = module_instance.execute(command, *args)
|
75
|
+
rescue => e
|
76
|
+
results[name] = { error: e.message, module: name.to_s }
|
77
|
+
end
|
78
|
+
end
|
79
|
+
results
|
80
|
+
end
|
81
|
+
|
82
|
+
# Get status from all modules
|
83
|
+
def status
|
84
|
+
status_data = {}
|
85
|
+
@modules.each do |name, module_instance|
|
86
|
+
begin
|
87
|
+
status_data[name] = module_instance.status
|
88
|
+
rescue => e
|
89
|
+
status_data[name] = { status: "error", error: e.message, module: name.to_s }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
status_data
|
93
|
+
end
|
94
|
+
|
95
|
+
# Execute a Ruby-specific command
|
96
|
+
def execute_ruby_command(command, *args)
|
97
|
+
ruby_throne_path = File.join(@grim_root, "throne", "rb_grim_throne.sh")
|
98
|
+
|
99
|
+
unless File.exist?(ruby_throne_path)
|
100
|
+
raise Error, "Ruby throne script not found at #{ruby_throne_path}"
|
101
|
+
end
|
102
|
+
|
103
|
+
unless File.executable?(ruby_throne_path)
|
104
|
+
File.chmod(0o755, ruby_throne_path)
|
105
|
+
end
|
106
|
+
|
107
|
+
cmd = [ruby_throne_path, command, *args].compact
|
108
|
+
stdout, stderr, status = Open3.capture3(*cmd, chdir: @grim_root)
|
109
|
+
|
110
|
+
{
|
111
|
+
command: command,
|
112
|
+
args: args,
|
113
|
+
stdout: stdout,
|
114
|
+
stderr: stderr,
|
115
|
+
exit_code: status.exitstatus,
|
116
|
+
success: status.success?
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
# Get backup directory
|
121
|
+
def backup_dir
|
122
|
+
ENV["HOME"] + "/.graveyard"
|
123
|
+
end
|
124
|
+
|
125
|
+
# Get installation directory
|
126
|
+
def install_dir
|
127
|
+
ENV["HOME"] + "/reaper"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|