#!/bin/sh OPENNIC='servers.opennic.org' get_html_opennic() { printf '%s\n' "Getting IPv4 addresses from $OPENNIC" >&2 openssl s_client -crlf -quiet -connect "$OPENNIC":443 -servername "$OPENNIC" 2>/dev/null <<- EOF GET / HTTP/1.1 Host: ${OPENNIC} Cache-Control: max-age=0 sec-ch-ua: "Chromium";v="95", ";Not A Brand";v="99" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Linux" Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Sec-Fetch-Site: cross-site Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Referer: https://wiki.ircnow.org/ Accept-Language: en-US,en;q=0.9 Connection: keep-alive EOF } get_html_opennic | grep -Eo 'mono ipv4[^>]*>([0-9]+\.){3}[0-9]+' | sed -e 's/.*>//' -e 's/.*/forward-addr: &/'