From 6444a814b05317335d552f3e572d3f3a5df9c5d3 Mon Sep 17 00:00:00 2001 From: peignerpausz Date: Thu, 20 Aug 2026 14:10:03 +0200 Subject: [PATCH 1/2] Improved domainchecker.sh (non-interactive and interactive), various addendums to the documentation. --- domaintools/README.md | 70 ++++++++++++++++++ domaintools/domainchecker/domainchecker.sh | 86 +++++++++++++++------- domaintools/histodomain/README.md | 5 +- 3 files changed, 130 insertions(+), 31 deletions(-) create mode 100644 domaintools/README.md diff --git a/domaintools/README.md b/domaintools/README.md new file mode 100644 index 0000000..1d5f396 --- /dev/null +++ b/domaintools/README.md @@ -0,0 +1,70 @@ +# Domain Tools + +Sammlung von Bash-Skripten für diversen Abfragen zu Domains. Enthält Tools zur Massenabfrage von DNS-Einträgen sowie zur Anzeige historischer DNS-Einträge. + +--- + +### Inhaltsverzeichnis + +- [Übersicht](#Übersicht) +- [Enthaltene Tools](#enthaltene-Tools) +- [Voraussetzungen](#Voraussetzungen) +- [Lizenz/Sichtbarkeit](#lizenz--sichtbarkeit) + +--- + +## Übersicht + +****** + +--- + +## enthaltene Tools + +### [`domainchecker`](./domainchecker/) +Tool zur dig-Massenabfrage von Domains und DNS-Records. + +- [Dokumentation & Beispiele](./domainchecker/README.md) + +### [`histodomain`](./histodomain/) +Abfrage zu historischen DNS-Einträgen über die Securitytrails-API. + +- [Dokumentation & Beispiele](./histodomain/README.md) + +--- + +## Voraussetzungen + +### generelle Voraussetzungen +- kann auch von außerhalb der Connect genutzt werden, sofern eine lokale `bash` verwendbar ist +- **Kerberos-Setup**: Funktionierende Kerberos-Konfiguration +- **SSH-Zugriff**: Berechtigungen für easyname-Infrastruktur + +### Setup-Anleitung + +1. Kerberos-Ticket erstellen: + ```bash + kinit deinusername@NESSUS.AT + # oder mit go-Tool: + go kinit + ``` + +2. Tool in PATH hinzufügen oder Alias erstellen: + ```bash + # Option 1: Alias + alias domainchecker="/pfad/zu/domaintools/domainchecker/domainchecker.sh" + + # Option 2: Symlink + ln -s /pfad/zu/domaintools/domainchecker/domainchecker.sh ~/bin/domainchecker + ``` + +--- + +## Lizenz / Sichtbarkeit + +> Dieses Repository ist **intern** für easyname Support. +> Falls eine Freigabe nach extern geplant ist, bitte vorab mit Teamleitung abklären. + +--- + +*Diese Tools wurden mit Hilfe von Microsoft Copilot erstellt.* diff --git a/domaintools/domainchecker/domainchecker.sh b/domaintools/domainchecker/domainchecker.sh index f8cbf44..b4caafe 100644 --- a/domaintools/domainchecker/domainchecker.sh +++ b/domaintools/domainchecker/domainchecker.sh @@ -3,38 +3,68 @@ # Maintainer: peignerpausz # Version: 1.2 -set -eou pipefail +set -eo pipefail +declare -a DOMAINS=() +declare -a RECORDS=() + usage() { cat < Welche Domains sollen gesucht werden? - > domain1.tld domain2.tld domain3.tld ... - > Welcher Record soll untersucht werden? - > A/AAAA/MX/TXT/SOA/NS/... + Verwendung: + $0 [OPTIONEN] + Oder interaktiv: $0 + + Optionen: + -d, --domains DOMAIN [DOMAINS...] + Zu prüfende Domains + -r, --records RECORD [RECORDS...] + Zu prüfende DNS-Records, z.B. A MX TXT + -h, --help + Diese Hilfe anzeigen + + Beispiele: + $0 -d domain1.tld domain2.tld -r MX TXT + + $0 --domains domain1.tld domain2.tld --records MX TXT USAGE } -echo "Welche Domains sollen gesucht werden? " -read DOMAINS -if [[ -z "$DOMAINS" ]]; then - { - echo -e "Fehler: Bitte Domains einfügen. \n" >&2 +while [[ $# -gt 0 ]]; do + case "$1" in + -d | --domains) + shift + while [[ $# -gt 0 && "$1" != -* ]]; do + DOMAINS+=("$1") + shift + done + ;; + -r | --records) + shift + while [[ $# -gt 0 && "$1" != -* ]]; do + RECORDS+=("$1") + shift + done + ;; + -h | --help) usage - exit 1 - } -fi -echo "Welcher Record soll untersucht werden? " -read RECORD -if [[ -z "$RECORD" ]]; then - { - echo -e "Fehler: Bitte Record einsetzen. \n" >&2 - usage - exit 1 - } -fi -printf "\n" -for a in $DOMAINS; do - checker=$(dig +short $RECORD $a) - printf "+++Suchergebnisse für %s+++ \n%s\n %s\n====\n" "$a" "$checker" + exit 0 + ;; + esac +done + +[[ ${#DOMAINS[@]} -eq 0 ]] && read -ra DOMAINS -p "Welche Domains sollen gesucht werden? " DOMAINS +[[ ${#RECORDS[@]} -eq 0 ]] && read -ra RECORDS -p "Welcher Records sollen gesucht werden? " + +for domain in "${DOMAINS[@]}"; do + printf "\n==== %s ====\n" "$domain" + for record in "${RECORDS[@]}"; do + printf "++++ %s ++++\n" "$record" + + result=$(dig +short "$record" "$domain") + if [[ -n "$result" ]]; then + printf "%s" "$result" + else + printf "Keine Einträge gefunden." + fi + echo + done done diff --git a/domaintools/histodomain/README.md b/domaintools/histodomain/README.md index cb62721..e15ad81 100644 --- a/domaintools/histodomain/README.md +++ b/domaintools/histodomain/README.md @@ -1,4 +1,4 @@ -# +# histodomain - historische DNS-Abfragen Skript zur schnellen Abfrage historischer Domain-Records im json-Format. Zur Abfrage wird ein API-Key von Securitytrails.com benötigt. @@ -61,7 +61,7 @@ histodomain > a > API-Key für Securitytrails angeben: ``` -``` + --- ## Setup-Hinweise @@ -78,4 +78,3 @@ alias ='~/pfad/zum/repo/domaintools/histodomain/histodomain.sh' - Free-Version von Securitytrails ermöglicht bis zu 50 kostenlose Abpfragen über die API/Monat - To-Do - Non-interaktive Version bauen - -- 2.54.0 From 83c3b620e952065d15658d9792107787c583aeb2 Mon Sep 17 00:00:00 2001 From: peignerpausz Date: Thu, 20 Aug 2026 14:19:56 +0200 Subject: [PATCH 2/2] Updated Main README.md of Repo to reflect addition of new scripts. --- .update_backup_20260818_164802/README.md | 195 ++++++++ .update_backup_20260818_164802/install.sh | 518 ++++++++++++++++++++++ .update_backup_20260818_164802/update.sh | 248 +++++++++++ README.md | 15 +- legacy/wpchecker/wpchecker.sh | 19 + wh20/domainchecker/README.md | 279 ------------ wh20/domainchecker/domainchecker.sh | 8 - 7 files changed, 994 insertions(+), 288 deletions(-) create mode 100644 .update_backup_20260818_164802/README.md create mode 100755 .update_backup_20260818_164802/install.sh create mode 100755 .update_backup_20260818_164802/update.sh create mode 100644 legacy/wpchecker/wpchecker.sh delete mode 100644 wh20/domainchecker/README.md delete mode 100644 wh20/domainchecker/domainchecker.sh diff --git a/.update_backup_20260818_164802/README.md b/.update_backup_20260818_164802/README.md new file mode 100644 index 0000000..80ef9d9 --- /dev/null +++ b/.update_backup_20260818_164802/README.md @@ -0,0 +1,195 @@ +# esn-support-bash-snippets + +Sammel-Repository für Bash-Skripte des **easyname Support-Teams**. +Hier sammeln wir kleine Helfer für Log-Analysen, Automatisierungen und typische Support-Fälle. + +## Inhaltsverzeichnis + +- [Quick Start](#quick-start) +- [Übersicht](#übersicht) +- [Bash-Profile](#bash-profile) +- [Legacy Snippets](#legacy-snippets) +- [WH20 Snippets](#wh20-snippets) +- [Installation](#installation) +- [Updates](#updates) +- [How-To: Neues Skript anlegen](#how-to-neues-skript-anlegen) +- [Lizenz / Sichtbarkeit](#lizenz--sichtbarkeit) + + + +## Übersicht + +Die Skripte sind nach Kategorie getrennt: + +- [**Bashprofiles**](./bashprofiles/README.md) – Optimierte Bash-Konfigurationen +- [**Legacy**](./legacy/README.md) – Snippets für Legacy-Umgebungen (inkl. Connect Tools) +- [**WH20**](./wh20/README.md) – Snippets für WH20-Umgebungen + + +## Bash-Profile + +Optimierte Bash-Konfigurationen für verschiedene Support-Umgebungen: + +- [`pl`](./bashprofiles/pl) + → [Dokumentation & Beispiele](./bashprofiles/README.md) + Basis-Profil mit erweiterter History, farbigem Prompt und modularer Struktur + +## Legacy Snippets + +- [`checkms`](./legacy/checkms) + Analyse von Microsoft-spezifischen SMTP Fehlercodes (S3150, S775, S7771…) in den Exim-Logs. + +- [`go`](./legacy/go) + SSH-Shortcuts mit Kerberos-Auth für Web-, MX-, Logger- und Support-Server + +- [`pincMails`](./legacy/pincMails) + Sucht nach versendeten PINC Mails einer bestimmten Kundennummer und kopiert diese in einen lokalen Unterordner + +- [`exitrace`](./legacy/exitrace) + Exim-Log-Trace & Status für einzelne Mails/Adressen/Domain-Ziele mit Status-Klassifikation (OK/PARTIAL/DELAY/FAIL) + +## WH20 Snippets + +- [`plesk`](./wh20/plesk) + Dieses Skript stellt eine SSH-Verbindung zu einem angegebenen Webserver her und generiert so einen einmaligen Login-Link für das Plesk Admin Panel des gewünschten Servers. +- [`wh20`](./wh20) + Dieses Skript verbindet zum angegbenen Webserver via SSH +- [`adspam`](./adspam) + Dieses Skript ermöglicht die Prüfung auf geläufige MS365- und Spamhaus-Fehlermeldungen auf Adino-Servern direkt von der Connect aus. +- [`donaspam`](./donaspam) + Dieses Skript ermöglicht die Prüfung auf geläufige MS365- und Spamhaus-Fehlermeldungen auf inname-Servern direkt von der Connect aus. +- [`spamcheck`](./spamcheck) + Dieses Skript ermöglicht die Prüfung auf geläufige MS365- und Spamhaus-Fehlermeldungen auf einem Plesk-Server. +--- + +## Quick Start + +**One-liner Installation:** +```bash +git clone http://vps.dominikus.one:3000/ljp/esn-support-bash-snippets.git esn-support-tools && cd esn-support-tools && ./install.sh +``` + +**One-liner Update:** +```bash +cd esn-support-tools && ./update.sh +``` + +## Installation + +Nach dem Klonen des Repositories steht ein interaktives Installationsscript zur Verfügung: + +```bash +# Repository klonen +git clone http://vps.dominikus.one:3000/ljp/esn-support-bash-snippets.git + +# WICHTIG: Repository umbenennen (empfohlen) +mv esn-support-bash-snippets esn-support-tools +cd esn-support-tools + +# Installation testen (empfohlen) +./install.sh --dry-run + +# Installationsscript ausführen +./install.sh + +# Hilfe anzeigen +./install.sh --help +``` + +> **⚠️ Wichtiger Hinweis zu Symlinks:** +> Das Installationsscript erstellt Symlinks zu den Scripts im **aktuellen Repository-Pfad**. +> Wenn du das Repository später verschiebst oder umbenennst, funktionieren die installierten Tools nicht mehr. +> **Empfehlung:** Repository vor der Installation in einen permanenten Pfad legen (z.B. `~/tools/esn-support-tools`). + +## Updates + +Für Updates bestehender Installationen: + +```bash +# In Repository-Verzeichnis wechseln +cd /pfad/zu/esn-support-tools + +# Update testen (empfohlen) +./update.sh --dry-run + +# Update durchführen +./update.sh +``` + +**Features des Installers:** +- **Dry-Run Modus**: `--dry-run` testet Installation ohne Dateiveränderungen +- **Interaktive Auswahl**: Kategorien und einzelne Tools wählbar +- **Automatische Backups**: Vorhandene Dateien werden gesichert +- **Symlink-Management**: Tools werden in ~/bin verlinkt +- **LUSER-Setup**: Automatische Konfiguration für go-Tool +- **Modular erweiterbar**: Neue Tools einfach hinzufügbar + +**Verfügbare Kategorien:** +- **Bash-Profile**: .bashrc Optimierungen und modulare Konfiguration +- **Legacy Tools**: checkms, go, pincMails, exitrace für Legacy-Infrastruktur +- **WH20 Tools**: plesk für WH20-Infrastruktur + + + +## How-To: Neues Skript anlegen + +Um ein neues Bash-Skript in dieses Repository aufzunehmen, bitte folgende Schritte: + +1. **Ordnerstruktur anlegen** + Je nach Kategorie (`bashprofiles`, `legacy` oder `wh20`) einen Unterordner erstellen: + ``` + bashprofiles// + legacy// + wh20// + ``` + +2. **Skript hinzufügen** + Das eigentliche Skript im neuen Ordner ablegen: + ``` + legacy// + ``` + oder + ``` + wh20// + ``` + und ausführbar machen: + ```bash + chmod +x legacy//.sh + chmod +x wh20//.sh + ``` + +3. **README.md erstellen** + Als Basis das Template verwenden: + [README_template_script.md](./README_template.md) + → kopieren, anpassen und ins Skript-Verzeichnis legen: + ``` + legacy//README.md + ``` + oder + ``` + wh20//README.md + ``` + +4. **Übersicht aktualisieren** + Das Skript in die Übersicht der passenden Kategorie-README eintragen: + - [`bashprofiles/README.md`](./bashprofiles/README.md) + - [`legacy/README.md`](./legacy/README.md) + - [`wh20/README.md`](./wh20/README.md) + +5. **Install-Script erweitern** + Neue Tools zum `install.sh` hinzufügen für automatische Installation + +6. **Commit & Push** + Änderungen ins Repo übernehmen: + ```bash + git add . + git commit -m "Add to " + git push + ``` + + + +## Lizenz / Sichtbarkeit + +> Dieses Repository ist **intern** für easyname Support. +> Falls eine Freigabe nach extern geplant ist, bitte vorab mit Teamleitung abklären. diff --git a/.update_backup_20260818_164802/install.sh b/.update_backup_20260818_164802/install.sh new file mode 100755 index 0000000..5fd2bd6 --- /dev/null +++ b/.update_backup_20260818_164802/install.sh @@ -0,0 +1,518 @@ +#!/usr/bin/env bash +# install.sh - Installationsscript für easyname Support Bash-Snippets +# Maintainer: ljp +# Modular erweiterbar für neue Tools und Kategorien + +set -euo pipefail + +# Farben für Output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +NC='\033[0m' # No Color + +# Script-Verzeichnis ermitteln +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Dry-run Modus +DRY_RUN=false + +# Logging-Funktionen +log_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +log_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +log_dry_run() { + echo -e "${YELLOW}[DRY-RUN]${NC} $1" +} + +# Auto-Discovery Funktionen +discover_scripts() { + local category="$1" + local scripts=() + + if [[ ! -d "$SCRIPT_DIR/$category" ]]; then + echo "0" + return + fi + + # Finde alle .sh Dateien in Unterverzeichnissen + while IFS= read -r -d '' script; do + # Extrahiere Scriptname und Verzeichnis + local script_dir="$(dirname "$script")" + local script_name="$(basename "$script_dir")" + local script_file="$(basename "$script")" + + # Überspringe wenn Script-Name nicht dem Verzeichnis entspricht + if [[ "$script_file" == "$script_name.sh" ]]; then + scripts+=("$script_name:$script") + fi + done < <(find "$SCRIPT_DIR/$category" -name "*.sh" -type f -print0 2>/dev/null) + + # Rückgabe: Anzahl:script1:path1:script2:path2... + local result="${#scripts[@]}" + for script_info in "${scripts[@]}"; do + result="$result:$script_info" + done + echo "$result" +} + +get_script_description() { + local category="$1" + local script_name="$2" + + # Versuche Beschreibung aus README zu extrahieren + local readme="$SCRIPT_DIR/$category/$script_name/README.md" + if [[ -f "$readme" ]]; then + # Erste Zeile nach "# scriptname" + grep -A 2 "^# $script_name" "$readme" 2>/dev/null | tail -n 1 | sed 's/^[[:space:]]*//' + else + # Fallback: Erste Kommentarzeile aus Script + local script_file="$SCRIPT_DIR/$category/$script_name/$script_name.sh" + grep -m 1 "^# " "$script_file" 2>/dev/null | sed 's/^# //' || echo "Keine Beschreibung verfügbar" + fi +} + +# Hilfsfunktionen +backup_file() { + local file="$1" + if [[ -f "$file" ]]; then + local backup="${file}.backup.$(date +%Y%m%d_%H%M%S)" + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde Backup erstellen: $backup" + else + cp "$file" "$backup" + log_info "Backup erstellt: $backup" + fi + fi +} + +create_symlink() { + local src="$1" + local dest="$2" + local name="$3" + + if [[ -L "$dest" ]]; then + log_warning "$name bereits als Symlink vorhanden, überspringe" + return 0 + fi + + if [[ -f "$dest" ]]; then + backup_file "$dest" + fi + + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde Symlink erstellen: $dest -> $src" + else + ln -sf "$src" "$dest" + log_success "$name symlink erstellt: $dest -> $src" + fi +} + +make_executable() { + local file="$1" + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde ausführbar machen: $file" + else + chmod +x "$file" + log_info "$file ausführbar gemacht" + fi +} + +# Installation: Bash-Profile +install_bashprofiles() { + log_info "=== Bash-Profile Installation ===" + + echo -e "\n${PURPLE}Verfügbare Profile:${NC}" + echo "1) h0tznpl0tz (pl) - Optimiertes Basis-Profil" + echo "0) Überspringen" + + read -p "Profil auswählen [0-1]: " profile_choice + + case "$profile_choice" in + 1) + log_info "Installiere h0tznpl0tz Bash-Profil..." + backup_file "$HOME/.bashrc" + + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde kopieren: $SCRIPT_DIR/bashprofiles/pl/.bashrc -> $HOME/.bashrc" + log_dry_run "Würde erstellen: ~/.bash_aliases (falls nicht vorhanden)" + log_dry_run "Würde erstellen: ~/.bash_env (falls nicht vorhanden)" + log_dry_run "Würde erstellen: ~/.bash_paths (falls nicht vorhanden)" + else + cp "$SCRIPT_DIR/bashprofiles/pl/.bashrc" "$HOME/.bashrc" + + # Modulare Dateien erstellen falls nicht vorhanden + [[ ! -f "$HOME/.bash_aliases" ]] && touch "$HOME/.bash_aliases" + [[ ! -f "$HOME/.bash_env" ]] && touch "$HOME/.bash_env" + [[ ! -f "$HOME/.bash_paths" ]] && touch "$HOME/.bash_paths" + + log_success "Bash-Profil installiert" + fi + log_info "Hinweis: Setze LUSER in ~/.bash_env für go-Tool" + ;; + 0) + log_info "Bash-Profile übersprungen" + ;; + *) + log_error "Ungültige Auswahl" + ;; + esac +} + +# Generische Script-Installation +install_script() { + local category="$1" + local script_name="$2" + local script_path="$3" + + log_info "Installiere $script_name..." + + # Spezielle Behandlung für go-Tool (LUSER check) + if [[ "$script_name" == "go" ]]; then + if [[ -z "${LUSER:-}" ]]; then + log_warning "LUSER Umgebungsvariable nicht gesetzt" + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde nach LUSER fragen und in ~/.bash_env schreiben" + log_dry_run "Beispiel: export LUSER=\"username\" >> ~/.bash_env" + else + read -p "LUSER eingeben (für Kerberos): " user_input + if [[ -n "$user_input" ]]; then + echo "export LUSER=\"$user_input\"" >> "$HOME/.bash_env" + export LUSER="$user_input" + log_success "LUSER in ~/.bash_env gesetzt" + fi + fi + else + log_info "LUSER bereits gesetzt: $LUSER" + fi + fi + + # Script ausführbar machen + make_executable "$script_path" + + # Symlink erstellen + ensure_bin_dir + create_symlink "$script_path" "$HOME/bin/$script_name" "$script_name-Tool" + + log_success "$script_name installiert" +} + +ensure_bin_dir() { + if [[ ! -d "$HOME/bin" ]]; then + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde Verzeichnis erstellen: ~/bin" + log_dry_run "Würde PATH erweitern: export PATH=\"\$HOME/bin:\$PATH\" >> ~/.bash_paths" + else + log_info "~/bin existiert nicht. Erstelle Verzeichnis..." + mkdir -p "$HOME/bin" + log_info "Füge ~/bin zu PATH hinzu (in ~/.bash_paths)" + echo 'export PATH="$HOME/bin:$PATH"' >> "$HOME/.bash_paths" + fi + fi +} + +# Installation: Connect Tools +install_connect() { + log_info "=== Connect Tools Installation ===" + + # Auto-discover verfügbare Scripts + local discovery_result + discovery_result=$(discover_scripts "connect") + + local script_count + script_count=$(echo "$discovery_result" | cut -d':' -f1) + + if [[ "$script_count" -eq 0 ]]; then + log_info "Keine Connect Tools gefunden" + return + fi + + echo -e "\n${PURPLE}Verfügbare Tools:${NC}" + + # Parse discovery result und zeige Menu + local scripts=() + local counter=1 + IFS=':' read -ra PARTS <<< "$discovery_result" + for ((i=1; i<${#PARTS[@]}; i+=2)); do + local script_name="${PARTS[i]}" + local script_path="${PARTS[i+1]}" + local description + description=$(get_script_description "connect" "$script_name") + + echo "$counter) $script_name - $description" + scripts+=("$script_name:$script_path") + ((counter++)) + done + + echo "$counter) Alle Connect Tools" + echo "0) Überspringen" + + read -p "Tools auswählen [0-$counter]: " connect_choice + + if [[ "$connect_choice" -eq 0 ]]; then + log_info "Connect Tools übersprungen" + elif [[ "$connect_choice" -eq "$counter" ]]; then + # Alle installieren + for script_info in "${scripts[@]}"; do + IFS=':' read -r script_name script_path <<< "$script_info" + install_script "connect" "$script_name" "$script_path" + done + elif [[ "$connect_choice" -ge 1 && "$connect_choice" -lt "$counter" ]]; then + # Einzelnes Tool installieren + local selected_script="${scripts[$((connect_choice-1))]}" + IFS=':' read -r script_name script_path <<< "$selected_script" + install_script "connect" "$script_name" "$script_path" + else + log_error "Ungültige Auswahl" + fi +} + +# Installation: Legacy Tools +install_legacy() { + log_info "=== Legacy Tools Installation ===" + + # Auto-discover verfügbare Scripts + local discovery_result + discovery_result=$(discover_scripts "legacy") + + local script_count + script_count=$(echo "$discovery_result" | cut -d':' -f1) + + if [[ "$script_count" -eq 0 ]]; then + log_info "Keine Legacy Tools gefunden" + return + fi + + echo -e "\n${PURPLE}Verfügbare Tools:${NC}" + + # Parse discovery result und zeige Menu + local scripts=() + local counter=1 + IFS=':' read -ra PARTS <<< "$discovery_result" + for ((i=1; i<${#PARTS[@]}; i+=2)); do + local script_name="${PARTS[i]}" + local script_path="${PARTS[i+1]}" + local description + description=$(get_script_description "legacy" "$script_name") + + echo "$counter) $script_name - $description" + scripts+=("$script_name:$script_path") + ((counter++)) + done + + echo "$counter) Alle Legacy Tools" + echo "0) Überspringen" + + read -p "Tools auswählen [0-$counter]: " legacy_choice + + if [[ "$legacy_choice" -eq 0 ]]; then + log_info "Legacy Tools übersprungen" + elif [[ "$legacy_choice" -eq "$counter" ]]; then + # Alle installieren + for script_info in "${scripts[@]}"; do + IFS=':' read -r script_name script_path <<< "$script_info" + install_legacy_script "$script_name" "$script_path" + done + elif [[ "$legacy_choice" -ge 1 && "$legacy_choice" -lt "$counter" ]]; then + # Einzelnes Tool installieren + local selected_script="${scripts[$((legacy_choice-1))]}" + IFS=':' read -r script_name script_path <<< "$selected_script" + install_legacy_script "$script_name" "$script_path" + else + log_error "Ungültige Auswahl" + fi +} + +# Spezielle Legacy Script Installation (für quicknav Behandlung) +install_legacy_script() { + local script_name="$1" + local script_path="$2" + + log_info "Installiere $script_name..." + + if [[ "$script_name" == "quicknav" ]]; then + # quicknav ist eine Bash-Funktion, keine Binary + log_warning "quicknav ist eine Bash-Funktion und muss manuell in .bashrc eingebunden werden" + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde Hinweis anzeigen: source \"$script_path\" zu ~/.bashrc hinzufügen" + else + log_info "Füge folgende Zeile zu ~/.bashrc hinzu:" + echo -e "${YELLOW}source \"$script_path\"${NC}" + fi + else + # Normale Script Installation + install_script "legacy" "$script_name" "$script_path" + fi +} + +# Installation: WH20 Tools +install_wh20() { + log_info "=== WH20 Tools Installation ===" + + # Auto-discover verfügbare Scripts + local discovery_result + discovery_result=$(discover_scripts "wh20") + + local script_count + script_count=$(echo "$discovery_result" | cut -d':' -f1) + + if [[ "$script_count" -eq 0 ]]; then + log_info "Noch keine WH20 Tools verfügbar" + return + fi + + echo -e "\n${PURPLE}Verfügbare Tools:${NC}" + + # Parse discovery result und zeige Menu + local scripts=() + local counter=1 + IFS=':' read -ra PARTS <<< "$discovery_result" + for ((i=1; i<${#PARTS[@]}; i+=2)); do + local script_name="${PARTS[i]}" + local script_path="${PARTS[i+1]}" + local description + description=$(get_script_description "wh20" "$script_name") + + echo "$counter) $script_name - $description" + scripts+=("$script_name:$script_path") + ((counter++)) + done + + echo "$counter) Alle WH20 Tools" + echo "0) Überspringen" + + read -p "Tools auswählen [0-$counter]: " wh20_choice + + if [[ "$wh20_choice" -eq 0 ]]; then + log_info "WH20 Tools übersprungen" + elif [[ "$wh20_choice" -eq "$counter" ]]; then + # Alle installieren + for script_info in "${scripts[@]}"; do + IFS=':' read -r script_name script_path <<< "$script_info" + install_script "wh20" "$script_name" "$script_path" + done + elif [[ "$wh20_choice" -ge 1 && "$wh20_choice" -lt "$counter" ]]; then + # Einzelnes Tool installieren + local selected_script="${scripts[$((wh20_choice-1))]}" + IFS=':' read -r script_name script_path <<< "$selected_script" + install_script "wh20" "$script_name" "$script_path" + else + log_error "Ungültige Auswahl" + fi +} + +# Hilfsfunktion +show_help() { + cat </dev/null 2>&1; then + log_error "git ist erforderlich aber nicht installiert" + exit 1 + fi + + while true; do + show_menu + read -p "Auswahl treffen [0-5]: " choice + + case "$choice" in + 1) install_bashprofiles ;; + 2) install_connect ;; + 3) install_legacy ;; + 4) install_wh20 ;; + 5) + install_bashprofiles + install_connect + install_legacy + install_wh20 + ;; + 0) + log_success "Installation beendet" + echo -e "\n${YELLOW}Hinweis: Starte eine neue Shell oder führe 'source ~/.bashrc' aus${NC}" + exit 0 + ;; + *) + log_error "Ungültige Auswahl" + ;; + esac + + echo -e "\n${BLUE}Drücke Enter für Hauptmenü...${NC}" + read -r + done +} + +# Script starten +main "$@" \ No newline at end of file diff --git a/.update_backup_20260818_164802/update.sh b/.update_backup_20260818_164802/update.sh new file mode 100755 index 0000000..667011c --- /dev/null +++ b/.update_backup_20260818_164802/update.sh @@ -0,0 +1,248 @@ +#!/usr/bin/env bash +# update.sh - Update-Script für easyname Support Bash-Snippets +# Maintainer: ljp +# Aktualisiert Repository und re-linkt installierte Tools + +set -euo pipefail + +# Farben für Output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +NC='\033[0m' # No Color + +# Script-Verzeichnis ermitteln +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Dry-run Modus +DRY_RUN=false + +# Logging-Funktionen +log_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +log_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +log_dry_run() { + echo -e "${YELLOW}[DRY-RUN]${NC} $1" +} + +# Hilfsfunktionen +check_git_repo() { + if [[ ! -d "$SCRIPT_DIR/.git" ]]; then + log_error "Kein Git-Repository gefunden in $SCRIPT_DIR" + log_error "Bitte das Repository ordnungsgemäß klonen!" + exit 1 + fi +} + +backup_current_state() { + local backup_dir="$SCRIPT_DIR/.update_backup_$(date +%Y%m%d_%H%M%S)" + + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde Backup erstellen: $backup_dir" + return + fi + + log_info "Erstelle Backup des aktuellen Zustands..." + mkdir -p "$backup_dir" + + # Backup wichtiger Dateien falls sie modifiziert wurden + for file in "install.sh" "update.sh" "README.md"; do + if [[ -f "$SCRIPT_DIR/$file" ]]; then + cp "$SCRIPT_DIR/$file" "$backup_dir/" + fi + done + + log_success "Backup erstellt: $backup_dir" +} + +update_repository() { + log_info "Aktualisiere Repository..." + + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde ausführen: git fetch origin" + log_dry_run "Würde ausführen: git pull origin main" + return + fi + + # Fetch latest changes + if ! git fetch origin; then + log_error "Fehler beim Fetch der Remote-Änderungen" + exit 1 + fi + + # Check if updates available + local local_commit + local_commit=$(git rev-parse HEAD) + local remote_commit + remote_commit=$(git rev-parse origin/main) + + if [[ "$local_commit" == "$remote_commit" ]]; then + log_info "Repository ist bereits auf dem neuesten Stand" + return 0 + fi + + log_info "Updates gefunden, führe Pull durch..." + if ! git pull origin main; then + log_error "Fehler beim Pull der Änderungen" + log_error "Bitte manuell lösen und erneut versuchen" + exit 1 + fi + + log_success "Repository erfolgreich aktualisiert" + return 1 # Updates wurden angewendet +} + +find_installed_tools() { + local installed_tools=() + + # Suche nach Symlinks in ~/bin die auf dieses Repository zeigen + if [[ -d "$HOME/bin" ]]; then + while IFS= read -r -d '' symlink; do + local target + target=$(readlink "$symlink") + + # Prüfe ob Symlink auf dieses Repository zeigt + if [[ "$target" == "$SCRIPT_DIR"* ]]; then + local tool_name + tool_name=$(basename "$symlink") + installed_tools+=("$tool_name:$target") + fi + done < <(find "$HOME/bin" -type l -print0 2>/dev/null || true) + fi + + printf '%s\n' "${installed_tools[@]}" +} + +relink_tools() { + log_info "Suche installierte Tools..." + + local installed_tools + mapfile -t installed_tools < <(find_installed_tools) + + if [[ ${#installed_tools[@]} -eq 0 ]]; then + log_info "Keine installierten Tools gefunden" + return + fi + + log_info "Gefundene Tools: ${#installed_tools[@]}" + + for tool_info in "${installed_tools[@]}"; do + IFS=':' read -r tool_name old_target <<< "$tool_info" + local symlink_path="$HOME/bin/$tool_name" + + log_info "Aktualisiere Symlink für: $tool_name" + + if [[ "$DRY_RUN" == "true" ]]; then + log_dry_run "Würde Symlink aktualisieren: $symlink_path -> $old_target" + else + # Symlink neu erstellen (aktualisiert automatisch den Pfad) + ln -sf "$old_target" "$symlink_path" + log_success "$tool_name Symlink aktualisiert" + fi + done +} + +# Hilfsfunktion +show_help() { + cat </esn-support-bash-snippets.git - cd esn-support-bash-snippets// - chmod +x - ``` - -2. Abhängigkeiten (falls vorhanden) installieren: - - `jq` (optional) - - weitere Tools - ---- - -## Nutzung - -### Standardaufruf -```bash -./domainchecker.sh -``` - -### Beispiele -```bash -for a in filmkontor.at sense-and-soul.at sense-and-soul.com mgoe.at mgoe.immo liahov.at veronikastoeger.eu morningkind.com audioraevents.com bcg-papers.at lylynails.at montafoner-wollwerkstatt-shop.at hmvc.at martingansberger.com soleman.at soleman-shoes.at soleman-shoes.de soleman-shoes.com puventuregroup.at puventuregroup.de puventuregroup.com globale-perspektive.at floraswebwerkstatt.at floraswebwerkstatt.com lechner-studios.de parvinrazavi.at parvinrazavi.com fv16.lu lenz-honorarberatung.at lenz-honorarberatung.com sieglspub.co.at rheintalpraxis.ch rheintal-homöopathie.ch synstro.at medstro.at tecstro.at oefrd.eu hp-rohrreinigung.at batjaferch.com 6gforum.at rbl-consult.com mozzarellaranch.at agentsie.at simoneammarkt.at oglatz-fenster.at billboard-games.at ai4u.at secondunit.at 2ndunit.at oscarperfume.at vitalone.eu ikigai-vienna.at ikigai-europe.com puvg.at puvg.de psychotherapie-weihsengruber.at seitenwind.at creativem.at muck.one beesecure.at siebenunddrei.com audiovision-eventtechnik.at crashncreate.com wizia.at waschfach.at ateliervagant.com; do domain=$(dig +short A mail-in.$a); printf "%s MX-Records: \n⤷%s\n====\n" "$a" "$domain"; done -filmkontor.at MX-Records: -⤷ -==== -sense-and-soul.at MX-Records: -⤷91.151.18.26 -==== -sense-and-soul.com MX-Records: -⤷91.151.18.26 -==== -mgoe.at MX-Records: -⤷91.151.18.28 -==== -mgoe.immo MX-Records: -⤷91.151.18.28 -==== -liahov.at MX-Records: -⤷ -==== -veronikastoeger.eu MX-Records: -⤷64.29.17.65 -64.29.17.1 -==== -morningkind.com MX-Records: -⤷91.151.18.37 -==== -audioraevents.com MX-Records: -⤷ -==== -bcg-papers.at MX-Records: -⤷91.151.18.29 -==== -lylynails.at MX-Records: -⤷ -==== -montafoner-wollwerkstatt-shop.at MX-Records: -⤷ -==== -hmvc.at MX-Records: -⤷91.151.18.34 -==== -martingansberger.com MX-Records: -⤷91.151.18.36 -==== -soleman.at MX-Records: -⤷ -==== -soleman-shoes.at MX-Records: -⤷ -==== -soleman-shoes.de MX-Records: -⤷ -==== -soleman-shoes.com MX-Records: -⤷ -==== -puventuregroup.at MX-Records: -⤷ -==== -puventuregroup.de MX-Records: -⤷ -==== -puventuregroup.com MX-Records: -⤷ -==== -globale-perspektive.at MX-Records: -⤷91.151.18.34 -==== -floraswebwerkstatt.at MX-Records: -⤷91.151.18.35 -==== -floraswebwerkstatt.com MX-Records: -⤷91.151.18.35 -==== -lechner-studios.de MX-Records: -⤷ -==== -parvinrazavi.at MX-Records: -⤷ -==== -parvinrazavi.com MX-Records: -⤷ -==== -fv16.lu MX-Records: -⤷ -==== -lenz-honorarberatung.at MX-Records: -⤷ -==== -lenz-honorarberatung.com MX-Records: -⤷ -==== -sieglspub.co.at MX-Records: -⤷91.151.18.37 -==== -rheintalpraxis.ch MX-Records: -⤷91.151.18.35 -==== -rheintal-homöopathie.ch MX-Records: -⤷ -==== -synstro.at MX-Records: -⤷ -==== -medstro.at MX-Records: -⤷ -==== -tecstro.at MX-Records: -⤷ -==== -oefrd.eu MX-Records: -⤷91.151.18.30 -==== -hp-rohrreinigung.at MX-Records: -⤷ -==== -batjaferch.com MX-Records: -⤷91.151.18.36 -==== -6gforum.at MX-Records: -⤷185.3.235.176 -==== -rbl-consult.com MX-Records: -⤷ -==== -mozzarellaranch.at MX-Records: -⤷ -==== -agentsie.at MX-Records: -⤷ -==== -simoneammarkt.at MX-Records: -⤷91.151.18.37 -==== -oglatz-fenster.at MX-Records: -⤷91.151.18.34 -==== -billboard-games.at MX-Records: -⤷ -==== -ai4u.at MX-Records: -⤷91.151.18.37 -==== -secondunit.at MX-Records: -⤷ -==== -2ndunit.at MX-Records: -⤷ -==== -oscarperfume.at MX-Records: -⤷ -==== -vitalone.eu MX-Records: -⤷91.151.18.29 -==== -ikigai-vienna.at MX-Records: -⤷ -==== -ikigai-europe.com MX-Records: -⤷ -==== -puvg.at MX-Records: -⤷ -==== -puvg.de MX-Records: -⤷ -==== -psychotherapie-weihsengruber.at MX-Records: -⤷91.151.18.35 -==== -seitenwind.at MX-Records: -⤷ -==== -creativem.at MX-Records: -⤷91.151.18.37 -==== -muck.one MX-Records: -⤷91.151.18.37 -==== -beesecure.at MX-Records: -⤷ -==== -siebenunddrei.com MX-Records: -⤷91.151.18.22 -==== -audiovision-eventtechnik.at MX-Records: -⤷91.151.18.28 -==== -crashncreate.com MX-Records: -⤷91.151.18.26 -==== -wizia.at MX-Records: -⤷ -==== -waschfach.at MX-Records: -⤷91.151.18.30 -==== -ateliervagant.com MX-Records: -⤷ -==== - -``` - ---- - -## Optionen - -``` -Usage: ./ [OPTIONS] - ---help Zeigt diese Hilfe ---option Beispieloption -YYYY-MM-DD Beispiel für Datumsargument -``` - ---- - -## Beispielausgabe - -``` -Hier ein Beispieloutput des Skripts. -``` - ---- - -## Setup-Hinweise - -Falls notwendig, Alias in `~/.bashrc` setzen: -```bash -alias ='~/pfad/zum/repo///' -``` - -Logger-spezifisch ggf. in `~/.profile` ergänzen: -```bash -cd /var/log/easyname/$(date +%Y)/$(date +%m)/ -``` - ---- - -## Notes - -- Weitere Hinweise, Einschränkungen, Besonderheiten -- Ggf. bekannte Bugs oder ToDos diff --git a/wh20/domainchecker/domainchecker.sh b/wh20/domainchecker/domainchecker.sh deleted file mode 100644 index 4df2929..0000000 --- a/wh20/domainchecker/domainchecker.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env bash -# Domainchecker für schnelle Prüfung der MX-Records -# Maintainer: peignerpausz - -for a in domains - do domain=$(dig +short MX $a) - printf "%s MX-Records: \n⤷%s\n ⤷%s\n====\n" "$a" "$domain" -done \ No newline at end of file -- 2.54.0