class Arachni::ElementFilter

Filter for {Element elements}, used to keep track of what elements have been seen and separate them from new ones.

Mostly used by the {Trainer}.

@author Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com>

Constants

TYPES

Public Class Methods

include?( element ) click to toggle source

@param [Element::Base] element

@return [Bool]

# File lib/arachni/element_filter.rb, line 160
def include?( element )
    TYPES.each do |type|
        return true if send( "#{type}_include?", element )
    end

    false
end
reset() click to toggle source
# File lib/arachni/element_filter.rb, line 22
def reset
    @mutex = Mutex.new
    State.element_filter.clear
    nil
end
update_from_page( page ) click to toggle source

@param [Page] page

@return [Integer]

Amount of new elements.
# File lib/arachni/element_filter.rb, line 172
def update_from_page( page )
    TYPES.map { |type| send( "update_#{type}", page.send( type ) ) }.inject(&:+)
end
update_from_page_cache( page ) click to toggle source

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.

@param [Page] page

@return [Integer]

Amount of new elements.
# File lib/arachni/element_filter.rb, line 184
def update_from_page_cache( page )
    TYPES.map { |type| send( "update_#{type}", page.cache[type] ) }.inject(&:+)
end

Private Class Methods

synchronize( &block ) click to toggle source
# File lib/arachni/element_filter.rb, line 190
def synchronize( &block )
    @mutex.synchronize( &block )
end