fix: Redirect all read statements to /dev/tty for terminal interaction via piped stdin
This commit is contained in:
+16
-16
@@ -56,7 +56,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
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -77,7 +77,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
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
@@ -196,7 +196,7 @@ show_threat_analysis_menu() {
|
||||
handle_threat_analysis_menu() {
|
||||
while true; do
|
||||
show_threat_analysis_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) run_module "security" "bot-analyzer.sh" ;;
|
||||
@@ -230,7 +230,7 @@ show_live_monitoring_menu() {
|
||||
handle_live_monitoring_menu() {
|
||||
while true; do
|
||||
show_live_monitoring_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) run_module "security" "live-attack-monitor.sh" ;;
|
||||
@@ -262,7 +262,7 @@ show_log_viewers_menu() {
|
||||
handle_log_viewers_menu() {
|
||||
while true; do
|
||||
show_log_viewers_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) run_module "security" "tail-apache-access.sh" ;;
|
||||
@@ -293,7 +293,7 @@ show_security_actions_menu() {
|
||||
handle_security_actions_menu() {
|
||||
while true; do
|
||||
show_security_actions_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) run_module "security" "enable-cphulk.sh" ;;
|
||||
@@ -327,7 +327,7 @@ show_security_menu() {
|
||||
handle_security_menu() {
|
||||
while true; do
|
||||
show_security_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) handle_threat_analysis_menu ;;
|
||||
@@ -375,7 +375,7 @@ show_website_menu() {
|
||||
handle_website_menu() {
|
||||
while true; do
|
||||
show_website_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) run_module "website" "website-error-analyzer.sh" ;;
|
||||
@@ -428,7 +428,7 @@ show_performance_menu() {
|
||||
handle_performance_menu() {
|
||||
while true; do
|
||||
show_performance_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) run_module "performance" "mysql-query-analyzer.sh" ;;
|
||||
@@ -461,7 +461,7 @@ handle_loadwatch_analyzer() {
|
||||
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
|
||||
echo -n "Select time range: "
|
||||
|
||||
read -r range_choice
|
||||
read -r range_choice < /dev/tty
|
||||
|
||||
case $range_choice in
|
||||
1) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "1h" ;;
|
||||
@@ -534,7 +534,7 @@ show_acronis_menu() {
|
||||
handle_backup_menu() {
|
||||
while true; do
|
||||
show_backup_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) handle_acronis_menu ;;
|
||||
@@ -549,7 +549,7 @@ handle_backup_menu() {
|
||||
handle_acronis_menu() {
|
||||
while true; do
|
||||
show_acronis_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) run_module "backup" "acronis-install.sh" ;;
|
||||
@@ -603,7 +603,7 @@ show_email_menu() {
|
||||
handle_email_menu() {
|
||||
while true; do
|
||||
show_email_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) run_module "email" "email-diagnostics.sh" ;;
|
||||
@@ -674,7 +674,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
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ main() {
|
||||
|
||||
while true; do
|
||||
show_main_menu
|
||||
read -r choice
|
||||
read -r choice < /dev/tty
|
||||
|
||||
case $choice in
|
||||
1) run_module "diagnostics" "system-health-check.sh" ;;
|
||||
@@ -700,7 +700,7 @@ main() {
|
||||
7) run_module "maintenance" "cleanup-toolkit-data.sh" ;;
|
||||
0)
|
||||
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
|
||||
touch /tmp/.cleanup_requested
|
||||
|
||||
Reference in New Issue
Block a user