SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Validate external tool paths
Brendan Coles2aaabdf9061c
diff --git a/modules/sfp_tool_cmseek.py b/modules/sfp_tool_cmseek.pyindex 79874594..68d0d9d8 100644--- a/modules/sfp_tool_cmseek.py+++ b/modules/sfp_tool_cmseek.py@@ -14,6 +14,7 @@from subprocess import Popen, PIPEimport ioimport json+import os.pathfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_tool_cmseek(SpiderFootPlugin):@@ -77,7 +78,7 @@ class sfp_tool_cmseek(SpiderFootPlugin):self.errorState = Truereturn None- # If tool is not found, abort+ # Normalize pathif self.opts['cmseekpath'].endswith('cmseek.py'):exe = self.opts['cmseekpath']resultpath = self.opts['cmseekpath'].split("cmseek.py")[0] + "/Result"@@ -88,6 +89,12 @@ class sfp_tool_cmseek(SpiderFootPlugin):exe = self.opts['cmseekpath'] + "/cmseek.py"resultpath = self.opts['cmseekpath'] + "/Result"+ # If tool is not found, abort+ if not os.path.isfile(exe):+ self.sf.error("File does not exist: " + exe, False)+ self.errorState = True+ return None+# Sanitize domain name.if not self.sf.sanitiseInput(eventData):self.sf.error("Invalid input, refusing to run.", False)diff --git a/modules/sfp_tool_dnstwist.py b/modules/sfp_tool_dnstwist.pyindex ef3944cc..3601e91a 100644--- a/modules/sfp_tool_dnstwist.py+++ b/modules/sfp_tool_dnstwist.py@@ -15,6 +15,7 @@ from subprocess import Popen, PIPEimport timeimport reimport json+import os.pathfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_tool_dnstwist(SpiderFootPlugin):@@ -78,7 +79,7 @@ class sfp_tool_dnstwist(SpiderFootPlugin):self.errorState = Truereturn None- # If tool is not found, abort+ # Normalize pathif self.opts['dnstwistpath'].endswith('dnstwist.py'):exe = self.opts['dnstwistpath']elif self.opts['dnstwistpath'].endswith('/'):@@ -86,6 +87,12 @@ class sfp_tool_dnstwist(SpiderFootPlugin):else:exe = self.opts['dnstwistpath'] + "/dnstwist.py"+ # If tool is not found, abort+ if not os.path.isfile(exe):+ self.sf.error("File does not exist: " + exe, False)+ self.errorState = True+ return None+# Sanitize domain name.if not self.sf.sanitiseInput(eventData):self.sf.error("Invalid input, refusing to run.", False)