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.

link.rb 805B

1234567891011121314151617181920212223242526272829303132333435
  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 CrawlerLink < 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('link').each do |link|
  17. hr = link['href']
  18. if hr && !hr.match(/^(\#|javascript\:)/)
  19. begin
  20. hreq = urltohash('GET', hr, request['uri'], nil)
  21. insertnewpath(hreq)
  22. rescue URI::InvalidURIError
  23. end
  24. end
  25. end
  26. end
  27. end