#!/bin/bash ################################################################################ # IP Blacklist Checker ################################################################################ # Purpose: Check if server IP is blacklisted ################################################################################ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" source "$SCRIPT_DIR/lib/common-functions.sh" source "$SCRIPT_DIR/lib/system-detect.sh" show_banner "IP Blacklist Checker" # Get server's public IP print_info "Detecting server IP address..." SERVER_IP=$(curl -s ifconfig.me || curl -s icanhazip.com || curl -s ipecho.net/plain) if [ -z "$SERVER_IP" ]; then print_error "Could not detect server IP address" exit 1 fi print_success "Server IP: $SERVER_IP" echo "" # Common blacklists to check BLACKLISTS=( "zen.spamhaus.org" "bl.spamcop.net" "b.barracudacentral.org" "dnsbl.sorbs.net" "bl.spameatingmonkey.net" "dnsbl-1.uceprotect.net" "cbl.abuseat.org" "psbl.surriel.com" ) print_header "Checking Blacklists" echo "" LISTED=0 NOT_LISTED=0 for bl in "${BLACKLISTS[@]}"; do # Reverse IP for DNS lookup REVERSED_IP=$(echo $SERVER_IP | awk -F. '{print $4"."$3"."$2"."$1}') # Check if listed if host "$REVERSED_IP.$bl" &>/dev/null; then print_error "✗ LISTED on $bl" ((LISTED++)) else print_success "✓ Not listed on $bl" ((NOT_LISTED++)) fi done echo "" print_header "Summary" if [ "$LISTED" -eq 0 ]; then print_success "✓ Server IP is not blacklisted ($NOT_LISTED blacklists checked)" else print_warning "⚠ Server IP is listed on $LISTED blacklist(s)" echo "" print_info "To delist your IP:" echo " 1. Fix the underlying issue (spam, malware, etc.)" echo " 2. Visit each blacklist's removal page" echo " 3. Request delisting with justification" echo "" echo "Common delisting links:" echo " Spamhaus: https://www.spamhaus.org/lookup/" echo " SpamCop: https://www.spamcop.net/bl.shtml" echo " Barracuda: https://www.barracudacentral.org/rbl/removal-request" fi echo ""