Indentation
This commit is contained in:
@@ -50,25 +50,25 @@ class WpDetector
|
||||
# <link rel='stylesheet' href='http://example.com/wp-content/plugins/wp-minify/..' type='text/css' media='screen'/>
|
||||
# ...
|
||||
def self.passive_detection(url, type, wp_content_dir)
|
||||
items = []
|
||||
response = Browser.instance.get(url)
|
||||
regex1 = %r{(?:[^=:]+)\s?(?:=|:)\s?(?:"|')[^"']+\\?/}
|
||||
regex2 = %r{\\?/}
|
||||
regex3 = %r{\\?/([^/\\"']+)\\?(?:/|"|')}
|
||||
items = []
|
||||
response = Browser.instance.get(url)
|
||||
regex1 = %r{(?:[^=:]+)\s?(?:=|:)\s?(?:"|')[^"']+\\?/}
|
||||
regex2 = %r{\\?/}
|
||||
regex3 = %r{\\?/([^/\\"']+)\\?(?:/|"|')}
|
||||
# Custom wp-content dir is now used in this regex
|
||||
names = response.body.scan(/#{regex1}#{Regexp.escape(wp_content_dir)}#{regex2}#{Regexp.escape(type)}#{regex3}/i)
|
||||
names = response.body.scan(/#{regex1}#{Regexp.escape(wp_content_dir)}#{regex2}#{Regexp.escape(type)}#{regex3}/i)
|
||||
|
||||
names.flatten!
|
||||
names.uniq!
|
||||
|
||||
names.each do |item|
|
||||
items << WpItem.new(
|
||||
:base_url => url,
|
||||
:name => item,
|
||||
:type => type,
|
||||
:path => "#{item}/",
|
||||
:wp_content_dir => wp_content_dir,
|
||||
:vulns_file => ""
|
||||
:base_url => url,
|
||||
:name => item,
|
||||
:type => type,
|
||||
:path => "#{item}/",
|
||||
:wp_content_dir => wp_content_dir,
|
||||
:vulns_file => ""
|
||||
)
|
||||
end
|
||||
items
|
||||
|
||||
@@ -103,13 +103,13 @@ class WpEnumerator
|
||||
File.open(file, "r") do |f|
|
||||
f.readlines.collect do |line|
|
||||
targets_url << WpItem.new(
|
||||
:base_url => url,
|
||||
:path => line.strip,
|
||||
:wp_content_dir => wp_content_dir,
|
||||
:name => File.dirname(line.strip),
|
||||
:vulns_file => vulns_file,
|
||||
:type => type,
|
||||
:wp_plugins_dir => plugins_dir
|
||||
:base_url => url,
|
||||
:path => line.strip,
|
||||
:wp_content_dir => wp_content_dir,
|
||||
:name => File.dirname(line.strip),
|
||||
:vulns_file => vulns_file,
|
||||
:type => type,
|
||||
:wp_plugins_dir => plugins_dir
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -125,13 +125,13 @@ class WpEnumerator
|
||||
xml.xpath(options[:vulns_xpath_2]).each do |node|
|
||||
name = node.attribute("name").text
|
||||
targets_url << WpItem.new(
|
||||
:base_url => url,
|
||||
:path => name,
|
||||
:wp_content_dir => wp_content_dir,
|
||||
:name => name,
|
||||
:vulns_file => vulns_file,
|
||||
:type => type,
|
||||
:wp_plugins_dir => plugins_dir
|
||||
:base_url => url,
|
||||
:path => name,
|
||||
:wp_content_dir => wp_content_dir,
|
||||
:name => name,
|
||||
:vulns_file => vulns_file,
|
||||
:type => type,
|
||||
:wp_plugins_dir => plugins_dir
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user