2019-03-02 14:51:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-09-14 12:31:49 +00:00
|
|
|
# This script runs a scan for all available TLDs, and notes
|
|
|
|
# down the TLDs that resolve to `website/template.md`
|
2020-04-27 05:48:07 +00:00
|
|
|
#
|
2019-09-14 12:31:49 +00:00
|
|
|
# It also puts some information about the IP Adress from where
|
|
|
|
# the scan was run (might be relevant for DNS lookups) into
|
|
|
|
# `website/_data/ip.json`. Structure is at ipapi.co
|
2019-03-02 14:51:04 +00:00
|
|
|
|
2020-04-27 05:48:07 +00:00
|
|
|
for domain in $(grep -v '^#' tlds.txt); do
|
|
|
|
RESULT=$(dig +time=1 +tries=1 +short "$domain." | head -c -1 | tr '\n' '@' | sed 's/@/`,`/g' | grep -v "connection timed out")
|
2019-09-14 12:31:49 +00:00
|
|
|
if [ ! -z "$RESULT" ]; then
|
|
|
|
echo $domain
|
|
|
|
DOMAIN_REAL="$domain"
|
|
|
|
# Very crude regex for punycode domains
|
|
|
|
if [[ $(echo "$domain" | grep -E "^XN--[[:upper:]]+$") ]]; then
|
|
|
|
DOMAIN_REAL=$(idn --idna-to-unicode "$domain")
|
|
|
|
fi
|
|
|
|
echo "|$DOMAIN_REAL|$domain|[http](http://$domain)|[https](https://$domain)|\`$RESULT\`|" >> template.md
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
curl 'https://ipapi.co/yaml/' > website/_data/ip.json
|
|
|
|
|
|
|
|
echo >> template.md
|
2020-04-27 05:48:07 +00:00
|
|
|
echo "This scan was last run on $(date)" >> template.md
|