Class: Arachni::ElementFilter
Overview
Constant Summary collapse
- TYPES =
[:links, :forms, :cookies]
Class Method Summary collapse
- .cookies ⇒ Support::LookUp::HashSet
- .cookies_include?(cookie) ⇒ Bool
- .forms ⇒ Support::LookUp::HashSet
- .forms_include?(form) ⇒ Bool
- .include?(element) ⇒ Bool
- .links ⇒ Support::LookUp::HashSet
- .links_include?(link) ⇒ Bool
- .reset ⇒ Object
-
.update_cookie(cookies) ⇒ Integer
Amount of new cookies.
-
.update_forms(forms) ⇒ Integer
Amount of new forms.
-
.update_from_page(page) ⇒ Integer
Amount of new elements.
-
.update_from_page_cache(page) ⇒ Integer
Updates the elements from the Page#cache, useful in situations where resources need to be preserved (thus avoiding a full page parse) and the need for a full coverage update isn’t vital.
-
.update_links(links) ⇒ Integer
Amount of new links.
Class Method Details
.cookies_include?(cookie) ⇒ Bool
|
# File 'lib/arachni/element_filter.rb', line 52
|
.forms_include?(form) ⇒ Bool
|
# File 'lib/arachni/element_filter.rb', line 40
|
.include?(element) ⇒ Bool
109 110 111 112 113 114 115 |
# File 'lib/arachni/element_filter.rb', line 109 def include?( element ) TYPES.each do |type| return true if send( "#{type}_include?", element ) end false end |
.links_include?(link) ⇒ Bool
|
# File 'lib/arachni/element_filter.rb', line 46
|
.reset ⇒ Object
22 23 24 25 26 |
# File 'lib/arachni/element_filter.rb', line 22 def reset @mutex = Mutex.new State.element_filter.clear nil end |
.update_cookie(cookies) ⇒ Integer
Returns Amount of new cookies.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/arachni/element_filter.rb', line 79 TYPES.each do |type| define_method type do State.element_filter.send type end define_method "#{type}_include?" do |element| send(type).include? element.id end define_method "update_#{type}" do |elements| elements = [elements].flatten.compact return 0 if elements.size == 0 synchronize do new_element_cnt = 0 elements.each do |element| next if send( "#{type}_include?", element ) send( "#{type}" ) << element.id new_element_cnt += 1 end new_element_cnt end end end |
.update_forms(forms) ⇒ Integer
Returns Amount of new forms.
|
# File 'lib/arachni/element_filter.rb', line 65
|
.update_from_page(page) ⇒ Integer
Returns Amount of new elements.
121 122 123 |
# File 'lib/arachni/element_filter.rb', line 121 def update_from_page( page ) TYPES.map { |type| send( "update_#{type}", page.send( type ) ) }.inject(&:+) end |
.update_from_page_cache(page) ⇒ Integer
Updates the elements from the Page#cache, useful in situations where resources need to be preserved (thus avoiding a full page parse) and the need for a full coverage update isn’t vital.
133 134 135 |
# File 'lib/arachni/element_filter.rb', line 133 def update_from_page_cache( page ) TYPES.map { |type| send( "update_#{type}", page.cache[type] ) }.inject(&:+) end |
.update_links(links) ⇒ Integer
Returns Amount of new links.
|
# File 'lib/arachni/element_filter.rb', line 58
|