#!/bin/bash ################################################################################ # Attack Pattern Detection Library ################################################################################ # Purpose: Shared attack vector detection for bot-analyzer and live-monitor # Features: SQL injection, XSS, Path traversal, RCE, Info disclosure, Bruteforce ################################################################################ # SQL Injection Detection # Returns: 0 (true) if SQL injection detected, 1 (false) if not detect_sql_injection() { local url="$1" local url_lower=$(echo "$url" | tr '[:upper:]' '[:lower:]') # Enhanced SQL injection patterns if [[ "$url_lower" =~ (union.*select|concat\(|benchmark\(|sleep\(|waitfor|cast\(|exec\() ]] || [[ "$url_lower" =~ (information_schema|drop table|insert into|update.*set|delete from) ]] || [[ "$url_lower" =~ (%27|0x[0-9a-f]+|hex\(|unhex\(|load_file\() ]]; then return 0 fi return 1 } # XSS (Cross-Site Scripting) Detection detect_xss() { local url="$1" local url_lower=$(echo "$url" | tr '[:upper:]' '[:lower:]') if [[ "$url_lower" =~ (