class Arachni::Element::Body

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

Public Class Methods

new( url ) click to toggle source
Calls superclass method Arachni::Element::Base::new
# File lib/arachni/element/body.rb, line 17
def initialize( url )
    super url: url
    @initialization_options = url
end

Public Instance Methods

match_and_log( patterns, &block ) click to toggle source

Matches an array of regular expressions against a string and logs the result as an issue.

@param [Array<Regexp>] patterns

Array of regular expressions to be tested.

@param [Block] block

Block to verify matches before logging, must return `true`/`false`.
# File lib/arachni/element/body.rb, line 29
def match_and_log( patterns, &block )
    [patterns].flatten.each do |pattern|
        auditor.page.body.scan( pattern ).flatten.uniq.compact.each do |proof|
            next if block_given? && !block.call( proof )

            auditor.log(
                signature: pattern,
                proof:     proof,
                vector:    self
            )
        end
    end
end