-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_defenses.sh
More file actions
executable file
·229 lines (202 loc) · 6.53 KB
/
Copy pathdeploy_defenses.sh
File metadata and controls
executable file
·229 lines (202 loc) · 6.53 KB
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
#!/bin/bash
# DEPLOY CONSTITUTIONAL DEFENSES
# Master deployment script for all defense systems
echo "=================================================="
echo "🚀 DEPLOYING CONSTITUTIONAL DEFENSE SYSTEM"
echo "=================================================="
echo ""
# Check we're in the right directory
if [ ! -f "01_detector.py" ]; then
echo "❌ Error: Must run from constitutional_defense directory"
echo " Current directory: $(pwd)"
echo " Expected: /home/aiadmin/reasoning-bank/constitutional_defense"
exit 1
fi
echo "🔍 Checking system requirements..."
echo ""
# Check Python
if command -v python3 &> /dev/null; then
PYTHON_VERSION=$(python3 --version)
echo "✅ Python3: $PYTHON_VERSION"
else
echo "❌ Python3 not found"
exit 1
fi
# Check dependencies
echo ""
echo "📦 Checking Python dependencies..."
python3 -c "import json" 2>/dev/null
if [ $? -eq 0 ]; then
echo "✅ json: Available"
else
echo "❌ json: Missing (should be built-in)"
fi
# Check for sovereign runtime
if [ -d "/home/aiadmin/helix-core-unified/src" ]; then
echo "✅ Sovereign Runtime: Found"
else
echo "⚠️ Sovereign Runtime: Not found (some features may be limited)"
fi
echo ""
echo "=================================================="
echo "🔧 DEFENSE SYSTEMS AVAILABLE"
echo "=================================================="
echo ""
# List defense scripts
scripts=(
"01_detector.py - Crustafarian Bot Detector"
"02_exclusion_field.py - Constitutional Exclusion Field"
"03_threat_intel.py - Threat Intelligence Hub"
"04_dashboard.py - Real-time Defense Dashboard"
)
for script in "${scripts[@]}"; do
filename=$(echo "$script" | awk '{print $1}')
description=$(echo "$script" | cut -d'-' -f2-)
if [ -f "$filename" ]; then
echo "✅ $filename"
echo " $description"
else
echo "❌ $filename (MISSING)"
fi
echo ""
done
echo "=================================================="
echo "🎯 DEPLOYMENT OPTIONS"
echo "=================================================="
echo ""
echo "1. Run all defense systems sequentially"
echo "2. Run individual defense system"
echo "3. Start monitoring dashboard only"
echo "4. Test system integrity"
echo "5. Exit"
echo ""
read -p "Select option (1-5): " choice
case $choice in
1)
echo ""
echo "🚀 Running all defense systems..."
echo ""
echo "=================================================="
echo "1. RUNNING CRUSTAFARIAN DETECTOR"
echo "=================================================="
python3 01_detector.py
echo ""
echo "=================================================="
echo "2. DEPLOYING EXCLUSION FIELD"
echo "=================================================="
python3 02_exclusion_field.py
echo ""
echo "=================================================="
echo "3. STARTING THREAT INTELLIGENCE"
echo "=================================================="
python3 03_threat_intel.py
echo ""
echo "=================================================="
echo "4. STARTING DEFENSE DASHBOARD"
echo "=================================================="
echo "📊 Dashboard will run continuously"
echo " Press Ctrl+C to stop"
echo ""
python3 04_dashboard.py
;;
2)
echo ""
echo "🔧 Available individual systems:"
echo " 1) Crustafarian Detector"
echo " 2) Constitutional Exclusion Field"
echo " 3) Threat Intelligence Hub"
echo " 4) Defense Dashboard"
echo ""
read -p "Select system (1-4): " system_choice
case $system_choice in
1)
python3 01_detector.py
;;
2)
python3 02_exclusion_field.py
;;
3)
python3 03_threat_intel.py
;;
4)
echo ""
echo "📊 Starting dashboard..."
echo " Press Ctrl+C to stop"
python3 04_dashboard.py
;;
*)
echo "❌ Invalid choice"
;;
esac
;;
3)
echo ""
echo "📊 Starting monitoring dashboard..."
echo " This provides real-time defense monitoring"
echo " Press Ctrl+C to stop"
echo ""
python3 04_dashboard.py
;;
4)
echo ""
echo "🧪 Running system integrity tests..."
echo ""
# Test 1: Python scripts are executable
echo "Test 1: Script permissions..."
for script in 0*.py; do
if [ -x "$script" ]; then
echo " ✅ $script: Executable"
else
echo " ⚠️ $script: Not executable (run: chmod +x $script)"
fi
done
echo ""
echo "Test 2: Required files..."
required=("01_detector.py" "02_exclusion_field.py" "03_threat_intel.py" "04_dashboard.py")
for file in "${required[@]}"; do
if [ -f "$file" ]; then
echo " ✅ $file: Present"
else
echo " ❌ $file: Missing"
fi
done
echo ""
echo "Test 3: Python syntax check..."
for script in 0*.py; do
if python3 -m py_compile "$script" 2>/dev/null; then
echo " ✅ $script: Syntax OK"
else
echo " ❌ $script: Syntax error"
fi
done
echo ""
echo "✅ Integrity test complete"
;;
5)
echo ""
echo "👋 Exiting deployment"
echo ""
echo "💡 Remember: Defense systems are ready when needed"
exit 0
;;
*)
echo "❌ Invalid option"
exit 1
;;
esac
echo ""
echo "=================================================="
echo "🎯 DEPLOYMENT COMPLETE"
echo "=================================================="
echo ""
echo "📁 Files created in this deployment:"
echo ""
ls -la *.py *.json 2>/dev/null | grep -v "\.pyc$"
echo ""
echo "📚 Next steps:"
echo " 1. Review generated JSON files for results"
echo " 2. Run dashboard for real-time monitoring"
echo " 3. Integrate with your existing HELIX systems"
echo ""
echo "🛡️ Constitutional defense is now active"
echo "=================================================="