diff options
author | Karel Kočí <cynerd@email.cz> | 2017-10-21 15:03:59 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-10-21 15:03:59 +0200 |
commit | 7d68f4b5f7adf9b2338055baa5e0bd1073c103a7 (patch) | |
tree | 95c722b05d7d004279461d74a6cd348b650a1ccc /local | |
parent | fc2b873546980bfad62b54575cdb0d40fae895c3 (diff) | |
download | myconfigs-7d68f4b5f7adf9b2338055baa5e0bd1073c103a7.tar.gz myconfigs-7d68f4b5f7adf9b2338055baa5e0bd1073c103a7.tar.bz2 myconfigs-7d68f4b5f7adf9b2338055baa5e0bd1073c103a7.zip |
In surf-menu use getent instead of nslookup
Diffstat (limited to 'local')
-rwxr-xr-x | local/bin/surf-menu | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/local/bin/surf-menu b/local/bin/surf-menu index f4925f8..b2e0111 100755 --- a/local/bin/surf-menu +++ b/local/bin/surf-menu @@ -25,14 +25,12 @@ run() { LHOST="$(echo "$1" | sed -n 's#^[^:]*://##;s#^\([^/]\+\)/\?.*#\1#p')" LPATH="$(echo "$1" | sed 's#^[^:]*://##;s#^[^/]\+/\?##')" - # Try to lookup if it's an real address - # Note: This is hack because of youtube, nslookup return No answer but - # exists with 0. So I am checking if it returned more than one address - # (one address is for dns server). - if [ "$(nslookup "$LHOST" | grep 'Address:' | wc -l)" -le 1 ]; then # It's a real address - if nslookup "$LHOST.cz" >/dev/null; then # we can expand it with cz + if ! getent hosts "$LHOST" >/dev/null; then + if getent hosts "$LHOST.cz" >/dev/null; then LHOST="$LHOST.cz" - elif nslookup "$LHOST.com" >/dev/null; then # we can expand it with com + elif getent hosts "$LHOST.org" >/dev/null; then + LHOST="$LHOST.org" + elif getent hosts "$LHOST.com" >/dev/null; then LHOST="$LHOST.com" fi # TODO what to do when we can't expand it? |