Merge pull request #86 from g0tmi1k/searchsploit

Add brew update support
This commit is contained in:
g0tmi1k 2017-04-23 17:54:43 +01:00 committed by GitHub
commit 513d76a8b8

View file

@ -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: 3.7.4 (Release date: 2017-03-17) # Version: 3.7.5 (Release date: 2017-04-21)
# Written by: Offensive Security, Unix-Ninja, and g0tmi1k # Written by: Offensive Security, Unix-Ninja, and g0tmi1k
# Homepage: https://github.com/offensive-security/exploit-database # Homepage: https://github.com/offensive-security/exploit-database
# Manual: https://www.exploit-db.com/searchsploit/ # Manual: https://www.exploit-db.com/searchsploit/
@ -106,31 +106,52 @@ function usage()
## Update database check ## Update database check
function update() function update()
{ {
# Update from the repos (e.g. Kali)
dpkg -l exploitdb 2>/dev/null >/dev/null dpkg -l exploitdb 2>/dev/null >/dev/null
if [[ "$?" == "0" ]]; then if [[ "$?" == "0" ]]; then
# Update from the repos (e.g. Kali)
updatedeb updatedeb
else exit 6
fi
# Update from homebrew (e.g. OSX)
brew install exploitdb 2>/dev/null >/dev/null
if [[ "$?" == "0" ]]; then
# This only really updates searchsploit
updatedbrew
fi
# Update via git # Update via git
updategit updategit
fi
# Done
exit 6
} }
## Update database (via .deb/apt) ## Update database (via .deb/apt)
function updatedeb() function updatedeb()
{ {
echo -e '[i] Updating via package management. Expect weekly-ish updates.\n' echo -e '[i] Updating via APT package management. Expect weekly-ish updates.\n'
sudo apt update \ sudo apt update \
|| echo -e '\n[-] Issue with apt update (Please check network connectivity & APT SourcesList values)' 1>&2 || echo -e '\n[-] Issue with apt update (Please check network connectivity & APT SourcesList values).' 1>&2
sudo apt -y install exploitdb \ sudo apt -y install exploitdb \
|| echo -e '\n[-] Issue with apt install' 1>&2 || echo -e '\n[-] Issue with apt upgrade.' 1>&2
echo -e "\n[*] Update finished." echo -e "\n[*] APT update finished."
exit 6
} }
## Update database (via homebrew)
function updatedbrew()
{
echo -e '[i] Updating via brew package management.\n'
brew update \
|| echo -e '\n[-] Issue with brew update (Please check network connectivity).' 1>&2
brew upgrade exploitdb 2>/dev/null >/dev/null
echo -e "\n[*] Brew update finished."
}
## Update database (via GIT) ## Update database (via GIT)
function updategit() function updategit()
@ -138,7 +159,8 @@ function updategit()
echo -e '[i] Updating via git. Expect daily updates.\n' echo -e '[i] Updating via git. Expect daily updates.\n'
## Make sure we are in the correct folder ## Make sure we are in the correct folder
mkdir -p "${gitpath}/" mkdir -p "${gitpath}/" \
|| sudo mkdir -p "${gitpath}/"
cd "${gitpath}/" cd "${gitpath}/"
## Are we in a git repo? ## Are we in a git repo?
@ -169,7 +191,7 @@ function updategit()
git pull origin master git pull origin master
fi fi
echo -e "\n[*] Update finished." echo -e "\n[*] Git update finished."
exit 6 exit 6
} }