2022-07-27 16:58:29 -06:00
|
|
|
#!/bin/bash
|
|
|
|
# Remove cloudflare instances from services-full.json
|
|
|
|
|
|
|
|
rm -f out.json
|
|
|
|
file="services-full.json"
|
|
|
|
|
|
|
|
while read -r line; do
|
|
|
|
if [[ "$line" == "\"https://"* ]]; then
|
|
|
|
domain=$(echo "$line" | sed -e "s/^\"https:\/\///" -e "s/\",//" -e "s/\"//")
|
2022-07-31 11:47:28 -06:00
|
|
|
ns=$(dig ns "$domain" || true)
|
2022-07-27 16:58:29 -06:00
|
|
|
if [[ "$ns" == *"cloudflare"* ]]; then
|
|
|
|
echo "\"$domain\" using cloudflare, skipping..."
|
2022-08-04 13:16:58 -06:00
|
|
|
elif [[ "$ns" != *"NOERROR"* ]]; then
|
2022-07-31 11:47:28 -06:00
|
|
|
echo "Unable to verify records for \"$domain\", skipping..."
|
2022-07-27 16:58:29 -06:00
|
|
|
else
|
|
|
|
echo "$line" >> out.json
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "$line" >> out.json
|
|
|
|
fi
|
|
|
|
done <$file
|
|
|
|
|
|
|
|
# Remove any trailing commas from new instance lists
|
2022-08-04 13:16:58 -06:00
|
|
|
sed -i -e ':begin' -e '$!N' -e 's/,\n]/\n]/g' -e 'tbegin' -e 'P' -e 'D' out.json
|
2022-07-27 16:58:29 -06:00
|
|
|
|
|
|
|
cat out.json | jq --indent 2 . > services.json
|
2022-07-31 11:47:28 -06:00
|
|
|
rm -f out.json
|