commit
7335ea6fc3
1 changed files with 23 additions and 16 deletions
21
searchsploit
21
searchsploit
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Name: SearchSploit - Exploit-DB's CLI search tool
|
# Name: SearchSploit - Exploit-DB's CLI search tool
|
||||||
# Version: 4.0.6 (2020-04-06)
|
# Version: 4.0.7 (2020-04-09)
|
||||||
# Written by: Offensive Security, Unix-Ninja, and g0tmi1k
|
# Written by: Offensive Security, Unix-Ninja, and g0tmi1k
|
||||||
# Homepage: https://github.com/offensive-security/exploitdb
|
# Homepage: https://github.com/offensive-security/exploitdb
|
||||||
# Manual: https://www.exploit-db.com/searchsploit
|
# Manual: https://www.exploit-db.com/searchsploit
|
||||||
|
@ -264,7 +264,7 @@ function validterm()
|
||||||
|| [ "$( echo ${1} | tr '[:upper:]' '[:lower:]' )" == "oracle" ] \
|
|| [ "$( echo ${1} | tr '[:upper:]' '[:lower:]' )" == "oracle" ] \
|
||||||
|| [ "$( echo ${1} | tr '[:upper:]' '[:lower:]' )" == "ssh" ] \
|
|| [ "$( echo ${1} | tr '[:upper:]' '[:lower:]' )" == "ssh" ] \
|
||||||
|| [ "$( echo ${1} | tr '[:upper:]' '[:lower:]' )" == "unknown" ]; then
|
|| [ "$( echo ${1} | tr '[:upper:]' '[:lower:]' )" == "unknown" ]; then
|
||||||
echo -e "[-] Skipping term: ${1} (Term is too general. Please re-search manually: $0 ${arg} ${1})\n" 1>&2
|
echo -e "[-] Skipping term: ${1} (Too generic. You'll need to force a search: $0 ${arg} ${1})\n" 1>&2
|
||||||
## Issues, return with something
|
## Issues, return with something
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -312,14 +312,18 @@ function searchsploitout()
|
||||||
## Are there too many results?
|
## Are there too many results?
|
||||||
lines=$( echo -e "${out}" | wc -l )
|
lines=$( echo -e "${out}" | wc -l )
|
||||||
if [[ "${lines}" -gt 100 ]]; then
|
if [[ "${lines}" -gt 100 ]]; then
|
||||||
echo -e "[-] Skipping output: ${tmp} (Too many results. Please re-search manually: $0 ${arg} ${tmp})\n" 1>&2
|
echo -e "[-] Skipping output: ${tmp} (Too many results, 100+. You'll need to force a search: $0 ${arg} ${tmp})\n" 1>&2
|
||||||
## Are there any results?
|
## Are there any results?
|
||||||
elif [[ "${lines}" -gt 5 ]]; then
|
elif [[ "${lines}" -gt 5 ]]; then
|
||||||
echo -e "${out}\n\n"
|
echo -e "${out}\n\n"
|
||||||
## If there's no results
|
## If there's no results
|
||||||
else
|
else
|
||||||
|
## Exit for loop
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Space out for the next word
|
||||||
|
tmp="${tmp} "
|
||||||
done
|
done
|
||||||
|
|
||||||
## Padding between loops
|
## Padding between loops
|
||||||
|
@ -336,7 +340,7 @@ function searchsploitout()
|
||||||
## Are there too many results?
|
## Are there too many results?
|
||||||
lines=$( echo -e "${out}" | wc -l )
|
lines=$( echo -e "${out}" | wc -l )
|
||||||
if [[ "${lines}" -gt 100 ]]; then
|
if [[ "${lines}" -gt 100 ]]; then
|
||||||
echo -e "[-] Skipping output: ${software} (Too many results. Please re-search manually: $0 ${arg} ${software})\n" 1>&2
|
echo -e "[-] Skipping output: ${software} (Too many results, 100+. You'll need to force a search: $0 ${arg} ${software})\n" 1>&2
|
||||||
## Are there any results?
|
## Are there any results?
|
||||||
elif [[ "${lines}" -gt 5 ]]; then
|
elif [[ "${lines}" -gt 5 ]]; then
|
||||||
echo -e "${out}\n\n"
|
echo -e "${out}\n\n"
|
||||||
|
@ -493,8 +497,9 @@ function findresults()
|
||||||
## Maximum length COL2 can be
|
## Maximum length COL2 can be
|
||||||
FORMAT_COL2=$(( ${COL2} - 2 ))
|
FORMAT_COL2=$(( ${COL2} - 2 ))
|
||||||
|
|
||||||
## Strip un-wanted values
|
## Strip un-wanted values from titles
|
||||||
SEARCH="${SEARCH} | sed 's/\"//g'"
|
#SEARCH="${SEARCH} | sed 's/\"//g"
|
||||||
|
SEARCH="${SEARCH} | sed 's/,\"/,/; s/\"$//;'"
|
||||||
|
|
||||||
|
|
||||||
## Remove any terms not wanted from the search
|
## Remove any terms not wanted from the search
|
||||||
|
@ -533,9 +538,11 @@ function findresults()
|
||||||
| sort )"
|
| sort )"
|
||||||
## Default view
|
## Default view
|
||||||
else
|
else
|
||||||
|
echo $SEARCH
|
||||||
OUTPUT="$( eval ${SEARCH} \
|
OUTPUT="$( eval ${SEARCH} \
|
||||||
| awk -F ',' '{ printf "%-'${FORMAT_COL1}'s | %.'${FORMAT_COL2}'s\n", $3, $2 }' \
|
| awk -F ',' '{ printf "%-'${FORMAT_COL1}'s | %.'${FORMAT_COL2}'s\n", $3, $2 }' \
|
||||||
| sort )"
|
| sort )"
|
||||||
|
#| sed 's_,exploits/_,_; s_,shellcodes/_,_; s_,papers/_,_' \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -905,7 +912,7 @@ for (( i=0; i<${arraylength}; i++ )); do
|
||||||
printresults "${name_array[${i}]}" "${path_array[${i}]}"
|
printresults "${name_array[${i}]}" "${path_array[${i}]}"
|
||||||
## Summary if NOT JSON ("--json")
|
## Summary if NOT JSON ("--json")
|
||||||
elif [[ "${JSON}" -eq 0 ]]; then
|
elif [[ "${JSON}" -eq 0 ]]; then
|
||||||
echo "${name_array[${i}]}s: No Result"
|
echo "${name_array[${i}]}s: No Results"
|
||||||
fi
|
fi
|
||||||
## Reset
|
## Reset
|
||||||
COLOUR_TAG=""
|
COLOUR_TAG=""
|
||||||
|
|
Loading…
Add table
Reference in a new issue