Sha256: 542376f2c7d1613e3b94ec237b033e1f206af3f0231fbc135f5fde3fe3a2cf3f

Contents?: true

Size: 1.5 KB

Versions: 7

Compression:

Stored size: 1.5 KB

Contents

=begin
    Copyright 2010-2014 Tasos Laskos <tasos.laskos@arachni-scanner.com>

    This file is part of the Arachni Framework project and is subject to
    redistribution and commercial restrictions. Please see the Arachni Framework
    web site for more information on licensing and terms of use.
=end

require Arachni::Options.paths.lib + 'element/base'

module Arachni::Element

# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class Body < Base
    include Capabilities::WithAuditor

    def initialize( url )
        super url: url
        @initialization_options = url
    end

    # 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`.
    def match_and_log( patterns, &block )
        elements = auditor.class.info[:elements]
        elements = auditor.class::OPTIONS[:elements] if !elements || elements.empty?

        return if !elements.include?( Body )

        [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

end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arachni-1.0.6 lib/arachni/element/body.rb
arachni-1.0.5 lib/arachni/element/body.rb
arachni-1.0.4 lib/arachni/element/body.rb
arachni-1.0.3 lib/arachni/element/body.rb
arachni-1.0.2 lib/arachni/element/body.rb
arachni-1.0.1 lib/arachni/element/body.rb
arachni-1.0 lib/arachni/element/body.rb