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

49 lines
798 B
Ruby
Raw Normal View History

2010-05-03 17:13:09 +00:00
##
# $Id$
##
##
# 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/
##
# $Revision$
2010-04-07 03:32:50 +00:00
require 'rubygems'
require 'pathname'
require 'hpricot'
require 'uri'
class CrawlerObjects < BaseParser
def parse(request,result)
2010-05-03 17:13:09 +00:00
2010-04-07 03:32:50 +00:00
if !result['Content-Type'].include? "text/html"
return
end
2010-05-03 17:13:09 +00:00
2010-04-07 03:32:50 +00:00
hr = ''
m = ''
doc = Hpricot(result.body.to_s)
doc.search("//object/embed").each do |obj|
s = obj['src']
begin
2010-04-08 03:40:08 +00:00
hreq = urltohash('GET',s,request['uri'],nil)
2010-05-03 17:13:09 +00:00
2010-04-07 03:32:50 +00:00
insertnewpath(hreq)
2010-05-03 17:13:09 +00:00
2010-04-07 03:32:50 +00:00
rescue URI::InvalidURIError
#puts "Parse error"
#puts "Error: #{link[0]}"
end
2010-05-03 17:13:09 +00:00
end
end
2010-04-07 03:32:50 +00:00
end