Class: Arachni::Parser::Extractors::MetaRefresh

Inherits:
Base
  • Object
show all
Defined in:
components/path_extractors/meta_refresh.rb

Overview

Extracts meta refresh URLs.

Author:

Instance Attribute Summary

Attributes inherited from Base

#downcased_html, #html, #parser

Instance Method Summary collapse

Methods inherited from Base

#check_for?, #document, #initialize

Constructor Details

This class inherits a constructor from Arachni::Parser::Extractors::Base

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'components/path_extractors/meta_refresh.rb', line 14

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

    document.nodes_by_attribute_name_and_value( 'http-equiv', 'refresh' ).
        map do |url|
            begin
                _, url = url['content'].split( ';', 2 )
                next if !url
                unquote( url.split( '=', 2 ).last.strip )
            rescue
                next
            end
        end
end

#unquote(str) ⇒ Object



29
30
31
32
33
34
# File 'components/path_extractors/meta_refresh.rb', line 29

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