Remove duplicate show_progress function

QA scan found duplicate show_progress function in analyze-historical-attacks.sh
that's already available in lib/common-functions.sh.

Changes:
- Added source for lib/common-functions.sh
- Removed local show_progress() definition
- Added comment noting function is now sourced

This reduces code duplication and ensures consistent progress display
across all toolkit scripts.
This commit is contained in:
cschantz
2026-01-02 16:24:56 -05:00
parent 682bd69cf8
commit fdce4ccd07
+5 -11
View File
@@ -25,6 +25,10 @@
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
# Source required libraries
source "$SCRIPT_DIR/lib/common-functions.sh" 2>/dev/null || {
echo "ERROR: common-functions.sh not found"
exit 1
}
source "$SCRIPT_DIR/lib/attack-signatures.sh" 2>/dev/null || {
echo "ERROR: attack-signatures.sh not found"
exit 1
@@ -167,17 +171,7 @@ declare -A IP_SAMPLE_URLS # Sample URLs per IP
declare -a ATTACK_TYPES_RAW
declare -a SIGNATURE_HITS_RAW
# Progress indicator
show_progress() {
count=$1
total=$2
if [ "$total" = "unknown" ] || [ "$total" -eq 0 ] 2>/dev/null; then
echo -ne "\r${BLUE}[*]${NC} Processing: $count lines... "
else
percent=$((count * 100 / total))
echo -ne "\r${BLUE}[*]${NC} Processing: $count/$total lines ($percent%) "
fi
}
# Progress indicator function now sourced from common-functions.sh
# Start analysis
echo ""