Add two flags for viewing exploits in terminal pager
This commit is contained in:
parent
094f4ef355
commit
a30ebe3ca1
1 changed files with 23 additions and 1 deletions
24
searchsploit
24
searchsploit
|
@ -23,8 +23,10 @@ progname="$( basename "$0" )"
|
||||||
|
|
||||||
## Default options
|
## Default options
|
||||||
COLOUR=1
|
COLOUR=1
|
||||||
|
COPY_EXPLOIT=0
|
||||||
EDBID=0
|
EDBID=0
|
||||||
EXACT=0
|
EXACT=0
|
||||||
|
EXAMINE=0
|
||||||
FILEPATH=1
|
FILEPATH=1
|
||||||
GETPATH=0
|
GETPATH=0
|
||||||
JSON=0
|
JSON=0
|
||||||
|
@ -69,6 +71,8 @@ function usage()
|
||||||
echo " -t, --title Search just the exploit title (Default is title AND the file's path)."
|
echo " -t, --title Search just the exploit title (Default is title AND the file's path)."
|
||||||
echo " -u, --update Update exploit database from git."
|
echo " -u, --update Update exploit database from git."
|
||||||
echo " -w, --www Show URLs to Exploit-DB.com rather than local path."
|
echo " -w, --www Show URLs to Exploit-DB.com rather than local path."
|
||||||
|
echo " -x, --examine Examine exploit in terminal pager."
|
||||||
|
echo " -X Copy exploit to current path and then examine in terminal pager."
|
||||||
echo " --colour Disable colour highlighting."
|
echo " --colour Disable colour highlighting."
|
||||||
echo " --id Display EDB-ID value rather than local path."
|
echo " --id Display EDB-ID value rather than local path."
|
||||||
echo
|
echo
|
||||||
|
@ -150,6 +154,9 @@ for param in "$@"; do
|
||||||
SCASE=1
|
SCASE=1
|
||||||
elif [[ "${param}" == "--exact" ]]; then
|
elif [[ "${param}" == "--exact" ]]; then
|
||||||
EXACT=1
|
EXACT=1
|
||||||
|
elif [[ "${param}" == "--examine" ]]; then
|
||||||
|
GETPATH=1
|
||||||
|
EXAMINE=1
|
||||||
elif [[ "${param}" == "--help" ]]; then
|
elif [[ "${param}" == "--help" ]]; then
|
||||||
usage >&2
|
usage >&2
|
||||||
elif [[ "${param}" == "--json" ]]; then
|
elif [[ "${param}" == "--json" ]]; then
|
||||||
|
@ -180,7 +187,7 @@ done
|
||||||
|
|
||||||
|
|
||||||
## Parse short arguments
|
## Parse short arguments
|
||||||
while getopts "cehjoptuw" arg "${ARGS}"; do
|
while getopts "cehjoptuwxX" arg "${ARGS}"; do
|
||||||
if [[ "${arg}" = "?" ]]; then
|
if [[ "${arg}" = "?" ]]; then
|
||||||
usage >&2;
|
usage >&2;
|
||||||
fi
|
fi
|
||||||
|
@ -194,6 +201,8 @@ while getopts "cehjoptuw" arg "${ARGS}"; do
|
||||||
t) FILEPATH=0;;
|
t) FILEPATH=0;;
|
||||||
u) update;;
|
u) update;;
|
||||||
w) WEBLINK=1;;
|
w) WEBLINK=1;;
|
||||||
|
x) GETPATH=1; EXAMINE=1;;
|
||||||
|
X) GETPATH=1; EXAMINE=1; COPY_EXPLOIT=1;;
|
||||||
esac
|
esac
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
done
|
done
|
||||||
|
@ -229,6 +238,19 @@ if [[ "${GETPATH}" -eq 1 ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${EXAMINE}" -eq 1 ]]; then
|
||||||
|
if [[ "${COPY_EXPLOIT}" -eq 1 ]]; then
|
||||||
|
cp ${location} . && echo "Copied exploit to $(pwd)/"
|
||||||
|
fi
|
||||||
|
if [[ "${PAGER}" ]]; then
|
||||||
|
/bin/sh -c ${PAGER} ${location}
|
||||||
|
elif [[ -f "$(which pager 2> /dev/null)" ]]; then
|
||||||
|
pager ${location}
|
||||||
|
else
|
||||||
|
less ${location}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
## Done
|
## Done
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue