From ff801dfc6b7029809aebf7ef0bd2e717139a1d19 Mon Sep 17 00:00:00 2001 From: epi052 <43392618+epi052@users.noreply.github.com> Date: Sat, 22 Feb 2020 12:20:13 -0600 Subject: [PATCH] added searchsploit to installable tools (#25) * added searchsploit to installable tools * formatted with black --- recon/__init__.py | 15 ++++++++++++++- recon/config.py | 3 ++- recon/nmap.py | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/recon/__init__.py b/recon/__init__.py index b03780f..08bb048 100644 --- a/recon/__init__.py +++ b/recon/__init__.py @@ -30,7 +30,20 @@ tools = { "seclists": { "installed": False, "dependencies": None, - "commands": [f"git clone https://github.com/danielmiessler/SecLists.git {defaults.get('tools-dir')}/seclists"], + "shell": True, + "commands": [ + f"bash -c 'if [[ -d {defaults.get('tools-dir')}/seclists ]] ; then cd {defaults.get('tools-dir')}/seclists && git fetch --all && git pull; else git clone https://github.com/danielmiessler/SecLists.git {defaults.get('tools-dir')}/seclists; fi'" + ], + }, + "searchsploit": { + "installed": False, + "dependencies": None, + "shell": True, + "commands": [ + f"bash -c 'if [[ -d {Path(tool_paths.get('searchsploit')).parent} ]] ; then cd {Path(tool_paths.get('searchsploit')).parent} && git fetch --all && git pull; else git clone https://github.com/offensive-security/exploitdb.git {defaults.get('tools-dir')}/exploitdb; fi'", + f"cp -n {Path(tool_paths.get('searchsploit')).parent}/.searchsploit_rc {Path.home().resolve()}", + f"sed -i 's#/opt#{defaults.get('tools-dir')}#g' {Path.home().resolve()}/.searchsploit_rc", + ], }, "masscan": { "installed": False, diff --git a/recon/config.py b/recon/config.py index 0e49a09..194fbb0 100644 --- a/recon/config.py +++ b/recon/config.py @@ -29,7 +29,8 @@ tool_paths = { "webanalyze": f"{Path.home()}/go/bin/webanalyze", "masscan": f"{defaults.get('tools-dir')}/masscan", "amass": f"{defaults.get('tools-dir')}/amass", - "go": "/usr/local/go/bin/go" + "go": "/usr/local/go/bin/go", + "searchsploit": f"{defaults.get('tools-dir')}/exploitdb/searchsploit" } top_tcp_ports = [ diff --git a/recon/nmap.py b/recon/nmap.py index d213499..418f6df 100644 --- a/recon/nmap.py +++ b/recon/nmap.py @@ -7,8 +7,8 @@ from pathlib import Path import luigi from luigi.util import inherits -from recon.config import defaults from recon.masscan import ParseMasscanOutput +from recon.config import defaults, tool_paths @inherits(ParseMasscanOutput) @@ -200,7 +200,7 @@ class SearchsploitScan(luigi.Task): def run(self): """ Grabs the xml files created by ThreadedNmap and runs searchsploit --nmap on each one, saving the output. """ for entry in Path(self.input().path).glob("nmap*.xml"): - proc = subprocess.run(["searchsploit", "--nmap", str(entry)], stderr=subprocess.PIPE) + proc = subprocess.run([tool_paths.get("searchsploit"), "--nmap", str(entry)], stderr=subprocess.PIPE) if proc.stderr: Path(self.output().path).mkdir(parents=True, exist_ok=True)