cowardly continue using ~/.msf4 until we have an actual reason to switch

MS-2855/keylogger-mettle-extension
Brent Cook 2018-01-17 22:01:56 -06:00
parent facecb40d7
commit 06459e2dee
1 changed files with 7 additions and 3 deletions

View File

@ -33,20 +33,24 @@ class Config < Hash
return val return val
end end
# XXX Update this when there is a need to break compatibility
config_dir_major = 4
config_dir = ".msf#{config_dir_major}"
# Windows-specific environment variables # Windows-specific environment variables
['HOME', 'LOCALAPPDATA', 'APPDATA', 'USERPROFILE'].each do |dir| ['HOME', 'LOCALAPPDATA', 'APPDATA', 'USERPROFILE'].each do |dir|
val = Rex::Compat.getenv(dir) val = Rex::Compat.getenv(dir)
if (val and File.directory?(val)) if (val and File.directory?(val))
return File.join(val, ".msf#{Metasploit::Framework::Version::MAJOR}") return File.join(val, config_dir)
end end
end end
begin begin
# First we try $HOME/.msfx # First we try $HOME/.msfx
File.expand_path("~#{FileSep}.msf#{Metasploit::Framework::Version::MAJOR}") File.expand_path("~#{FileSep}#{config_dir}")
rescue ::ArgumentError rescue ::ArgumentError
# Give up and install root + ".msfx" # Give up and install root + ".msfx"
InstallRoot + ".msf#{Metasploit::Framework::Version::MAJOR}" InstallRoot + config_dir
end end
end end