Better Paper support - Crops filepath & Improves EDB-ID detection
This commit is contained in:
parent
ac2c9fab6b
commit
2bf619d766
1 changed files with 12 additions and 9 deletions
21
searchsploit
21
searchsploit
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
# Name: SearchSploit - Exploit-DB's CLI search tool
|
||||
# Version: 4.0.1 (Release date: 2018-01-24)
|
||||
# Version: 4.0.2 (Release date: 2018-01-26)
|
||||
# Written by: Offensive Security, Unix-Ninja, and g0tmi1k
|
||||
# Homepage: https://github.com/offensive-security/exploit-database
|
||||
# Manual: https://www.exploit-db.com/searchsploit/
|
||||
|
@ -476,11 +476,13 @@ function findresults()
|
|||
|
||||
## Search, format, and print results (--overflow)
|
||||
if [[ "${OVERFLOW}" -eq 1 ]]; then
|
||||
FORMAT=${COL1}
|
||||
FORMAT_COL1=${COL1}
|
||||
else
|
||||
FORMAT=${COL1}'.'${COL1}
|
||||
FORMAT_COL1=${COL1}'.'${COL1}
|
||||
fi
|
||||
|
||||
## Maximum length COL2 can be
|
||||
FORMAT_COL2=$(( ${COL2} - 2 ))
|
||||
|
||||
## Strip un-wanted values
|
||||
SEARCH="${SEARCH} | sed 's/\"//g'"
|
||||
|
@ -512,17 +514,17 @@ function findresults()
|
|||
## Web link format ("--www")?
|
||||
elif [[ "${WEBLINK}" -eq 1 ]]; then
|
||||
OUTPUT="$( eval ${SEARCH} \
|
||||
| awk -F ',' '{ printf "%-'${FORMAT}'s | %s\n", $3, "https://www.exploit-db.com/'${url}'/"$1"/"}' \
|
||||
| awk -F ',' '{ printf "%-'${FORMAT_COL1}'s | %s\n", $3, "https://www.exploit-db.com/'${url}'/"$1"/"}' \
|
||||
| sort )"
|
||||
## Just the EDB-ID ("--id")?
|
||||
elif [[ "${EDBID}" -eq 1 ]]; then
|
||||
OUTPUT="$( eval ${SEARCH} \
|
||||
| awk -F ',' '{ printf "%-'${FORMAT}'s | %s\n", $3, $1 }' \
|
||||
| awk -F ',' '{ printf "%-'${FORMAT_COL1}'s | %s\n", $3, $1 }' \
|
||||
| sort )"
|
||||
## Default view
|
||||
else
|
||||
OUTPUT="$( eval ${SEARCH} \
|
||||
| awk -F ',' '{ printf "%-'${FORMAT}'s | %s\n", $3, $2 }' \
|
||||
| awk -F ',' '{ printf "%-'${FORMAT_COL1}'s | %.'${FORMAT_COL2}'s\n", $3, $2 }' \
|
||||
| sort )"
|
||||
fi
|
||||
|
||||
|
@ -756,7 +758,7 @@ fi
|
|||
if [[ "${GETPATH}" -eq 1 ]]; then
|
||||
for exploit in $( echo ${TAGS} ); do
|
||||
## Get EDB-ID from input
|
||||
edbdb="$( echo ${exploit} | rev | cut -d '/' -f1 | rev | cut -d'.' -f1 | tr -dc '0-9' )"
|
||||
edbdb="$( echo ${exploit} | rev | cut -d '/' -f1 | rev | cut -d'-' -f1 | cut -d'.' -f1 | tr -dc '0-9' )"
|
||||
|
||||
|
||||
## Loop until we find something
|
||||
|
@ -764,8 +766,9 @@ if [[ "${GETPATH}" -eq 1 ]]; then
|
|||
for (( i=0; i<${arraylength}; i++ )); do
|
||||
files="${path_array[${i}]}/${files_array[${i}]}"
|
||||
## Check to see if the files_*.csv has a value
|
||||
path=$( cut -d ',' -f 2 "${files}" | grep -m 1 -E "/${edbdb}(\..*)?$" )
|
||||
if [[ "${path}" ]]; then
|
||||
line=$( grep -m 1 -E "^${edbdb}," "${files}" )
|
||||
if [[ "${line}" ]]; then
|
||||
path="$( echo $line | cut -d ',' -f 2 )"
|
||||
location="${path_array[${i}]}/${path}"
|
||||
name="${name_array[${i}]}"
|
||||
[[ "${name}" == "Paper"* ]] && url="papers/${edbdb}/" || url="exploits/${edbdb}/"
|
||||
|
|
Loading…
Add table
Reference in a new issue