Class: Arachni::OptionGroups::Paths
- Inherits:
-
Arachni::OptionGroup
- Object
- Arachni::OptionGroup
- Arachni::OptionGroups::Paths
- Defined in:
- lib/arachni/option_groups/paths.rb
Overview
Holds paths to the directories of various system components.
Instance Attribute Summary collapse
-
#arachni ⇒ Object
Returns the value of attribute arachni.
-
#checks ⇒ Object
Returns the value of attribute checks.
-
#components ⇒ Object
Returns the value of attribute components.
-
#executables ⇒ Object
Returns the value of attribute executables.
-
#fingerprinters ⇒ Object
Returns the value of attribute fingerprinters.
-
#gfx ⇒ Object
Returns the value of attribute gfx.
-
#lib ⇒ Object
Returns the value of attribute lib.
-
#logs ⇒ Object
Returns the value of attribute logs.
-
#mixins ⇒ Object
Returns the value of attribute mixins.
-
#path_extractors ⇒ Object
Returns the value of attribute path_extractors.
-
#plugins ⇒ Object
Returns the value of attribute plugins.
-
#reporters ⇒ Object
Returns the value of attribute reporters.
-
#root ⇒ Object
Returns the value of attribute root.
-
#services ⇒ Object
Returns the value of attribute services.
-
#snapshots ⇒ Object
Returns the value of attribute snapshots.
-
#support ⇒ Object
Returns the value of attribute support.
Class Method Summary collapse
- .clear_config_cache ⇒ Object
- .config ⇒ Object
- .paths_config_file ⇒ Object
-
.root_path ⇒ String
Root path of the framework.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize ⇒ Paths
constructor
A new instance of Paths.
- #root_path ⇒ Object
- #tmpdir ⇒ Object
Methods inherited from Arachni::OptionGroup
#==, attr_accessor, attributes, #attributes, defaults, #defaults, #hash, inherited, #merge, set_defaults, #to_h, #to_hash, #to_rpc_data, #update, #validate
Constructor Details
#initialize ⇒ Paths
Returns a new instance of Paths.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# 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 |
Instance Attribute Details
#arachni ⇒ Object
Returns the value of attribute arachni.
20 21 22 |
# File 'lib/arachni/option_groups/paths.rb', line 20 def arachni @arachni end |
#checks ⇒ Object
Returns the value of attribute checks.
25 26 27 |
# File 'lib/arachni/option_groups/paths.rb', line 25 def checks @checks end |
#components ⇒ Object
Returns the value of attribute components.
22 23 24 |
# File 'lib/arachni/option_groups/paths.rb', line 22 def components @components end |
#executables ⇒ Object
Returns the value of attribute executables.
24 25 26 |
# File 'lib/arachni/option_groups/paths.rb', line 24 def executables @executables end |
#fingerprinters ⇒ Object
Returns the value of attribute fingerprinters.
30 31 32 |
# File 'lib/arachni/option_groups/paths.rb', line 30 def fingerprinters @fingerprinters end |
#gfx ⇒ Object
Returns the value of attribute gfx.
21 22 23 |
# File 'lib/arachni/option_groups/paths.rb', line 21 def gfx @gfx end |
#lib ⇒ Object
Returns the value of attribute lib.
31 32 33 |
# File 'lib/arachni/option_groups/paths.rb', line 31 def lib @lib end |
#logs ⇒ Object
Returns the value of attribute logs.
23 24 25 |
# File 'lib/arachni/option_groups/paths.rb', line 23 def logs @logs end |
#mixins ⇒ Object
Returns the value of attribute mixins.
33 34 35 |
# File 'lib/arachni/option_groups/paths.rb', line 33 def mixins @mixins end |
#path_extractors ⇒ Object
Returns the value of attribute path_extractors.
29 30 31 |
# File 'lib/arachni/option_groups/paths.rb', line 29 def path_extractors @path_extractors end |
#plugins ⇒ Object
Returns the value of attribute plugins.
27 28 29 |
# File 'lib/arachni/option_groups/paths.rb', line 27 def plugins @plugins end |
#reporters ⇒ Object
Returns the value of attribute reporters.
26 27 28 |
# File 'lib/arachni/option_groups/paths.rb', line 26 def reporters @reporters end |
#root ⇒ Object
Returns the value of attribute root.
19 20 21 |
# File 'lib/arachni/option_groups/paths.rb', line 19 def root @root end |
#services ⇒ Object
Returns the value of attribute services.
28 29 30 |
# File 'lib/arachni/option_groups/paths.rb', line 28 def services @services end |
#snapshots ⇒ Object
Returns the value of attribute snapshots.
34 35 36 |
# File 'lib/arachni/option_groups/paths.rb', line 34 def snapshots @snapshots end |
#support ⇒ Object
Returns the value of attribute support.
32 33 34 |
# File 'lib/arachni/option_groups/paths.rb', line 32 def support @support end |
Class Method Details
.clear_config_cache ⇒ Object
97 98 99 |
# File 'lib/arachni/option_groups/paths.rb', line 97 def self.clear_config_cache @config = nil end |
.config ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# 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 |
.paths_config_file ⇒ Object
93 94 95 |
# 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 ⇒ String
Returns Root path of the framework.
75 76 77 |
# File 'lib/arachni/option_groups/paths.rb', line 75 def self.root_path File.( File.dirname( __FILE__ ) + '/../../..' ) + '/' end |
Instance Method Details
#config ⇒ Object
89 90 91 |
# File 'lib/arachni/option_groups/paths.rb', line 89 def config self.class.config end |
#root_path ⇒ Object
70 71 72 |
# File 'lib/arachni/option_groups/paths.rb', line 70 def root_path self.class.root_path end |
#tmpdir ⇒ Object
79 80 81 82 83 84 85 86 87 |
# 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 |