summaryrefslogtreecommitdiffstats
path: root/Reaktor
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-08-28 08:50:06 +0200
committermakefu <github@syntax-fehler.de>2015-08-28 08:50:06 +0200
commit31dd24af3e6721d1763b85ace640517024de39f2 (patch)
treefda76ce29417e71f00b6d76e25b72cf297ef63f9 /Reaktor
parentf1be3f6d1e4e864b195db3527fecdb53eb2f02dd (diff)
Reaktor/whatweb: also check for path"
Diffstat (limited to 'Reaktor')
-rwxr-xr-xReaktor/commands/whatweb16
1 files changed, 13 insertions, 3 deletions
diff --git a/Reaktor/commands/whatweb b/Reaktor/commands/whatweb
index 68f8aa38..36711efa 100755
--- a/Reaktor/commands/whatweb
+++ b/Reaktor/commands/whatweb
@@ -1,7 +1,17 @@
#!/bin/sh
#wrapper for WhatWeb
-here=$(dirname `readlink -f $0`)
-whatweb_bin="$here/../repos/whatweb/whatweb"
-[ ! -e "$whatweb_bin" ] && echo "!! Whatweb app does not exist" && exit 1
+set -eu
+
+# whatweb is in path?
+whatweb=whatweb
+if ! type -p whatweb >/dev/null 2>&1 ;then
+ here=$(dirname `readlink -f $0`)
+ whatweb="$here/../repos/whatweb/whatweb"
+ if ! test -e "$whatweb" then
+ echo "!! cannot find usable whatweb installation in path or basedir ($whatweb)"
+ exit 1
+ fi
+fi
+
[ -z "${1:-}" ] && echo "!! no host given" && exit 1
exec $whatweb_bin --user-agent="Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0" -a 3 "$1" 2>&1