From c4c40308c6954d7a84f40d57b311f862aae0d6ac Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 8 Apr 2011 22:42:07 +0000 Subject: [PATCH] no more annoying "no metasploit found" for case when msfpath provided with root directory of Metasploit (not the bin one) --- lib/core/option.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 5b3505b8b..65c9a009d 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -505,11 +505,18 @@ def __setMetasploit(): raise sqlmapMissingPrivileges, errMsg if conf.msfPath: - condition = os.path.exists(normalizePath(conf.msfPath)) - condition &= os.path.exists(normalizePath(os.path.join(conf.msfPath, "msfcli"))) - condition &= os.path.exists(normalizePath(os.path.join(conf.msfPath, "msfconsole"))) - condition &= os.path.exists(normalizePath(os.path.join(conf.msfPath, "msfencode"))) - condition &= os.path.exists(normalizePath(os.path.join(conf.msfPath, "msfpayload"))) + condition = False + + for path in [conf.msfPath, os.path.join(conf.msfPath, 'bin')]: + condition = os.path.exists(normalizePath(path)) + condition &= os.path.exists(normalizePath(os.path.join(path, "msfcli"))) + condition &= os.path.exists(normalizePath(os.path.join(path, "msfconsole"))) + condition &= os.path.exists(normalizePath(os.path.join(path, "msfencode"))) + condition &= os.path.exists(normalizePath(os.path.join(path, "msfpayload"))) + + if condition: + conf.msfPath = path + break if condition: debugMsg = "provided Metasploit Framework 3 path "