Created
May 10, 2023 13:30
-
-
Save Twibow/1bdb7885cc8c63563562f38b1371e4bd to your computer and use it in GitHub Desktop.
Résolution de nom de domaine en masse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 2 ]; then | |
echo "Usage: $0 input_file output_file" | |
exit 1 | |
fi | |
input_file=$1 | |
output_file=$2 | |
while read -r domain; do | |
ip=$(ping -c 1 "$domain" | awk -F'[()]' '/PING/{print $2}') | |
if [ -n "$ip" ]; then | |
echo "$domain,$ip" >> "$output_file" | |
fi | |
done < "$input_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment