metasploit-framework/lib/anemone/extractors/meta_refresh.rb

25 lines
438 B
Ruby
Raw Normal View History

2012-11-01 19:18:05 +00:00
class Anemone::Extractors::MetaRefresh < Anemone::Extractors::Base
2012-11-16 21:11:48 +00:00
def run
doc.search( "//meta[@http-equiv='refresh']" ).map do |url|
begin
_, url = url['content'].split( ';', 2 )
next if !url
unquote( url.split( '=', 2 ).last )
rescue
next
end
end
rescue
nil
end
2012-11-01 19:18:05 +00:00
2012-11-16 21:11:48 +00:00
def unquote( str )
[ '\'', '"' ].each do |q|
return str[1...-1] if str.start_with?( q ) && str.end_with?( q )
end
str
end
2012-11-01 19:18:05 +00:00
end