Reapply "CRITICAL FIXES: Apply essential improvements from beta branch to production"

This reverts commit e5979a501e.
This commit is contained in:
cschantz
2026-03-20 15:45:24 -04:00
parent e5979a501e
commit 3126944905
3 changed files with 51 additions and 19 deletions
+44 -14
View File
@@ -53,7 +53,7 @@ run_module() {
echo ""
echo -e "${RED}✗ Module not found: $category/$module${NC}"
echo ""
read -p "Press Enter to continue..."
read -p "Press Enter to continue..." < /dev/tty 2>/dev/null || true
return 1
fi
@@ -74,7 +74,7 @@ run_module() {
echo -e "${RED}✗ Exited with code: $exit_code${NC}"
fi
echo ""
read -p "Press Enter to continue..."
read -p "Press Enter to continue..." < /dev/tty 2>/dev/null || true
}
#############################################################################
@@ -135,7 +135,9 @@ show_threat_analysis_menu() {
handle_threat_analysis_menu() {
while true; do
show_threat_analysis_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) run_module "security" "bot-analyzer.sh" ;;
@@ -169,7 +171,9 @@ show_live_monitoring_menu() {
handle_live_monitoring_menu() {
while true; do
show_live_monitoring_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) run_module "security" "live-attack-monitor.sh" ;;
@@ -201,7 +205,9 @@ show_log_viewers_menu() {
handle_log_viewers_menu() {
while true; do
show_log_viewers_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) run_module "security" "tail-apache-access.sh" ;;
@@ -232,7 +238,9 @@ show_security_actions_menu() {
handle_security_actions_menu() {
while true; do
show_security_actions_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) run_module "security" "enable-cphulk.sh" ;;
@@ -266,7 +274,9 @@ show_security_menu() {
handle_security_menu() {
while true; do
show_security_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) handle_threat_analysis_menu ;;
@@ -314,7 +324,9 @@ show_website_menu() {
handle_website_menu() {
while true; do
show_website_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) run_module "website" "website-error-analyzer.sh" ;;
@@ -367,7 +379,9 @@ show_performance_menu() {
handle_performance_menu() {
while true; do
show_performance_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) run_module "performance" "mysql-query-analyzer.sh" ;;
@@ -473,7 +487,9 @@ show_acronis_menu() {
handle_backup_menu() {
while true; do
show_backup_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) handle_acronis_menu ;;
@@ -488,7 +504,9 @@ handle_backup_menu() {
handle_acronis_menu() {
while true; do
show_acronis_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) run_module "backup" "acronis-install.sh" ;;
@@ -542,7 +560,9 @@ show_email_menu() {
handle_email_menu() {
while true; do
show_email_menu
read -r choice
if ! read -r choice 2>/dev/null </dev/tty; then
return 0
fi
case $choice in
1) run_module "email" "email-diagnostics.sh" ;;
@@ -573,6 +593,11 @@ init_directories() {
}
startup_detection() {
# Initialize system detection first (required for proper reference database)
if [ -z "${SYS_DETECTION_COMPLETE:-}" ]; then
initialize_system_detection
fi
if ! db_is_fresh; then
clear
print_banner "Server Management Toolkit - Initializing"
@@ -608,7 +633,7 @@ startup_detection() {
print_success "Detection complete! Cached for 1 hour."
echo ""
read -p "Press Enter to continue..."
read -p "Press Enter to continue..." < /dev/tty 2>/dev/null || true
fi
}
@@ -622,7 +647,12 @@ main() {
while true; do
show_main_menu
read -r choice
# Read from terminal (use /dev/tty directly for interaction)
if ! read -r choice 2>/dev/null </dev/tty; then
# No terminal available, return from function gracefully
return 0
fi
case $choice in
1) run_module "diagnostics" "system-health-check.sh" ;;