fix: Redirect all read statements to /dev/tty for terminal interaction via piped stdin

This commit is contained in:
Developer
2026-03-19 20:30:51 -04:00
parent 9048066a49
commit aabc3cb238
+16 -16
View File
@@ -56,7 +56,7 @@ run_module() {
echo "" echo ""
echo -e "${RED}✗ Module not found: $category/$module${NC}" echo -e "${RED}✗ Module not found: $category/$module${NC}"
echo "" echo ""
read -p "Press Enter to continue..." read -p "Press Enter to continue..." < /dev/tty
return 1 return 1
fi fi
@@ -77,7 +77,7 @@ run_module() {
echo -e "${RED}✗ Exited with code: $exit_code${NC}" echo -e "${RED}✗ Exited with code: $exit_code${NC}"
fi fi
echo "" echo ""
read -p "Press Enter to continue..." read -p "Press Enter to continue..." < /dev/tty
} }
############################################################################# #############################################################################
@@ -196,7 +196,7 @@ show_threat_analysis_menu() {
handle_threat_analysis_menu() { handle_threat_analysis_menu() {
while true; do while true; do
show_threat_analysis_menu show_threat_analysis_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) run_module "security" "bot-analyzer.sh" ;; 1) run_module "security" "bot-analyzer.sh" ;;
@@ -230,7 +230,7 @@ show_live_monitoring_menu() {
handle_live_monitoring_menu() { handle_live_monitoring_menu() {
while true; do while true; do
show_live_monitoring_menu show_live_monitoring_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) run_module "security" "live-attack-monitor.sh" ;; 1) run_module "security" "live-attack-monitor.sh" ;;
@@ -262,7 +262,7 @@ show_log_viewers_menu() {
handle_log_viewers_menu() { handle_log_viewers_menu() {
while true; do while true; do
show_log_viewers_menu show_log_viewers_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) run_module "security" "tail-apache-access.sh" ;; 1) run_module "security" "tail-apache-access.sh" ;;
@@ -293,7 +293,7 @@ show_security_actions_menu() {
handle_security_actions_menu() { handle_security_actions_menu() {
while true; do while true; do
show_security_actions_menu show_security_actions_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) run_module "security" "enable-cphulk.sh" ;; 1) run_module "security" "enable-cphulk.sh" ;;
@@ -327,7 +327,7 @@ show_security_menu() {
handle_security_menu() { handle_security_menu() {
while true; do while true; do
show_security_menu show_security_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) handle_threat_analysis_menu ;; 1) handle_threat_analysis_menu ;;
@@ -375,7 +375,7 @@ show_website_menu() {
handle_website_menu() { handle_website_menu() {
while true; do while true; do
show_website_menu show_website_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) run_module "website" "website-error-analyzer.sh" ;; 1) run_module "website" "website-error-analyzer.sh" ;;
@@ -428,7 +428,7 @@ show_performance_menu() {
handle_performance_menu() { handle_performance_menu() {
while true; do while true; do
show_performance_menu show_performance_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) run_module "performance" "mysql-query-analyzer.sh" ;; 1) run_module "performance" "mysql-query-analyzer.sh" ;;
@@ -461,7 +461,7 @@ handle_loadwatch_analyzer() {
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}" echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo -n "Select time range: " echo -n "Select time range: "
read -r range_choice read -r range_choice < /dev/tty
case $range_choice in case $range_choice in
1) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "1h" ;; 1) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "1h" ;;
@@ -534,7 +534,7 @@ show_acronis_menu() {
handle_backup_menu() { handle_backup_menu() {
while true; do while true; do
show_backup_menu show_backup_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) handle_acronis_menu ;; 1) handle_acronis_menu ;;
@@ -549,7 +549,7 @@ handle_backup_menu() {
handle_acronis_menu() { handle_acronis_menu() {
while true; do while true; do
show_acronis_menu show_acronis_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) run_module "backup" "acronis-install.sh" ;; 1) run_module "backup" "acronis-install.sh" ;;
@@ -603,7 +603,7 @@ show_email_menu() {
handle_email_menu() { handle_email_menu() {
while true; do while true; do
show_email_menu show_email_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) run_module "email" "email-diagnostics.sh" ;; 1) run_module "email" "email-diagnostics.sh" ;;
@@ -674,7 +674,7 @@ startup_detection() {
print_success "Detection complete! Cached for 1 hour." print_success "Detection complete! Cached for 1 hour."
echo "" echo ""
read -p "Press Enter to continue..." read -p "Press Enter to continue..." < /dev/tty
fi fi
} }
@@ -688,7 +688,7 @@ main() {
while true; do while true; do
show_main_menu show_main_menu
read -r choice read -r choice < /dev/tty
case $choice in case $choice in
1) run_module "diagnostics" "system-health-check.sh" ;; 1) run_module "diagnostics" "system-health-check.sh" ;;
@@ -700,7 +700,7 @@ main() {
7) run_module "maintenance" "cleanup-toolkit-data.sh" ;; 7) run_module "maintenance" "cleanup-toolkit-data.sh" ;;
0) 0)
echo "" echo ""
read -p "Clean history and remove traces? (yes/no): " clean_hist read -p "Clean history and remove traces? (yes/no): " clean_hist < /dev/tty
if [ "$clean_hist" = "yes" ]; then if [ "$clean_hist" = "yes" ]; then
touch /tmp/.cleanup_requested touch /tmp/.cleanup_requested