1## 2# This file is part of WhatWeb and may be subject to 3# redistribution and commercial restrictions. Please see the WhatWeb 4# web site for more information on licensing and terms of use. 5# http://www.morningstarsecurity.com/research/whatweb 6## 7Plugin.define "Subdomains" do 8author "Brendan Coles <bcoles@gmail.com>" # 2010-10-18 9version "0.1" 10description "This plugin finds and extracts subdomains from the href and src parameters of any HTML elements it finds." 11 12 13 14# Passive # 15def passive 16 m=[] 17 18 # Extract subdomains 19 if @body =~ /<[^>]+[href|src][\s]*=[\s]*[\'|\"]?http:\/\/([^\/^\'^\"^\s^>]+)\.#{Regexp.escape(@base_uri.to_s.gsub("http://www.", "").gsub("http://", "").split('/')[0])}/i 20 string=@body.scan(/<[^>]+[href|src]+[\s]*=[\s]*[\'|\"]?http:\/\/([^\/^\'^\"^\s^>]+)\.#{Regexp.escape(@base_uri.to_s.gsub("http://www.", "").gsub("http://", "").split('/')[0])}/i) 21 m << { :string=>string.uniq } 22 end 23 24 # Return passive matches 25 m 26end 27 28end 29 30