Fix up of bash fu for both OSX & Linux
This commit is contained in:
parent
5be2377b41
commit
45ec8a72aa
1 changed files with 9 additions and 9 deletions
18
searchsploit
18
searchsploit
|
@ -11,8 +11,8 @@
|
|||
# Exit code '6' means updated from GitHub
|
||||
|
||||
|
||||
## OS settings
|
||||
gitpath="${0%/*}"
|
||||
## OS settings (get the path of where the script is stored + database file)
|
||||
gitpath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
csvpath="${gitpath}/files.csv"
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ SEARCH=""
|
|||
LANG=C
|
||||
|
||||
|
||||
## If we cannot find files.csv in ${gitpath}
|
||||
## If we cannot find files.csv
|
||||
if [[ ! -f "${csvpath}" ]]; then
|
||||
echo '[!] Could not find: ' ${csvpath}
|
||||
exit 1
|
||||
|
@ -363,25 +363,25 @@ fi
|
|||
## Magic search Fu
|
||||
## Web link format?
|
||||
if [[ "${WEBLINK}" -eq 1 ]]; then
|
||||
OUTPUT="$(awk -F "\"*,\"*" '{ printf "%-'${FORMAT}'s | %s\n", $3, "https://www.exploit-db.com/exploits/"$1"/"}' "${csvpath}" \
|
||||
| eval "${SEARCH}")"
|
||||
OUTPUT="$( awk -F "\"*,\"*" '{ printf "%-'${FORMAT}'s | %s\n", $3, "https://www.exploit-db.com/exploits/"$1"/"}' "${csvpath}" \
|
||||
| eval "${SEARCH}" )"
|
||||
## Just the EDB-ID?
|
||||
elif [[ "${EDBID}" -eq 1 ]]; then
|
||||
OUTPUT="$(awk -F "\"*,\"*" '{ printf "%-'${FORMAT}'s | %s\n", $3, $1}' "${csvpath}" \
|
||||
OUTPUT="$( awk -F "\"*,\"*" '{ printf "%-'${FORMAT}'s | %s\n", $3, $1}' "${csvpath}" \
|
||||
| eval "${SEARCH}" )"
|
||||
## Print JSON format (full options)
|
||||
elif [[ "${JSON}" -eq 1 ]]; then
|
||||
OUTPUT="$(awk -F "\"*,\"*" '{ printf "\r\t\t'{'\"Exploit\":\"%s\",\"Path\":\"'${gitpath}/'%s\",\"EDB-ID\":%s},\n", $3, $2, $1}' "${csvpath}" \
|
||||
OUTPUT="$( awk -F "\"*,\"*" '{ printf "\r\t\t'{'\"Exploit\":\"%s\",\"Path\":\"'${gitpath}/'%s\",\"EDB-ID\":%s},\n", $3, $2, $1}' "${csvpath}" \
|
||||
| eval "${SEARCH}" \
|
||||
| sed '$ s/,$//g' )"
|
||||
## Default view
|
||||
else
|
||||
OUTPUT=$OUTPUT"$(awk -F "\"*,\"*" '{ printf "%-'${FORMAT}'s | %s\n", $3, $2}' "${csvpath}" \
|
||||
OUTPUT="$( awk -F "\"*,\"*" '{ printf "%-'${FORMAT}'s | %s\n", $3, $2}' "${csvpath}" \
|
||||
| eval "${SEARCH}" \
|
||||
| sed "s/| platforms/| ./" )"
|
||||
fi
|
||||
|
||||
echo $OUTPUT
|
||||
echo "${OUTPUT}"
|
||||
|
||||
## Print footer if not in JSON
|
||||
if [[ "${JSON}" -eq 0 ]]; then
|
||||
|
|
Loading…
Add table
Reference in a new issue