forked from LondheShubham153/Shell-Scripting-For-DevOps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp.https.dns.checking
More file actions
37 lines (27 loc) · 939 Bytes
/
Copy pathhttp.https.dns.checking
File metadata and controls
37 lines (27 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Define the path to the CSV file
CSV_FILE="websites.csv"
# Check if the CSV file exists
if [[ ! -f "$CSV_FILE" ]]; then
echo "CSV file not found: $CSV_FILE"
exit 1
fi
# Read the CSV file line by line
while IFS=, read -r dns
do
# Remove leading and trailing whitespaces (if any)
dns=$(echo "$dns" | xargs)
# Add www. prefix once
dns_with_www="www.$dns"
# Perform curl operation on the DNS entry
echo "Curling http://$dns"
curl -I "http://$dns" # Change to desired curl options
echo "Curling https://$dns"
curl -I "https://$dns" # Change to desired curl options
# Curling with www. prefix
echo "Curling http://$dns_with_www"
curl -I "http://$dns_with_www" # Change to desired curl options
echo "Curling https://$dns_with_www"
curl -I "https://$dns_with_www" # Change to desired curl options
done < "$CSV_FILE"
echo "All DNS entries have been processed."