CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/data/msfcrawler/objects.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
require 'pathname'
7
require 'nokogiri'
8
require 'uri'
9
10
class CrawlerObjects < BaseParser
11
12
def parse(request,result)
13
return unless result['Content-Type'].include?('text/html') # TOOD: use MIXIN
14
hr = ''
15
m = ''
16
doc = Nokogiri::HTML(result.body.to_s)
17
doc.xpath("//object/embed").each do |obj|
18
s = obj['src']
19
begin
20
hreq = urltohash('GET', s, request['uri'], nil)
21
insertnewpath(hreq)
22
rescue URI::InvalidURIError
23
# ignored
24
end
25
end
26
end
27
28
end
29
30
31