Class: Arachni::Check::Manager
- Inherits:
-
Arachni::Component::Manager
- Object
- Hash
- Arachni::Component::Manager
- Arachni::Check::Manager
- Defined in:
- lib/arachni/check/manager.rb
Overview
Manages and runs Arachni::Checks against Pages.
Direct Known Subclasses
Defined Under Namespace
Classes: Error
Constant Summary collapse
Constants inherited from Arachni::Component::Manager
Arachni::Component::Manager::EXCLUDE, Arachni::Component::Manager::WILDCARD
Instance Attribute Summary
Attributes inherited from Arachni::Component::Manager
Class Method Summary collapse
Instance Method Summary collapse
- #[](name) ⇒ Check::Base
-
#initialize(framework) ⇒ Manager
constructor
A new instance of Manager.
- #reset ⇒ Object
- #run(page) ⇒ Object
-
#run_one(check, page) ⇒ Object
Runs a single ‘check` against `page`.
-
#schedule ⇒ Array
Checks in proper running order, taking account their declared preferences.
-
#with_platforms ⇒ Hash
Checks targeting specific platforms.
-
#without_platforms ⇒ Hash
Platform-agnostic checks.
Methods inherited from Arachni::Component::Manager
#available, #clear, #delete, #include?, #load, #load_all, #load_by_tags, #loaded, #name_to_path, #parse, #path_to_name, #paths, #prepare_options
Methods included from Utilities
#available_port, #caller_name, #caller_path, #cookie_decode, #cookie_encode, #cookies_from_document, #cookies_from_file, #cookies_from_response, #exception_jail, #exclude_path?, #follow_protocol?, #form_decode, #form_encode, #forms_from_document, #forms_from_response, #generate_token, #get_path, #hms_to_seconds, #html_decode, #html_encode, #include_path?, #links_from_document, #links_from_response, #normalize_url, #page_from_response, #page_from_url, #parse_set_cookie, #path_in_domain?, #path_too_deep?, #port_available?, #rand_port, #random_seed, #redundant_path?, #remove_constants, #request_parse_body, #seconds_to_hms, #skip_page?, #skip_path?, #skip_resource?, #skip_response?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parse_query, #uri_parser, #uri_rewrite
Methods included from UI::Output
#debug?, #debug_off, #debug_on, #disable_only_positives, #included, #mute, #muted?, #only_positives, #only_positives?, #print_bad, #print_debug, #print_debug_backtrace, #print_debug_level_1, #print_debug_level_2, #print_debug_level_3, #print_error, #print_error_backtrace, #print_exception, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?, reset_output_options, #unmute, #verbose?, #verbose_on
Methods inherited from Hash
#apply_recursively, #downcase, #find_symbol_keys_recursively, #my_stringify, #my_stringify_keys, #my_symbolize_keys, #recode, #stringify_recursively_and_freeze
Constructor Details
Class Method Details
Instance Method Details
#[](name) ⇒ Check::Base
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/arachni/check/manager.rb', line 59 def []( name ) check = super( name ) if !Platform::Manager.valid?( check.platforms ) unload name fail Error::InvalidPlatforms, "Check #{name} contains invalid platforms: #{check.platforms.join(', ')}" end check end |
#reset ⇒ Object
131 132 133 |
# File 'lib/arachni/check/manager.rb', line 131 def reset self.class.reset end |
#run(page) ⇒ Object
48 49 50 |
# File 'lib/arachni/check/manager.rb', line 48 def run( page ) schedule.each { |mod| exception_jail( false ){ run_one( mod, page ) } } end |
#run_one(check, page) ⇒ Object
Runs a single ‘check` against `page`.
119 120 121 122 123 124 125 126 |
# File 'lib/arachni/check/manager.rb', line 119 def run_one( check, page ) return false if !check.check?( page ) check_new = check.new( page, @framework ) check_new.prepare check_new.run check_new.clean_up end |
#schedule ⇒ Array
Returns Checks in proper running order, taking account their declared preferences.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/arachni/check/manager.rb', line 74 def schedule schedule = Set.new preferred_over = Hash.new([]) preferred = self.reject do |name, klass| preferred_over[name] = klass.preferred if klass.preferred.any? end return self.values if preferred_over.empty? || preferred.empty? preferred_over.size.times do update = {} preferred.each do |name, klass| schedule << klass preferred_over.select { |_, v| v.include?( name.to_sym ) }.each do |k, v| schedule << (update[k] = self[k]) end end preferred.merge!( update ) end schedule |= preferred_over.keys.map { |n| self[n] } schedule.to_a end |
#with_platforms ⇒ Hash
Returns Checks targeting specific platforms.
103 104 105 |
# File 'lib/arachni/check/manager.rb', line 103 def with_platforms select { |k, v| v.has_platforms? } end |
#without_platforms ⇒ Hash
Returns Platform-agnostic checks.
109 110 111 |
# File 'lib/arachni/check/manager.rb', line 109 def without_platforms select { |k, v| !v.has_platforms? } end |