Outils pour utilisateurs

Outils du site


Panneau latéral

dev:scripts:cloudbleed_check

cloudbleed_check

Suite à https://github.com/pirate/sites-using-cloudflare/blob/master/README.md
Petit script pour vérifier si une liste de domaines utilise cloudflare comme CDN
j'ai utilisé la fonction Print Preview de Keepass pour obtenir toutes les url et j'ai mis ça dans un fichier.

#!/bin/bash

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Auteur : Xanatos
# License : GPL-V3 - voir https://www.gnu.org/licenses/quick-guide-gplv3.html
# Nom: cloudbleed_check.sh
# Version : 0.1
# Date création : 24/02/17
# Date MAJ : 24/02/17
# Description : Ce script utilise l'interrogateur de DNS dig pour vérifier si 
# 	les url présentes dans un fichier utilisent cloudflare comme CDN
# 	à coupler avec keepass pour extraire URL par exemple

# Dépendances : dig, sed, grep
# Entrée(s) : fichier contenant les adresses à tester
# Sortie(s) : fichier des domaines concernés
# Usage : ./cloudbleed_check.sh fichier_adresses

INPUT="$1"
OUTPUT="./troué.txt"

# Parcourt du fichier, pour chaque ligne (chaque URL)
while read -r line ; do
	# On garde le domaine seulement
	line="$(echo "$line" | sed 's/^.*www.// ; s/^.*:\/\/// ; s/\/.*// ; s/:.*// ; s/#.*//')"
	# Test si sous-domaine autre que www
	test="$(echo "$line" | grep -o '\.' | grep -c "\.")"
	if [[ "$test" -ne 1 ]] ; then
		line="$(echo "$line" | sed '1,/[^.]*\./ s/[^.]*\.//')"
	fi
	echo "$line"
	# Interrogation du DNS avec dig
	if (dig "$line" NS +short | grep -q cloudflare) ; then
		echo "$line" >> "$OUTPUT"
	fi
done < "$INPUT"

exit 0

dev/scripts/cloudbleed_check.txt · Dernière modification: 2017/06/10 13:26 de xanatos