Peignerpausz patch 1 #16
@@ -0,0 +1,80 @@
|
||||
# <scriptname>
|
||||
|
||||
Skript zur schnellen Abfrage historischer Domain-Records im json-Format. Zur Abfrage wird ein API-Key von Securitytrails.com benötigt.
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- Abfrage historischer DNS-Records inklusive TTLs und Prioritäten
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
1. Repository klonen oder Skript kopieren:
|
||||
```bash
|
||||
git clone git.int.loki-net.at/esn-support-bash-snippets.git
|
||||
cd esn-support-bash-snippets/domaintools/histodomain
|
||||
chmod +x histodomain
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Nutzung
|
||||
|
||||
### Standardaufruf
|
||||
```bash
|
||||
./histodomain.sh
|
||||
```
|
||||
|
||||
### Beispiele
|
||||
```bash
|
||||
./<scriptname> --option foo
|
||||
./<scriptname> 2025-09-08
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Optionen
|
||||
|
||||
```
|
||||
Usage: ./<scriptname> [OPTIONS]
|
||||
|
||||
--help Zeigt diese Hilfe
|
||||
--option Beispieloption
|
||||
YYYY-MM-DD Beispiel für Datumsargument
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Beispielausgabe
|
||||
|
||||
Hier ein Beispieloutput des Skripts.
|
||||
|
||||
```histodomain
|
||||
> Welche Domain?
|
||||
> domain.tld
|
||||
> Welcher DNS-Typ?
|
||||
> a
|
||||
> API-Key für Securitytrails angeben:
|
||||
```
|
||||
```
|
||||
---
|
||||
|
||||
## Setup-Hinweise
|
||||
|
||||
Falls notwendig, Alias in `~/.bashrc` setzen:
|
||||
```bash
|
||||
alias <scriptname>='~/pfad/zum/repo/domaintools/histodomain/histodomain.sh'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- Free-Version von Securitytrails ermöglicht bis zu 50 kostenlose Abpfragen über die API/Monat
|
||||
- To-Do
|
||||
- Non-interaktive Version bauen
|
||||
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# Domaintool zum Abfragen von historischen DNS-Einträgen über die Securitytrails-API
|
||||
# Maintainer: peignerpausz
|
||||
# Version: 1
|
||||
set -eou pipefail
|
||||
usage() {
|
||||
cat <<USAGE
|
||||
Verwendung:
|
||||
histodomain
|
||||
> Welche Domain? Domain ohne http oder https!
|
||||
> domain.tld
|
||||
> Welcher DNS-Typ? Eintrag in lower case!
|
||||
> a/aaaa/txt/ns/soa/...
|
||||
|
||||
USAGE
|
||||
}
|
||||
echo "Welche Domain? Achtung: Domain ohne http oder https! "
|
||||
read domain
|
||||
if [[ -z "$domain" ]]; then
|
||||
{
|
||||
echo -e "Fehler: keine Domain angegeben. \n" >&2
|
||||
usage
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
echo "Welcher DNS-Typ? Achtung: Eintrag in lower case! "
|
||||
read dnstype
|
||||
if [[ -z "$dnstype" ]]; then
|
||||
{
|
||||
echo -e "Fehler: keinen DNS-Typ angegeben. \n" >&2
|
||||
usage
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
# Prüfung ob Securitytrails-API-Key übergeben wurde oder als Umgebungsvariable existiert.
|
||||
if [[ -z "$SECURITYTRAILSAPI" ]]; then
|
||||
read -rsp "API-Key für Securitytrails angeben: " SECURITYTRAILSAPI
|
||||
echo
|
||||
fi
|
||||
# Hier folgt die eigentliche Abfrage über die Securitytrails-API.
|
||||
curl --request GET --url \
|
||||
https://api.securitytrails.com/v1/history/$domain/dns/$dnstype \
|
||||
--include --header "APIKEY: $SECURITYTRAILSAPI" --header 'Accept: application/json'
|
||||
Reference in New Issue
Block a user