Files
metasploit-gs/data/msfcrawler/frames.rb
T

42 lines
812 B
Ruby
Raw Normal View History

2010-06-06 03:48:25 +00:00
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'rubygems'
require 'pathname'
require 'hpricot'
require 'uri'
class CrawlerFrames < BaseParser
2013-09-30 13:47:53 -05:00
def parse(request,result)
2010-06-06 03:48:25 +00:00
2013-09-30 13:47:53 -05:00
if !result['Content-Type'].include? "text/html"
return
end
2010-06-06 03:48:25 +00:00
2013-09-30 13:47:53 -05:00
doc = Hpricot(result.body.to_s)
doc.search('iframe').each do |ifra|
2010-06-06 03:48:25 +00:00
2013-09-30 13:47:53 -05:00
ir = ifra.attributes['src']
2010-06-06 03:48:25 +00:00
2013-09-30 13:47:53 -05:00
if ir and !ir.match(/^(\#|javascript\:)/)
begin
hreq = urltohash('GET',ir,request['uri'],nil)
2010-06-06 03:48:25 +00:00
2013-09-30 13:47:53 -05:00
insertnewpath(hreq)
2010-06-06 03:48:25 +00:00
2013-09-30 13:47:53 -05:00
rescue URI::InvalidURIError
#puts "Error"
end
end
end
end
2010-06-06 03:48:25 +00:00
end