From 3ef3f4c61b2df43da161de7af6306c8507ea83e4 Mon Sep 17 00:00:00 2001 From: cschantz Date: Tue, 6 Jan 2026 22:11:21 -0500 Subject: [PATCH] Export functions for subshell access (CRITICAL FIX) HTTP monitoring runs in subshells (from tail pipe) but functions were not exported, making them unavailable in those subshells. Exported functions: - write_ip_data_to_file (writes scores to file) - update_ip_intelligence (updates IP scores) - get_ip_intelligence (reads IP data) - get_threat_level (calculates threat level) - get_threat_color (gets display color) This fixes the critical bug where HTTP attacks reached Score:100 but were never blocked because scores weren't written to ip_data file. Without exports: function called in subshell = command not found With exports: function available in all child processes --- modules/security/live-attack-monitor-v2.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/security/live-attack-monitor-v2.sh b/modules/security/live-attack-monitor-v2.sh index 82e5ac8..e8d63b7 100755 --- a/modules/security/live-attack-monitor-v2.sh +++ b/modules/security/live-attack-monitor-v2.sh @@ -304,6 +304,7 @@ get_ip_intelligence() { echo "${IP_DATA[$ip]}" fi } +export -f get_ip_intelligence # Write IP data directly to file (for cross-process communication) write_ip_data_to_file() { @@ -330,6 +331,7 @@ write_ip_data_to_file() { ) 200>"$TEMP_DIR/ip_data.lock" } +export -f write_ip_data_to_file # Update IP intelligence update_ip_intelligence() { @@ -497,6 +499,7 @@ update_ip_intelligence() { (update_ip_reputation "$ip" 1 "$score" 0 "Live monitor: $new_attacks" >/dev/null 2>&1) & fi } +export -f update_ip_intelligence ################################################################################ # Advanced Intelligence Functions @@ -1175,6 +1178,7 @@ get_threat_level() { echo "LOW" fi } +export -f get_threat_level # Get color for threat level get_threat_color() { @@ -1189,6 +1193,7 @@ get_threat_color() { *) echo "$INFO_COLOR" ;; esac } +export -f get_threat_color # Get bot color get_bot_color() {