Merge branch 'unix-ninja-master'

This commit is contained in:
Offensive Security 2016-09-12 22:07:44 +00:00
commit 79d7b397e6
2 changed files with 29 additions and 1 deletions

View file

@ -23,11 +23,13 @@ Example:
-e, --exact Perform an EXACT match on exploit title (Default is AND) [Implies "-t"]. -e, --exact Perform an EXACT match on exploit title (Default is AND) [Implies "-t"].
-h, --help Show this help screen. -h, --help Show this help screen.
-j, --json Show result in JSON format. -j, --json Show result in JSON format.
-m, --mirror Mirror (Copy) exploit to current path.
-o, --overflow Exploit title's are allowed to overflow their columns. -o, --overflow Exploit title's are allowed to overflow their columns.
-p, --path Show the full path to an exploit (Copies path to clipboard if possible). -p, --path Show the full path to an exploit (Copies path to clipboard if possible).
-t, --title Search just the exploit title (Default is title AND the file's path). -t, --title Search just the exploit title (Default is title AND the file's path).
-u, --update Update exploit database from git. -u, --update Update exploit database from git.
-w, --www Show URLs to Exploit-DB.com rather than local path. -w, --www Show URLs to Exploit-DB.com rather than local path.
-x, --examine Examine exploit in terminal pager.
--colour Disable colour highlighting. --colour Disable colour highlighting.
--id Display EDB-ID value rather than local path. --id Display EDB-ID value rather than local path.

View file

@ -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
@ -64,11 +66,13 @@ function usage()
echo " -e, --exact Perform an EXACT match on exploit title (Default is AND) [Implies \"-t\"]." echo " -e, --exact Perform an EXACT match on exploit title (Default is AND) [Implies \"-t\"]."
echo " -h, --help Show this help screen." echo " -h, --help Show this help screen."
echo " -j, --json Show result in JSON format." echo " -j, --json Show result in JSON format."
echo " -m, --mirror Mirror (Copy) exploit to current path."
echo " -o, --overflow Exploit title's are allowed to overflow their columns." echo " -o, --overflow Exploit title's are allowed to overflow their columns."
echo " -p, --path Show the full path to an exploit (Copies path to clipboard if possible)." echo " -p, --path Show the full path to an exploit (Copies path to clipboard if possible)."
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 " --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 "cehjmoptuwx" arg "${ARGS}"; do
if [[ "${arg}" = "?" ]]; then if [[ "${arg}" = "?" ]]; then
usage >&2; usage >&2;
fi fi
@ -189,11 +196,13 @@ while getopts "cehjoptuw" arg "${ARGS}"; do
e) EXACT=1;; e) EXACT=1;;
h) usage >&2;; h) usage >&2;;
j) JSON=1;; j) JSON=1;;
m) COPY_EXPLOIT=1;;
o) OVERFLOW=1;; o) OVERFLOW=1;;
p) GETPATH=1;; p) GETPATH=1;;
t) FILEPATH=0;; t) FILEPATH=0;;
u) update;; u) update;;
w) WEBLINK=1;; w) WEBLINK=1;;
x) GETPATH=1; EXAMINE=1;;
esac esac
shift $(( OPTIND - 1 )) shift $(( OPTIND - 1 ))
done done
@ -229,6 +238,16 @@ if [[ "${GETPATH}" -eq 1 ]]; then
fi fi
fi fi
if [[ "${EXAMINE}" -eq 1 ]]; then
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
@ -240,6 +259,13 @@ if [[ "${GETPATH}" -eq 1 ]]; then
fi fi
fi fi
if [[ "${COPY_EXPLOIT}" -eq 1 ]]; then
for exploit in $TAGS; do
find ${cvspath} -name ${exploit}'.*' -exec cp {} . \; -exec echo 'Copied {} to '$(pwd) \;
done
exit 0
fi
## If we are doing an exact match, do not check folder path. ## If we are doing an exact match, do not check folder path.
if [[ "${EXACT}" -eq 1 ]]; then if [[ "${EXACT}" -eq 1 ]]; then