diff --git a/README.md b/README.md index e3771bc6e..63f50ee36 100755 --- a/README.md +++ b/README.md @@ -23,19 +23,19 @@ root@kali:~# searchsploit -h ========= Options ========= - -c, --case [Term] Perform a case-sensitive search (Default is inSEnsITiVe). - -e, --exact [Term] Perform an EXACT match on exploit title (Default is AND) [Implies "-t"]. - -h, --help Show this help screen. - -j, --json [Term] Show result in JSON format. - -m, --mirror [EDB-ID] Mirror (aka copies) an exploit to the current working directory. - -o, --overflow [Term] Exploit titles are allowed to overflow their columns. - -p, --path [EDB-ID] Show the full path to an exploit (and also copies the path to the clipboard if possible). - -t, --title [Term] Search JUST the exploit title (Default is title AND the file's path). - -u, --update Update the database via Git. - -w, --www [Term] Show URLs to Exploit-DB.com rather than the local path. - -x, --examine [EDB-ID] Examine (aka opens) the exploit using $PAGER. - --colour Disable colour highlighting in search results. - --id Display the EDB-ID value rather than local path. + -c, --case [Term] Perform a case-sensitive search (Default is inSEnsITiVe). + -e, --exact [Term] Perform an EXACT match on exploit title (Default is AND) [Implies "-t"]. + -h, --help Show this help screen. + -j, --json [Term] Show result in JSON format. + -m, --mirror [EDB-ID] Mirror (aka copies) an exploit to the current working directory. + -o, --overflow [Term] Exploit titles are allowed to overflow their columns. + -p, --path [EDB-ID] Show the full path to an exploit (and also copies the path to the clipboard if possible). + -t, --title [Term] Search JUST the exploit title (Default is title AND the file's path). + -u, --update Check for and install any exploitdb package updates (deb or git) + -w, --www [Term] Show URLs to Exploit-DB.com rather than the local path. + -x, --examine [EDB-ID] Examine (aka opens) the exploit using . + --colour Disable colour highlighting in search results. + --id Display the EDB-ID value rather than local path. ======= Notes @@ -64,8 +64,9 @@ Microsoft Windows 7 (x64) - 'afd.sys' Privilege Escalation (MS14-040) root@kali:~# root@kali:~# searchsploit -p 39446 Exploit: Microsoft Windows - 'afd.sys' Dangling Pointer Privilege Escalation (MS14-040) + URL: https://www.exploit-db.com/exploits/39446/ Path: /usr/share/exploitdb/platforms/win_x86/local/39446.py -Copied the file path to the clipboard. +Copied EDB-ID 39446's path to the clipboard. root@kali:~# ``` diff --git a/searchsploit b/searchsploit index 553a26393..5ea1b82ea 100755 --- a/searchsploit +++ b/searchsploit @@ -1,6 +1,6 @@ #!/bin/bash # Name: SearchSploit - Exploit-DB's CLI search tool -# Version: 3.5 (Release date: 2016-09-16) +# Version: 3.6 (Release date: 2016-09-19) # Written by: Offensive Security, Unix-Ninja & g0tmi1k # Homepage: https://github.com/offensive-security/exploit-database # @@ -45,13 +45,6 @@ CASE_TAG_FGREP="tolower" LANG=C -## If we cannot find files.csv -if [[ ! -f "${csvpath}" ]]; then - echo '[!] Could not find: ' ${csvpath} - exit 1 -fi - - ## Usage info function usage() { @@ -75,7 +68,7 @@ function usage() echo " -o, --overflow [Term] Exploit titles are allowed to overflow their columns." echo " -p, --path [EDB-ID] Show the full path to an exploit (and also copies the path to the clipboard if possible)." echo " -t, --title [Term] Search JUST the exploit title (Default is title AND the file's path)." - echo " -u, --update Update the database via Git." + echo " -u, --update Check for and install any exploitdb package updates (deb or git)" echo " -w, --www [Term] Show URLs to Exploit-DB.com rather than the local path." echo " -x, --examine [EDB-ID] Examine (aka opens) the exploit using $PAGER." echo " --colour Disable colour highlighting in search results." @@ -97,9 +90,40 @@ function usage() } -## Update database (via GIT) +## Update database check function update() { + dpkg -l exploitdb 2>/dev/null >/dev/null + if [[ "$?" == "0" ]]; then + # Update from the repos (e.g. Kali) + updatedeb + else + # Update via git + updategit + fi +} + + +## Update database (via .deb/apt) +function updatedeb() +{ + echo -e '[i] Updating via package management. Expect weekly-ish updates.\n' + + sudo apt update \ + || echo -e '\n[!] Issue with apt update (Please check network connectivity & apt SourcesList)' 1>&2 + sudo apt -y install exploitdb \ + || echo -e '\n[!] Issue with apt install' 1>&2 + + echo -e "\n[*] Update finished." + exit 6 +} + + +## Update database (via GIT) +function updategit() +{ + echo -e '[i] Updating via git. Expect daily updates.\n' + ## Make sure we are in the correct folder mkdir -p "${gitpath}/" cd "${gitpath}/" @@ -218,9 +242,15 @@ while getopts "cehjmoptuwx" arg "${ARGS}"; do done +## If we cannot find files.csv +if [[ ! -f "${csvpath}" ]]; then + echo '[!] Could not find: ' ${csvpath} + exit 1 +fi + + ## Print the full path. If pbcopy/xclip is available then copy to the clipboard if [[ "${GETPATH}" -eq 1 ]]; then - for exploit in $(echo ${TAGS}); do ## Get EDB-ID from input edbdb="$( echo ${exploit} | tr -dc '0-9' )"