Skip to content

Commit

Permalink
searchsploit -u // Works better with Homebrew (add remote git repo)
Browse files Browse the repository at this point in the history
  • Loading branch information
g0tmi1k committed Apr 3, 2016
1 parent 6290e00 commit a26695a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Example:
-t, --title Search just the exploit title (Default is title AND the file's path).
-u, --update Update exploit database from git.
-w, --www Show URLs to Exploit-DB.com rather than local path.
--id Display EDB-ID value rather than local path.
--colour Disable colour highlighting.
--id Display EDB-ID value rather than local path.
=======
Notes
Expand Down
22 changes: 13 additions & 9 deletions searchsploit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# Name: SearchSploit - Exploit-DB's CLI search tool
# Version: 3.3 (Release date: 2016-03-19)
# Version: 3.3 (Release date: 2016-04-02)
# Written by: Offensive Security, Unix-Ninja & g0tmi1k
# Homepage: https://github.com/offensive-security/exploit-database
#
Expand Down Expand Up @@ -67,8 +67,8 @@ function usage()
echo " -t, --title Search just the exploit title (Default is title AND the file's path)."
echo " -u, --update Update exploit database from git."
echo " -w, --www Show URLs to Exploit-DB.com rather than local path."
echo " --id Display EDB-ID value rather than local path."
echo " --colour Disable colour highlighting."
echo " --id Display EDB-ID value rather than local path."
echo
echo "======="
echo " Notes "
Expand All @@ -92,18 +92,22 @@ function update()
mkdir -p "${gitpath}/"
cd "${gitpath}/"

## Make sure a git repo is init before updating
## Are we in a git repo?
if [[ "$( git rev-parse --is-inside-work-tree )" != "true" ]]; then
if [[ "$( ls )" = "" ]]; then
# If directory is empty, just clone
git clone --depth=1 "${gitremote}" .
else
# If not empty, init and add remote
git init >/dev/null
git remote add origin "${gitremote}"
echo -e '\n[i] Nothing here. Starting fresh...'
git clone "${gitremote}" .
fi
fi

# Is our git remote added? (aka homebrew)
if [[ "$( git remote -v )" != *"${gitremote}"* ]]; then
echo -e '\n[i] Missing git remote:' "${gitremote}"
git init >/dev/null
git remote add origin "${gitremote}" 2>/dev/null
fi

# Make sure to prep checkout first
git checkout -- .

Expand All @@ -116,7 +120,7 @@ function update()
git pull origin master
fi

echo "[*] Update finished."
echo -e "\n[*] Update finished."
exit 6
}

Expand Down

0 comments on commit a26695a

Please sign in to comment.