Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_dnslookup.sh - host command does not work with CNAME #2

Open
koppenho opened this issue Jan 24, 2021 · 0 comments
Open

_dnslookup.sh - host command does not work with CNAME #2

koppenho opened this issue Jan 24, 2021 · 0 comments

Comments

@koppenho
Copy link

The command
host -t A api.opennicproject.org
currently outputs

api.opennicproject.org is an alias for api.opennic.org.
api.opennic.org has address 116.203.98.109

Unfortunately the awk filter does not recognize the address because it is looking for "api.opennicproject.org" and "has address" in the same line.

In my docker container is only nslookup available. Therefore I have added the following lines which also have to deal with multiline filtering.

if which nslookup > /dev/null 2> /dev/null; then
    nslookup -type=a api.opennicproject.org "$1" | awk '$1=="Name:"{s=1;next} s == 1 && $1 == "Address:" { print $2; exit; } { s=0; }'
    return 0
fi

At least this is working on my Linux test servers. I would be happy if you add my code to the script.
May I suggest to rewrite the host-awk-pipeline in a similar manner?

Greetings from Germany
Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant