Better solution for #64

This commit is contained in:
g0tmi1k 2016-12-20 11:14:28 +00:00
parent b94b787e2d
commit 2b92095822

View file

@ -615,25 +615,29 @@ else
fi fi
## Strip un-wanted values
SEARCH="${SEARCH} | sed 's/\"//g'"
## Magic search Fu ## Magic search Fu
## Web link format ("--www")? ## Web link format ("--www")?
if [[ "${WEBLINK}" -eq 1 ]]; then if [[ "${WEBLINK}" -eq 1 ]]; then
OUTPUT="$( eval ${SEARCH} \ OUTPUT="$( eval ${SEARCH} \
| awk -F "\"*,\"*" '{ printf "%-'${FORMAT}'s | %s\n", $3, "https://www.exploit-db.com/exploits/"$1"/"}' )" | awk -F ',' '{ printf "%-'${FORMAT}'s | %s\n", $3, "https://www.exploit-db.com/exploits/"$1"/"}' )"
## Just the EDB-ID ("--id")? ## Just the EDB-ID ("--id")?
elif [[ "${EDBID}" -eq 1 ]]; then elif [[ "${EDBID}" -eq 1 ]]; then
OUTPUT="$( eval ${SEARCH} \ OUTPUT="$( eval ${SEARCH} \
| awk -F "\"*,\"*" '{ printf "%-'${FORMAT}'s | %s\n", $3, $1 }' )" | awk -F ',' '{ printf "%-'${FORMAT}'s | %s\n", $3, $1 }' )"
## Print JSON format (full options) ("--json")? ## Print JSON format (full options) ("--json")?
elif [[ "${JSON}" -eq 1 ]]; then elif [[ "${JSON}" -eq 1 ]]; then
OUTPUT="$( eval ${SEARCH} \ OUTPUT="$( eval ${SEARCH} \
| awk -F "\"*,\"*" '{ printf "\r\t\t'{'\"Exploit\":\"%s,\"Path\":\"'${gitpath}/'%s\",\"EDB-ID\":%s},\n", $3, $2, $1 }' \ | awk -F ',' '{ printf "\r\t\t'{'\"Exploit\":\"%s\",\"Path\":\"'${gitpath}/'%s\",\"EDB-ID\":%s},\n", $3, $2, $1 }' \
| sed '$ s/,$//g' )" | sed '$ s/,$//g' )"
## Default view ## Default view
else else
OUTPUT="$( eval ${SEARCH} \ OUTPUT="$( eval ${SEARCH} \
| awk -F "\"*,\"*" '{ printf "%-'${FORMAT}'s | %s\n", $3, $2 }' \ | awk -F ',' '{ printf "%-'${FORMAT}'s | %s\n", $3, $2 }' \
| sed "s/| platforms/| /" )" | sed 's/| platforms/| /' )"
fi fi