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/frames.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 CrawlerFrames < BaseParser
11
12
def parse(request,result)
13
14
return unless result['Content-Type'].include?('text/html')
15
16
doc = Nokogiri::HTML(result.body.to_s)
17
doc.css('iframe').each do |ifra|
18
ir = ifra['src']
19
20
if ir && !ir.match(/^(\#|javascript\:)/)
21
begin
22
hreq = urltohash('GET', ir, request['uri'], nil)
23
insertnewpath(hreq)
24
rescue URI::InvalidURIError
25
# ignored
26
end
27
end
28
29
end
30
end
31
32
end
33
34
35