Sha256: d00831653e498085a1b542d64fec38527a2a4dee955a2123d6695fb64e6ee25c

Contents?: true

Size: 1.79 KB

Versions: 6

Compression:

Stored size: 1.79 KB

Contents

=begin
    Copyright 2010-2015 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

module Arachni
module HTTP
class Response

# Determines the {Scope scope} status of {Response}s.
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class Scope < Message::Scope

    # {Scope} error namespace.
    #
    # All {Scope} errors inherit from and live under it.
    #
    # @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
    class Error < Message::Scope::Error
    end

    # @param    [Arachni::HTTP::Response]  response
    def initialize( response )
        super response

        @response = response
    end

    # @note Also takes into account the {URI::Scope} of the {Message#url}.
    #
    # @return   [Bool]
    #   `true` if the {Response} is out of {OptionGroups::Scope scope},
    #   `false` otherwise.
    #
    # @see #exclude_content?
    # @see #exclude_as_binary?
    def out?
        super || exclude_as_binary? || exclude_content?
    end

    # @return   [Bool]
    #   `true` if {OptionGroups::Scope#exclude_binaries?} and not {Response#text?},
    #   `false` otherwise.
    #
    # @see OptionGroups::Scope#exclude_binaries
    def exclude_as_binary?
        options.exclude_binaries? && !@response.text?
    end

    # @return   [Bool]
    #   `true` if {Message#body} matches an
    #   {OptionGroups::Scope#exclude_content_patterns} pattern, `false` otherwise.
    #
    # @see OptionGroups::Scope#exclude_content_patterns
    def exclude_content?
        !!options.exclude_content_patterns.find { |i| @response.body =~ i }
    end

end

end
end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arachni-1.3.2 lib/arachni/http/response/scope.rb
arachni-1.3.1 lib/arachni/http/response/scope.rb
arachni-1.3 lib/arachni/http/response/scope.rb
arachni-1.2.1 lib/arachni/http/response/scope.rb
arachni-1.2 lib/arachni/http/response/scope.rb
arachni-1.1 lib/arachni/http/response/scope.rb