Refactor exitrace to modular architecture
- Split monolithic exitrace.sh into focused lib/ modules - date_utils.sh: Date validation and generation functions - mx_lookup.sh: MX record lookup functionality - log_analyzer.awk: Core log analysis logic extracted from main script - Maintains full backward compatibility with existing interface - Improves maintainability, testability, and code organization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# mx_lookup.sh - MX record lookup functions for exitrace
|
||||
# Maintainer: ljp
|
||||
|
||||
# MX record lookup with A/AAAA resolution
|
||||
show_mx_records() {
|
||||
local domain="$1"
|
||||
|
||||
if ! command -v dig >/dev/null 2>&1; then
|
||||
echo "(Hinweis) dig nicht gefunden, MX-Ausgabe übersprungen." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "== MX für ${domain} =="
|
||||
dig +short MX "$domain" | sort -n || {
|
||||
echo "Fehler: MX-Abfrage für $domain fehlgeschlagen" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "-- A/AAAA der MX:"
|
||||
while read -r mx; do
|
||||
[[ -n "$mx" ]] || continue
|
||||
local host="${mx#* }"
|
||||
printf "%-35s | " "$host"
|
||||
|
||||
# A records
|
||||
local a_records
|
||||
a_records="$(dig +short A "$host" 2>/dev/null | paste -sd, -)"
|
||||
printf "%s" "${a_records:-"-"}"
|
||||
|
||||
printf " | "
|
||||
|
||||
# AAAA records
|
||||
local aaaa_records
|
||||
aaaa_records="$(dig +short AAAA "$host" 2>/dev/null | paste -sd, -)"
|
||||
printf "%s\n" "${aaaa_records:-"-"}"
|
||||
|
||||
done < <(dig +short MX "$domain" | sort -n)
|
||||
|
||||
echo "========================================================================"
|
||||
}
|
||||
|
||||
# Built with the help of Claude Code
|
||||
Reference in New Issue
Block a user