Geoffrey Frogeye
171fa93873
Even if redirected to a file Allow to see progress when ran in a cron or something
25 lines
947 B
Bash
Executable file
25 lines
947 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
source .env.default
|
|
source .env
|
|
|
|
function log() {
|
|
echo -e "\033[33m$@\033[0m"
|
|
}
|
|
|
|
log "Compiling nameservers…"
|
|
pv -f nameservers/*.list | ./validate_list.py --ip4 | sort -u > temp/all_nameservers_ip4.list
|
|
|
|
log "Compiling subdomains…"
|
|
# Sort by last character to utilize the DNS server caching mechanism
|
|
# (not as efficient with massdns but it's almost free so why not)
|
|
pv -f subdomains/*.list | ./validate_list.py --domain | rev | sort -u | rev > temp/all_subdomains.list
|
|
|
|
log "Resolving subdomain…"
|
|
date +%s > "last_updates/massdns.txt"
|
|
"$MASSDNS_BINARY" --output Snrql --retry REFUSED,SERVFAIL --hashmap-size "$MASSDNS_HASHMAP_SIZE" --resolvers temp/all_nameservers_ip4.list --outfile temp/all_resolved.txt temp/all_subdomains.list
|
|
|
|
log "Importing into database…"
|
|
[ $SINGLE_PROCESS -eq 1 ] && EXTRA_ARGS="--single-process"
|
|
pv -f temp/all_resolved.txt | ./feed_dns.py massdns --ip4-cache "$CACHE_SIZE" $EXTRA_ARGS
|