From 7d68f4b5f7adf9b2338055baa5e0bd1073c103a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 21 Oct 2017 15:03:59 +0200 Subject: In surf-menu use getent instead of nslookup --- local/bin/surf-menu | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'local/bin/surf-menu') 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? -- cgit v1.2.3