class Arachni::OptionGroups::Paths
Holds paths to the directories of various system components.
@author Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com>
Attributes
arachni[RW]
checks[RW]
components[RW]
executables[RW]
fingerprinters[RW]
gfx[RW]
lib[RW]
logs[RW]
mixins[RW]
path_extractors[RW]
plugins[RW]
reporters[RW]
root[RW]
services[RW]
snapshots[RW]
support[RW]
Public Class Methods
clear_config_cache()
click to toggle source
# File lib/arachni/option_groups/paths.rb, line 97 def self.clear_config_cache @config = nil end
config()
click to toggle source
# File lib/arachni/option_groups/paths.rb, line 101 def self.config return @config if @config if !File.exist?( paths_config_file ) @config = {} else @config = YAML.load( IO.read( paths_config_file ) ) end @config['framework'] ||= {} @config['cli'] ||= {} @config.dup.each do |category, config| config.dup.each do |subcat, dir| if dir.to_s.empty? @config[category].delete subcat next end dir = Arachni.get_long_win32_filename( dir ) if !Arachni.windows? dir.gsub!( '~', ENV['HOME'] ) end dir << '/' if !dir.end_with?( '/' ) @config[category][subcat] = dir FileUtils.mkdir_p dir end end @config end
new()
click to toggle source
# File lib/arachni/option_groups/paths.rb, line 36 def initialize @root = root_path @gfx = @root + 'gfx/' @components = @root + 'components/' if self.class.config['framework']['snapshots'] @snapshots = self.class.config['framework']['snapshots'] else @snapshots = @root + 'snapshots/' end if ENV['ARACHNI_FRAMEWORK_LOGDIR'] @logs = "#{ENV['ARACHNI_FRAMEWORK_LOGDIR']}/" elsif self.class.config['framework']['logs'] @logs = self.class.config['framework']['logs'] else @logs = "#{@root}logs/" end @checks = @components + 'checks/' @reporters = @components + 'reporters/' @plugins = @components + 'plugins/' @services = @components + 'services/' @path_extractors = @components + 'path_extractors/' @fingerprinters = @components + 'fingerprinters/' @lib = @root + 'lib/arachni/' @executables = @lib + 'processes/executables/' @support = @lib + 'support/' @mixins = @support + 'mixins/' @arachni = @lib[0...-1] end
paths_config_file()
click to toggle source
# File lib/arachni/option_groups/paths.rb, line 93 def self.paths_config_file Arachni.get_long_win32_filename "#{root_path}config/write_paths.yml" end
root_path()
click to toggle source
@return [String] Root path of the framework.
# File lib/arachni/option_groups/paths.rb, line 75 def self.root_path File.expand_path( File.dirname( __FILE__ ) + '/../../..' ) + '/' end
Public Instance Methods
config()
click to toggle source
# File lib/arachni/option_groups/paths.rb, line 89 def config self.class.config end
root_path()
click to toggle source
# File lib/arachni/option_groups/paths.rb, line 70 def root_path self.class.root_path end
tmpdir()
click to toggle source
# File lib/arachni/option_groups/paths.rb, line 79 def tmpdir if config['framework']['tmpdir'].to_s.empty? # On MS Windows Dir.tmpdir can return the path with a shortname, # better avoid that as it can be insonsistent with other paths. Arachni.get_long_win32_filename( Dir.tmpdir ) else Arachni.get_long_win32_filename( config['framework']['tmpdir'] ) end end