From b1c290b6149c64b0425c25ae01683561796a1bfd Mon Sep 17 00:00:00 2001 From: Conny Brunnkvist Date: Fri, 4 Jul 2014 23:58:46 +0700 Subject: [PATCH] Look for .csv in source dir even if exe is symlinked --- searchsploit | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/searchsploit b/searchsploit index 166ae4764..13e07a9a1 100755 --- a/searchsploit +++ b/searchsploit @@ -9,9 +9,15 @@ TAGS= SCASE='-i' VERBOSE=0 -# if files.csv is in the searchsploit path, use that -if [ -f "$( dirname $0 )/files.csv" ]; then - csvpath="$( dirname $0 )/files.csv" +# if files.csv is in the searchsploit source path, use that +scriptsrc=$0 +while [ -h $scriptsrc ]; do + scriptsrc=$(readlink $scriptsrc) + [[ $scriptsrc != /* ]] && scriptsrc="$( cd -P $( dirname $scriptsrc ) && pwd )/$scriptsrc" +done +progdir="$( cd -P "$( dirname "$scriptsrc" )" && pwd )" +if [ -f "$progdir/files.csv" ]; then + csvpath="$progdir/files.csv" fi # usage info