Remove development test utilities - no longer needed

Removed obsolete development test scripts:
- tools/test-cross-module-intelligence.sh
- tools/test-domain-detection.sh

These were used during initial development for testing the reference
database and domain detection functionality. With multi-panel support
complete and validated on production servers, these development utilities
are no longer needed.

Keeping only production utilities:
- tools/diagnostic-report.sh (system diagnostics)
- tools/erase-toolkit-traces.sh (cleanup utility)
This commit is contained in:
cschantz
2025-11-20 16:39:18 -05:00
parent 207c8257b7
commit cacb7dacec
2 changed files with 0 additions and 158 deletions
-85
View File
@@ -1,85 +0,0 @@
#!/bin/bash
# Test Cross-Module Intelligence
# Demonstrates how modules can reference session data
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
source "$SCRIPT_DIR/lib/reference-db.sh"
print_banner "Cross-Module Intelligence Test"
if [ ! -f "$SYSREF_DB" ]; then
print_error "Reference database not found. Run System Health Check first!"
exit 1
fi
print_section "Testing Health Metric Queries"
# Test individual metrics
echo "Memory Usage: $(db_get_health_metric 'MEMORY_USED_PERCENT')%"
echo "CPU Load: $(db_get_health_metric 'CPU_LOAD_1MIN')"
echo "Disk Usage: $(db_get_health_metric 'DISK_USED_PERCENT')%"
echo "Network Interface: $(db_get_health_metric 'NETWORK_INTERFACE')"
echo "Network MTU: $(db_get_health_metric 'NETWORK_MTU')"
echo "TCP Retransmission: $(db_get_health_metric 'TCP_RETRANS_PERCENT')%"
echo "SMART Status: $(db_get_health_metric 'DISK_SMART_STATUS')"
echo "SSH Attacks Today: $(db_get_health_metric 'SSH_ATTACKS_TODAY')"
echo "cPHulk Status: $(db_get_health_metric 'CPHULK_STATUS')"
print_section "Testing Intelligence Functions"
# Test system load check
if db_is_system_under_load; then
print_warning "System is currently under HIGH LOAD"
echo " CPU Load: $(db_get_health_metric 'CPU_LOAD_1MIN') (cores: $(db_get_health_metric 'CPU_CORES'))"
echo " Memory: $(db_get_health_metric 'MEMORY_USED_PERCENT')%"
else
print_success "System load is NORMAL"
fi
# Test network issues check
if db_has_network_issues; then
print_warning "Network issues DETECTED"
echo " TCP Retransmission: $(db_get_health_metric 'TCP_RETRANS_PERCENT')%"
echo " RX Errors: $(db_get_health_metric 'NETWORK_RX_ERRORS')"
echo " TX Errors: $(db_get_health_metric 'NETWORK_TX_ERRORS')"
else
print_success "Network is HEALTHY"
fi
# Test attack detection
if db_is_under_attack; then
print_critical "System appears to be UNDER ATTACK"
echo " Failed SSH attempts today: $(db_get_health_metric 'SSH_ATTACKS_TODAY')"
echo " Total failed attempts: $(db_get_health_metric 'SSH_FAILED_ATTEMPTS_TOTAL')"
else
print_success "No active attacks detected"
fi
print_section "Cross-Module Intelligence Examples"
echo "Example 1: Bot Analyzer can check if network is already problematic"
echo " if db_has_network_issues; then"
echo " # Adjust recommendations - network may be causing bot issues"
echo " fi"
echo ""
echo "Example 2: MySQL Analyzer can check if system is under load"
echo " if db_is_system_under_load; then"
echo " # Slow queries might be due to overall system load, not just MySQL"
echo " fi"
echo ""
echo "Example 3: Any module can check attack status"
echo " if db_is_under_attack; then"
echo " # Correlate findings with ongoing attacks"
echo " fi"
print_section "All Health Metrics"
echo "Total health metrics stored: $(grep -c '^HEALTH|' "$SYSREF_DB")"
echo ""
echo "Sample (first 10):"
db_get_all_health | head -10
print_success "Cross-module intelligence test complete!"
-73
View File
@@ -1,73 +0,0 @@
#!/bin/bash
# Quick test script to validate domain detection is working
# Returns exit code 0 if working, 1 if broken
echo "========================================"
echo "Domain Detection Test"
echo "========================================"
echo ""
# Source libraries
SCRIPT_DIR="/root/server-toolkit"
source "$SCRIPT_DIR/lib/common-functions.sh"
source "$SCRIPT_DIR/lib/system-detect.sh"
source "$SCRIPT_DIR/lib/user-manager.sh"
echo "Step 1: Check system detection variables"
echo " SYS_CONTROL_PANEL: [$SYS_CONTROL_PANEL]"
echo " SYS_DETECTION_COMPLETE: [$SYS_DETECTION_COMPLETE]"
if [ -z "$SYS_CONTROL_PANEL" ]; then
echo " ❌ FAIL: SYS_CONTROL_PANEL is empty!"
exit 1
else
echo " ✓ PASS: SYS_CONTROL_PANEL is set"
fi
echo ""
echo "Step 2: Test get_user_domains function"
domains=$(get_user_domains "pickledperil")
echo " Domains for pickledperil: [$domains]"
if [ -z "$domains" ]; then
echo " ❌ FAIL: No domains returned!"
exit 1
else
echo " ✓ PASS: Domains found: $domains"
fi
echo ""
echo "Step 3: Test select_user_interactive caching"
# Just test the caching logic without user input
users=(pickledperil)
declare -A user_primary_domain
declare -A user_domain_count
for user in "${users[@]}"; do
local_domains=$(get_user_domains "$user" 2>/dev/null | grep -v "^$")
if [ -n "$local_domains" ]; then
user_domain_count["$user"]=$(echo "$local_domains" | wc -l)
user_primary_domain["$user"]=$(echo "$local_domains" | head -1)
else
user_domain_count["$user"]=0
user_primary_domain["$user"]="(no domains)"
fi
done
echo " Cached domain: ${user_primary_domain[pickledperil]}"
echo " Cached count: ${user_domain_count[pickledperil]}"
if [ "${user_primary_domain[pickledperil]}" = "(no domains)" ]; then
echo " ❌ FAIL: User shows as having no domains!"
exit 1
else
echo " ✓ PASS: User cache working correctly"
fi
echo ""
echo "========================================"
echo "✓ ALL TESTS PASSED!"
echo "Domain detection is working correctly."
echo "========================================"
exit 0