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'/>
|
# <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)
|
def self.passive_detection(url, type, wp_content_dir)
|
||||||
items = []
|
items = []
|
||||||
response = Browser.instance.get(url)
|
response = Browser.instance.get(url)
|
||||||
regex1 = %r{(?:[^=:]+)\s?(?:=|:)\s?(?:"|')[^"']+\\?/}
|
regex1 = %r{(?:[^=:]+)\s?(?:=|:)\s?(?:"|')[^"']+\\?/}
|
||||||
regex2 = %r{\\?/}
|
regex2 = %r{\\?/}
|
||||||
regex3 = %r{\\?/([^/\\"']+)\\?(?:/|"|')}
|
regex3 = %r{\\?/([^/\\"']+)\\?(?:/|"|')}
|
||||||
# Custom wp-content dir is now used in this regex
|
# 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.flatten!
|
||||||
names.uniq!
|
names.uniq!
|
||||||
|
|
||||||
names.each do |item|
|
names.each do |item|
|
||||||
items << WpItem.new(
|
items << WpItem.new(
|
||||||
:base_url => url,
|
:base_url => url,
|
||||||
:name => item,
|
:name => item,
|
||||||
:type => type,
|
:type => type,
|
||||||
:path => "#{item}/",
|
:path => "#{item}/",
|
||||||
:wp_content_dir => wp_content_dir,
|
:wp_content_dir => wp_content_dir,
|
||||||
:vulns_file => ""
|
:vulns_file => ""
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
items
|
items
|
||||||
|
|||||||
@@ -103,13 +103,13 @@ class WpEnumerator
|
|||||||
File.open(file, "r") do |f|
|
File.open(file, "r") do |f|
|
||||||
f.readlines.collect do |line|
|
f.readlines.collect do |line|
|
||||||
targets_url << WpItem.new(
|
targets_url << WpItem.new(
|
||||||
:base_url => url,
|
:base_url => url,
|
||||||
:path => line.strip,
|
:path => line.strip,
|
||||||
:wp_content_dir => wp_content_dir,
|
:wp_content_dir => wp_content_dir,
|
||||||
:name => File.dirname(line.strip),
|
:name => File.dirname(line.strip),
|
||||||
:vulns_file => vulns_file,
|
:vulns_file => vulns_file,
|
||||||
:type => type,
|
:type => type,
|
||||||
:wp_plugins_dir => plugins_dir
|
:wp_plugins_dir => plugins_dir
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -125,13 +125,13 @@ class WpEnumerator
|
|||||||
xml.xpath(options[:vulns_xpath_2]).each do |node|
|
xml.xpath(options[:vulns_xpath_2]).each do |node|
|
||||||
name = node.attribute("name").text
|
name = node.attribute("name").text
|
||||||
targets_url << WpItem.new(
|
targets_url << WpItem.new(
|
||||||
:base_url => url,
|
:base_url => url,
|
||||||
:path => name,
|
:path => name,
|
||||||
:wp_content_dir => wp_content_dir,
|
:wp_content_dir => wp_content_dir,
|
||||||
:name => name,
|
:name => name,
|
||||||
:vulns_file => vulns_file,
|
:vulns_file => vulns_file,
|
||||||
:type => type,
|
:type => type,
|
||||||
:wp_plugins_dir => plugins_dir
|
:wp_plugins_dir => plugins_dir
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user