Merge pull request #92 from g0tmi1k/searchsploit

Output is sorted by title
This commit is contained in:
g0tmi1k 2017-06-26 11:55:40 +01:00 committed by GitHub
commit 49460c0421

View file

@ -1,6 +1,6 @@
#!/bin/bash
# Name: SearchSploit - Exploit-DB's CLI search tool
# Version: 3.8 (Release date: 2017-06-14)
# Version: 3.8.1 (Release date: 2017-06-26)
# Written by: Offensive Security, Unix-Ninja, and g0tmi1k
# Homepage: https://github.com/offensive-security/exploit-database
# Manual: https://www.exploit-db.com/searchsploit/
@ -683,21 +683,25 @@ fi
## Web link format ("--www")?
if [[ "${WEBLINK}" -eq 1 ]]; then
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"/"}' \
| 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}'s | %s\n", $3, $1 }' \
| sort )"
## Print JSON format (full options) ("--json")?
elif [[ "${JSON}" -eq 1 ]]; then
OUTPUT="$( eval ${SEARCH} \
| awk -F ',' '{ printf "\r\t\t'{'\"Exploit\":\"%s\",\"Platform\":\"%s\",\"Type\":\"%s\",\"Date\":\"%s\",\"Path\":\"'${gitpath}/'%s\",\"EDB-ID\":%s},\n", $3, $5, $6, $4, $2, $1 }' \
| sed '$ s/,$//g' )"
| sed '$ s/,$//g' \
| sort )"
## Default view
else
OUTPUT="$( eval ${SEARCH} \
| awk -F ',' '{ printf "%-'${FORMAT}'s | %s\n", $3, $2 }' \
| sed 's_| platforms/_| _' )"
| sed 's_| platforms/_| _' \
| sort )"
fi