Sha256: f08dbc3c46b59caac81c3491d0322d80b156dad4e8576382c9243d29cc42d546

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 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

# Extracts meta refresh URLs.
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
# @version 0.2
class Arachni::Parser::Extractors::MetaRefresh < Arachni::Parser::Extractors::Base

    def run
        return [] if !includes?( 'http-equiv' )

        document.search( "//meta[
                translate(
                    @http-equiv,
                        'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                        'abcdefghijklmnopqrstuvwxyz'
                    ) = 'refresh'
            ]" ).map do |url|
            begin
                _, url = url['content'].split( ';', 2 )
                next if !url
                unquote( url.split( '=', 2 ).last )
            rescue
                next
            end
        end
    end

    def unquote( str )
        [ '\'', '"' ].each do |q|
            return str[1...-1] if str.start_with?( q ) && str.end_with?( q )
        end
        str
    end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arachni-1.3.2 components/path_extractors/meta_refresh.rb
arachni-1.3.1 components/path_extractors/meta_refresh.rb
arachni-1.3 components/path_extractors/meta_refresh.rb
arachni-1.2.1 components/path_extractors/meta_refresh.rb
arachni-1.2 components/path_extractors/meta_refresh.rb