Mirror of metasploit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

image.rb 799B

123456789101112131415161718192021222324252627282930313233343536
  1. ##
  2. # This file is part of the Metasploit Framework and may be subject to
  3. # redistribution and commercial restrictions. Please see the Metasploit
  4. # Framework web site for more information on licensing and terms of use.
  5. # http://metasploit.com/framework/
  6. ##
  7. # $Revision: 9212 $
  8. require 'rubygems'
  9. require 'pathname'
  10. require 'nokogiri'
  11. require 'uri'
  12. class CrawlerImage < BaseParser
  13. def parse(request,result)
  14. return unless result['Content-Type'].include?('text/html')
  15. doc = Nokogiri::HTML(result.body.to_s)
  16. doc.css('img').each do |i|
  17. im = i['src']
  18. if im && !im.match(/^(\#|javascript\:)/)
  19. begin
  20. hreq = urltohash('GET', im, request['uri'], nil)
  21. insertnewpath(hreq)
  22. rescue URI::InvalidURIError
  23. end
  24. end
  25. end
  26. end
  27. end