From cad37c42978ba4c39a1f0225a742a3a0a788a427 Mon Sep 17 00:00:00 2001 From: atucom <466817+atucom@users.noreply.github.com> Date: Tue, 27 Mar 2018 12:27:04 -0500 Subject: [PATCH 1/2] fixed check_for_msf() to check in $PATH --- lib/settings.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/settings.py b/lib/settings.py index 4727260..2f596e2 100644 --- a/lib/settings.py +++ b/lib/settings.py @@ -6,6 +6,7 @@ import platform import getpass import tempfile +import distutils.spawn # import subprocess import psutil @@ -177,9 +178,10 @@ def cmdline(command): def check_for_msf(): """ - check the ENV PATH for msfconsole + check the ENV PATH for msfconsole. + Returns None if executable not found """ - return os.getenv("msfconsole", False) + return distutils.spawn.find_executable("msfconsole") def logo(): """ From 3830f8f67b218b94f1e3bdb96d4a39ea1ca0006c Mon Sep 17 00:00:00 2001 From: atucom <466817+atucom@users.noreply.github.com> Date: Tue, 27 Mar 2018 15:47:18 -0500 Subject: [PATCH 2/2] check_msf_path() now checks both os.environ and PATH --- lib/settings.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/settings.py b/lib/settings.py index 2f596e2..a6a91fd 100644 --- a/lib/settings.py +++ b/lib/settings.py @@ -178,10 +178,9 @@ def cmdline(command): def check_for_msf(): """ - check the ENV PATH for msfconsole. - Returns None if executable not found + check the ENV PATH for msfconsole """ - return distutils.spawn.find_executable("msfconsole") + return os.getenv("msfconsole", False) or distutils.spawn.find_executable("msfconsole") def logo(): """