#!/bin/bash FLANAGAN="5.75.131.131" source members.sh NUMGRP="${#MEMBERS[@]}" scriptdir="$(dirname "$0")" # Out file if [ "$1" = "" ]; then out="list.html" else out="$1" fi # Temporary file location TMPOUT="$(mktemp)" # Outputfile for statistics over time STATSOUT="$scriptdir/stats.txt" DATE="$(date '+%Y-%m-%d %H:%M %Z')" # Create head of output page in temp out cat "$scriptdir/head.html" > "$TMPOUT" printf '
Last updated %s
\n' "$DATE" >> "$TMPOUT" total_ipv4=0 total_ipv6=0 try_url() { curl --max-time 4 --connect-timeout 3 --resolve "*:443:$2" "$1" &>/dev/null } # Begin list of groups printf "Member | \n\tIPv4 | \n\tIPv6 | \n\tTLS report | \nno | " ipv6_report="no | " # Fetch DNS records dns="$(host "$hostname" "$FLANAGAN")" if printf '%s' "$dns" | grep -q "has address"; then dns_ipv4=true ipv4="$(printf '%s' "$dns" | sed -En '/has address/{s/^.* address //p;q}')" fi if printf '%s' "$dns" | grep -q "has IPv6 address"; then dns_ipv6=true ipv6="$(printf '%s' "$dns" | sed -En '/has IPv6 address/{s/^.* address //p;q}')" fi if [ $dns_ipv4 = false -a $dns_ipv6 = false ]; then continue fi # Try site over HTTPS if [ $dns_ipv4 = true ] && try_url "$https" "$ipv4"; then ((total_ipv4 ++)) has_ipv4=true fi if [ $dns_ipv6 = true ] && try_url "$https" "$ipv6"; then ((total_ipv6 ++)) has_ipv6=true fi ssltest="" if [ "$has_ipv4" = true -o "$has_ipv6" = true ]; then ssltest="analyze" fi if [ "$has_ipv4" = true ]; then ipv4_report="yes | " elif [ "$dns_ipv4" = true ]; then ipv4_report="no HTTPS | " fi if [ "$has_ipv6" = true ]; then ipv6_report="yes | " elif [ "$dns_ipv6" = true ]; then ipv6_report="no HTTPS | " fi if [ "$has_ipv4" = true -o "$has_ipv6" = true ]; then name="$i" else name="$i" fi printf '\t
---|---|---|---|
%s | %s%s%s |
Members with an IPv4 website: %s/%s
Members with an IPv6 website: %s/%s