View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000707 | Kali Linux | Queued Tool Addition | public | 2013-11-19 16:27 | 2021-05-18 11:02 |
| Reporter | unix-ninja | Assigned To | dookie | ||
| Priority | normal | Severity | minor | Reproducibility | N/A |
| Status | resolved | Resolution | fixed | ||
| Fixed in Version | 1.0.7 | ||||
| Summary | 0000707: searchsploit utility needs moar bass | ||||
| Description | So, the searchsploit utility ****ed me off a bit, for a few reasons; therefore I decided to rewrite it.
I also dropped in some new code for output formatting. By default, it will truncate descriptions to fit in the first output column. However, throw in a "-v" and the descriptions will be allowed to overflow their columns. That's about all for now. I figured I would throw my script back your way in case you guys wanted to include it in a new release of Kali. | ||||
| Attached Files | searchsploit-corrected (1,725 bytes)
#!/bin/bash
# exploitdb CLI search tool
# Version 2
# Written by Unix-Ninja
csvpath=/usr/share/exploitdb/files.csv
progname=`basename $0`
VERBOSE=0
# if files.csv is in the searchsploit path, use that
if [ -f "$( dirname $0 )/files.csv" ]; then
csvpath="$( dirname $0 )/files.csv"
fi
# usage info
function usage()
{
echo "Usage: $progname [options] term1 [term2] ... [termN]"
echo "Example: $progname oracle windows local"
echo
echo "======="
echo "Options"
echo "======="
echo
echo " -h, --help Show help screen"
echo " -v By setting verbose output, description lines are allowed to"
echo " overflow their columns"
echo
echo "*NOTES*"
echo "Use any number of search terms you would like (minimum of one)."
echo "Search terms are not case sensitive, and order is irrelevant."
exit 1
}
if [ $# -eq 0 -o "$1" == "-h" -o "$1" == "--help" ]; then
usage >&2
fi
# dynamically set column widths
COL2=35
COL1=$(( `tput cols` - $COL2 - 1 ))
if [ "$1" == "-v" ]; then
VERBOSE=1
shift
fi
# print header
printf "%-${COL1}s %s" " Description"
echo " Path"
printf "%0.s-" `eval echo {1..$(( $COL1 + 1 ))}`
echo -n " "
printf "%0.s-" `eval echo {1..$(( $COL2 - 1 ))}`
echo
# create search command
SEARCH="fgrep -i \"$1\" $csvpath"
shift
while (( "$#" )); do
SEARCH="$SEARCH | fgrep -i \"$1\""
shift
done
# set LANG variable to avoid illegal byte sequence errors in sed
LANG=C
# search, format, and print results
if [ "$VERBOSE" -eq 0 ]; then
eval $SEARCH \
| awk -F "\"*,\"*" '{ printf "%-'$COL1'.'$COL1's | %s\n", $3, $2}' \
| sed " s/| platforms/| /"
else
eval $SEARCH \
| awk -F "\"*,\"*" '{ printf "%-'$COL1's | %s\n", $3, $2}' \
| sed " s/| platforms/| /"
fi
exit 0
| ||||
|
Ugh! Bug on line 67, the -v flag is working in reverse. To fix this, I changed the line to check against 0 instead. |
|
|
This has been merged upstream and is now part of the exploitdb package in Kali in exploitdb_03112014-0kali1. It will be in the repos soon. Thanks for the contribution! |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2013-11-19 16:27 | unix-ninja | New Issue | |
| 2013-11-19 16:27 | unix-ninja | File Added: searchsploit | |
| 2013-11-20 02:01 | unix-ninja | Note Added: 0001089 | |
| 2013-11-20 02:04 | unix-ninja | File Added: searchsploit-corrected | |
| 2013-12-03 17:17 | g0tmi1k | Category | Tool Upgrade => New Tool Requests |
| 2013-12-03 17:17 | g0tmi1k | Description Updated | |
| 2014-01-08 15:20 | g0tmi1k | File Deleted: searchsploit | |
| 2014-03-05 16:19 | g0tmi1k | Note Added: 0001596 | |
| 2014-03-10 17:53 | dookie | Note Added: 0001602 | |
| 2014-03-10 17:53 | dookie | Status | new => resolved |
| 2014-03-10 17:53 | dookie | Fixed in Version | => 1.0.7 |
| 2014-03-10 17:53 | dookie | Resolution | open => fixed |
| 2014-03-10 17:53 | dookie | Assigned To | => dookie |
| 2021-05-18 11:02 | g0tmi1k | Category | New Tool Requests => Queued Tool Addition |