mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-10-29 18:07:27 +01:00
Add [user_]logos_directory to Msf::Config
This commit is contained in:
parent
c765100efd
commit
82f41d56a6
@ -65,6 +65,7 @@ class Config < Hash
|
||||
'ModuleDirectory' => "modules",
|
||||
'ScriptDirectory' => "scripts",
|
||||
'LogDirectory' => "logs",
|
||||
'LogosDirectory' => "logos",
|
||||
'SessionLogDirectory' => "logs/sessions",
|
||||
'PluginDirectory' => "plugins",
|
||||
'DataDirectory' => "data",
|
||||
@ -92,6 +93,13 @@ class Config < Hash
|
||||
self.new.config_directory
|
||||
end
|
||||
|
||||
# Return the directory that logo files should be loaded from.
|
||||
#
|
||||
# @return [String] path to the logos directory.
|
||||
def self.logos_directory
|
||||
self.new.logos_directory
|
||||
end
|
||||
|
||||
# Returns the global module directory.
|
||||
#
|
||||
# @return [String] path to global module directory.
|
||||
@ -148,6 +156,13 @@ class Config < Hash
|
||||
self.new.local_directory
|
||||
end
|
||||
|
||||
# Return the user-specific directory that logo files should be loaded from.
|
||||
#
|
||||
# @return [String] path to the logos directory.
|
||||
def self.user_logos_directory
|
||||
self.new.user_logos_directory
|
||||
end
|
||||
|
||||
# Returns the user-specific module base path
|
||||
#
|
||||
# @return [String] path to user-specific modules directory.
|
||||
@ -231,6 +246,13 @@ class Config < Hash
|
||||
InstallRoot
|
||||
end
|
||||
|
||||
# Return the directory that logo files should be loaded from.
|
||||
#
|
||||
# @return [String] path to the logos directory.
|
||||
def logos_directory
|
||||
data_directory + FileSep + self['LogosDirectory']
|
||||
end
|
||||
|
||||
# Returns the configuration directory default.
|
||||
#
|
||||
# @return [String] the root configuration directory.
|
||||
@ -301,6 +323,13 @@ class Config < Hash
|
||||
config_directory + FileSep + self['LocalDirectory']
|
||||
end
|
||||
|
||||
# Return the user-specific directory that logo files should be loaded from.
|
||||
#
|
||||
# @return [String] path to the logos directory.
|
||||
def user_logos_directory
|
||||
config_directory + FileSep + self['LogosDirectory']
|
||||
end
|
||||
|
||||
# Returns the user-specific module base path
|
||||
#
|
||||
# @return [String] path to user-specific modules directory.
|
||||
@ -339,6 +368,7 @@ class Config < Hash
|
||||
FileUtils.mkdir_p(session_log_directory)
|
||||
FileUtils.mkdir_p(loot_directory)
|
||||
FileUtils.mkdir_p(local_directory)
|
||||
FileUtils.mkdir_p(user_logos_directory)
|
||||
FileUtils.mkdir_p(user_module_directory)
|
||||
FileUtils.mkdir_p(user_plugin_directory)
|
||||
end
|
||||
|
@ -31,9 +31,11 @@ module Banner
|
||||
# Returns a random metasploit logo.
|
||||
#
|
||||
def self.readfile(fname)
|
||||
base = File.expand_path(File.dirname(__FILE__))
|
||||
pathname = File.join(base, "logos", fname)
|
||||
fdata = "<< Missing banner: #{fname} >>"
|
||||
pathname = fname
|
||||
unless File.absolute_path(pathname) == pathname
|
||||
pathname = File.join(::Msf::Config.logos_directory, fname)
|
||||
end
|
||||
fdata = "<< Missing banner: #{pathname} >>"
|
||||
begin
|
||||
raise ArgumentError unless File.readable?(pathname)
|
||||
raise ArgumentError unless File.stat(pathname).size < 4096
|
||||
|
Loading…
Reference in New Issue
Block a user