Sha256: 21fcdee96a1a2f9bc81d7b3d0c6b246ae80583159e964921c10f2cc5b1c09f4c

Contents?: true

Size: 1.77 KB

Versions: 5

Compression:

Stored size: 1.77 KB

Contents

=begin
    Copyright 2010-2022 Ecsypno <http://www.ecsypno.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

5 entries across 5 versions & 1 rubygems

Version Path
arachni-1.6.1.3 lib/arachni/http/response/scope.rb
arachni-1.6.1.2 lib/arachni/http/response/scope.rb
arachni-1.6.1.1 lib/arachni/http/response/scope.rb
arachni-1.6.1 lib/arachni/http/response/scope.rb
arachni-1.6.0 lib/arachni/http/response/scope.rb