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:
@@ -25,6 +25,10 @@
|
|||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||||
|
|
||||||
# Source required libraries
|
# 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 || {
|
source "$SCRIPT_DIR/lib/attack-signatures.sh" 2>/dev/null || {
|
||||||
echo "ERROR: attack-signatures.sh not found"
|
echo "ERROR: attack-signatures.sh not found"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -167,17 +171,7 @@ declare -A IP_SAMPLE_URLS # Sample URLs per IP
|
|||||||
declare -a ATTACK_TYPES_RAW
|
declare -a ATTACK_TYPES_RAW
|
||||||
declare -a SIGNATURE_HITS_RAW
|
declare -a SIGNATURE_HITS_RAW
|
||||||
|
|
||||||
# Progress indicator
|
# Progress indicator function now sourced from common-functions.sh
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
# Start analysis
|
# Start analysis
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user