Added line parsing

master
Keith Irwin 2022-10-03 11:20:04 -06:00
parent 6811948344
commit 69bfb044f5
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 8 additions and 1 deletions

View File

@ -29,5 +29,12 @@ res="$("${LIB_DIR:?}/ns_lookup_rxfr")" || exit 4
# This should read from stdin
while IFS= read -r line; do
printf 'Checking line %s.\n' "${line}"
<<<"${res}" grep -B1 " ${line}" >>"${LOGFILE}"
pubkey="$(<<<"${line}" cut -d ' ' -f1)"
ips="$(<<<"${line}" cut -d ' ' -f2 | tr ' ' '\n')"
ipv4="$(<<<"${ips}" grep '\.')"
ipv6="$(<<<"${ips}" grep ':')"
ipv4="${ipv4%%/*}"
ipv6="${ipv6%%/*}"
<<<"${res}" grep -B1 " ${ipv4}" >>"${LOGFILE}"
<<<"${res}" grep -B1 " ${ipv6}" >>"${LOGFILE}"
done