Module: WpTarget::InterestingHeaders
+ Module: WebSite::InterestingHeaders
@@ -78,12 +78,12 @@
- Included in:
- - WpTarget
+ - WebSite
- Defined in:
- - lib/wpscan/wp_target/interesting_headers.rb
+ - lib/wpscan/web_site/interesting_headers.rb
@@ -106,7 +106,7 @@
-
- + (Object) known_headers
+ + (Array) known_headers
@@ -120,9 +120,7 @@
-
-
Array.
-
+
@@ -139,7 +137,7 @@
-
- - (Object) interesting_headers
+ - (Array) interesting_headers
@@ -172,7 +170,7 @@
- + (Object) known_headers (protected)
+ + (Array) known_headers (protected)
@@ -181,8 +179,6 @@
-Array
-
@@ -194,15 +190,10 @@
-
-
+ (Array)
-
-
-
Array
-
-
@@ -213,12 +204,6 @@
-19
-20
-21
-22
-23
-24
25
26
27
@@ -227,10 +212,18 @@
30
31
32
-33
+33
+34
+35
+36
+37
+38
+39
+40
+41
- # File 'lib/wpscan/wp_target/interesting_headers.rb', line 19
+ # File 'lib/wpscan/web_site/interesting_headers.rb', line 25
def self.known_headers
%w{
@@ -245,6 +238,8 @@
Pragma
Vary
Cache-Control
+ X-Pingback
+ Accept-Ranges
}
end
@@ -261,7 +256,7 @@
- - (Object) interesting_headers
+ - (Array) interesting_headers
@@ -277,6 +272,24 @@
@@ -284,25 +297,35 @@
-7
8
9
10
11
12
13
-14
+14
+15
+16
+17
+18
+19
+20
- # File 'lib/wpscan/wp_target/interesting_headers.rb', line 7
+ # File 'lib/wpscan/web_site/interesting_headers.rb', line 8
def interesting_headers
response = Browser.head(@uri.to_s)
headers = response.headers
- InterestingHeaders.known_headers.each do |h|
- headers.delete(h)
+ # Header Names are case insensitve so convert them to upcase
+ headers_uppercase = headers.inject({}) do |hash, keys|
+ hash[keys[0].upcase] = keys[1]
+ hash
end
- headers.to_a.compact.sort
+ InterestingHeaders.known_headers.each do |h|
+ headers_uppercase.delete(h.upcase)
+ end
+ headers_uppercase.to_a.compact.sort
end
@@ -314,7 +337,7 @@
diff --git a/doc_yard/WebSite/RobotsTxt.html b/doc_yard/WebSite/RobotsTxt.html
new file mode 100644
index 00000000..172415dd
--- /dev/null
+++ b/doc_yard/WebSite/RobotsTxt.html
@@ -0,0 +1,516 @@
+
+
+
+
+
+ Module: WebSite::RobotsTxt
+
+ — Documentation by YARD 0.8.5.2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Module: WebSite::RobotsTxt
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Included in:
+ - WebSite
+
+
+
+ - Defined in:
+ - lib/wpscan/web_site/robots_txt.rb
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Class Method Summary
+ (collapse)
+
+
+
+
+ -
+
+
+ + (Array) known_dirs
+
+
+
+
+
+
+
+ protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Instance Method Summary
+ (collapse)
+
+
+
+
+ -
+
+
+ - (Boolean) has_robots?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checks if a robots.txt file exists.
+
+
+
+
+
+ -
+
+
+ - (Array) parse_robots_txt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parse robots.txt.
+
+
+
+
+
+ -
+
+
+ - (String) robots_url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Gets a robots.txt URL.
+
+
+
+
+
+
+
+
+
+
+
+ Class Method Details
+
+
+
+
+
+ + (Array) known_dirs (protected)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+54
+55
+56
+57
+58
+59
+60
+61
+
+
+ # File 'lib/wpscan/web_site/robots_txt.rb', line 54
+
+def self.known_dirs
+ %w{
+ /
+ /wp-admin/
+ /wp-includes/
+ /wp-content/
+ }
+end
+
+
+
+
+
+
+
+
+ Instance Method Details
+
+
+
+
+
+ - (Boolean) has_robots?
+
+
+
+
+
+
+
+
+Checks if a robots.txt file exists
+
+
+
+
+
+
+
+
+
+
+8
+9
+10
+
+
+ # File 'lib/wpscan/web_site/robots_txt.rb', line 8
+
+def has_robots?
+ Browser.get(robots_url).code == 200
+end
+
+
+
+
+
+
+
+
+ - (Array) parse_robots_txt
+
+
+
+
+
+
+
+
+Parse robots.txt
+
+
+
+
+
+
+
+
+
+
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+
+
+ # File 'lib/wpscan/web_site/robots_txt.rb', line 23
+
+def parse_robots_txt
+ return unless has_robots?
+
+ return_object = []
+ response = Browser.get(robots_url.to_s)
+ body = response.body
+ # Get all allow and disallow urls
+ entries = body.scan(/^(?:dis)?allow:\s*(.*)$/i)
+ if entries
+ entries.flatten!
+ entries.compact.sort!
+ wordpress_path = @uri.path
+ RobotsTxt.known_dirs.each do |d|
+ entries.delete(d)
+ # also delete when wordpress is installed in subdir
+ dir_with_subdir = "#{wordpress_path}/#{d}".gsub(/\/+/, '/')
+ entries.delete(dir_with_subdir)
+ end
+
+ entries.each do |d|
+ temp = @uri.clone
+ temp.path = d
+ return_object << temp.to_s
+ end
+ end
+ return_object
+end
+
+
+
+
+
+
+
+
+ - (String) robots_url
+
+
+
+
+
+
+
+
+Gets a robots.txt URL
+
+
+
+
+
+
+
+
+
+
+14
+15
+16
+17
+18
+
+
+ # File 'lib/wpscan/web_site/robots_txt.rb', line 14
+
+def robots_url
+ temp = @uri.clone
+ temp.path = '/robots.txt'
+ temp.to_s
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doc_yard/WpItem.html b/doc_yard/WpItem.html
index 537db4e2..946280c1 100644
--- a/doc_yard/WpItem.html
+++ b/doc_yard/WpItem.html
@@ -570,7 +570,7 @@
Methods included from Vulnerable
- #vulnerabilities, #vulnerable_to?
+ #vulnerabilities, #vulnerable?, #vulnerable_to?
@@ -1420,7 +1420,7 @@
diff --git a/doc_yard/WpItem/Existable.html b/doc_yard/WpItem/Existable.html
index 4f646d65..bf61bb20 100644
--- a/doc_yard/WpItem/Existable.html
+++ b/doc_yard/WpItem/Existable.html
@@ -412,7 +412,7 @@ for the verification Otherwise a new request is done
diff --git a/doc_yard/WpItem/Findable.html b/doc_yard/WpItem/Findable.html
index 49b039ea..eaa0e73c 100644
--- a/doc_yard/WpItem/Findable.html
+++ b/doc_yard/WpItem/Findable.html
@@ -100,7 +100,7 @@
diff --git a/doc_yard/WpItem/Infos.html b/doc_yard/WpItem/Infos.html
index ed17882f..92190024 100644
--- a/doc_yard/WpItem/Infos.html
+++ b/doc_yard/WpItem/Infos.html
@@ -777,7 +777,7 @@ href="http://www.exploit-db.com/ghdb/3714">www.exploit-db.com/ghdb/3714/
diff --git a/doc_yard/WpItem/Output.html b/doc_yard/WpItem/Output.html
index 2dbe3eca..ffc2eec3 100644
--- a/doc_yard/WpItem/Output.html
+++ b/doc_yard/WpItem/Output.html
@@ -215,7 +215,7 @@
diff --git a/doc_yard/WpItem/Versionable.html b/doc_yard/WpItem/Versionable.html
index 42350f30..5549d74e 100644
--- a/doc_yard/WpItem/Versionable.html
+++ b/doc_yard/WpItem/Versionable.html
@@ -290,7 +290,7 @@
diff --git a/doc_yard/WpItem/Vulnerable.html b/doc_yard/WpItem/Vulnerable.html
index 081c9313..8b2fa611 100644
--- a/doc_yard/WpItem/Vulnerable.html
+++ b/doc_yard/WpItem/Vulnerable.html
@@ -184,6 +184,28 @@
vulnerabilities.
+
+
+
+ -
+
+
+ - (Boolean) vulnerable?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -382,6 +404,58 @@ vulnerabilities
+
+
+
+
+
+ - (Boolean) vulnerable?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+24
+25
+26
+
+
+ # File 'lib/common/models/wp_item/vulnerable.rb', line 24
+
+def vulnerable?
+ vulnerabilities.empty? ? false : true
+end
+
+
+
@@ -443,19 +517,19 @@ vulnerabilities
-29
-30
-31
-32
33
34
35
36
37
-38
+38
+39
+40
+41
+42
- # File 'lib/common/models/wp_item/vulnerable.rb', line 29
+ # File 'lib/common/models/wp_item/vulnerable.rb', line 33
def vulnerable_to?(vuln)
if version && vuln && vuln.fixed_in && !vuln.fixed_in.empty?
@@ -477,7 +551,7 @@ vulnerabilities
diff --git a/doc_yard/WpItems.html b/doc_yard/WpItems.html
index 1edd4dba..87c7fe46 100644
--- a/doc_yard/WpItems.html
+++ b/doc_yard/WpItems.html
@@ -304,7 +304,7 @@
Methods included from Detectable
- aggressive_detection, item_options, passive_detection, progress_bar, request_params, targets_items, targets_items_from_file, vulnerable_targets_items
+ aggressive_detection, passive_detection, passive_detection_pattern, progress_bar, request_params, targets_items, targets_items_from_file, vulnerable_targets_items
@@ -761,7 +761,7 @@
diff --git a/doc_yard/WpItems/Detectable.html b/doc_yard/WpItems/Detectable.html
index 0fef91da..3eabef5d 100644
--- a/doc_yard/WpItems/Detectable.html
+++ b/doc_yard/WpItems/Detectable.html
@@ -227,28 +227,6 @@
-
-
-
-
-
-
-
-
-
- - (Hash) item_options(wp_target)
-
-
-
-
-
-
-
- protected
-
-
-
-
-
@@ -271,6 +249,28 @@
+
+
+
+
+
+ -
+
+
+ - (Regex) passive_detection_pattern(wp_target)
+
+
+
+
+
+
+
+ protected
+
+
+
+
+
@@ -635,7 +635,9 @@
46
47
48
-49
+49
+50
+51
# File 'lib/common/collections/wp_items/detectable.rb', line 15
@@ -663,7 +665,9 @@
if target_item.exists?(, response)
if !results.include?(target_item)
- results << target_item
+ if ![:only_vulnerable] || [:only_vulnerable] && target_item.vulnerable?
+ results << target_item
+ end
end
end
end
@@ -780,18 +784,18 @@
+153
+154
+155
+156
+157
+158
+159
160
-161
-162
-163
-164
-165
-166
-167
-168
+161
- # File 'lib/common/collections/wp_items/detectable.rb', line 160
+ # File 'lib/common/collections/wp_items/detectable.rb', line 153
def create_item(klass, name, wp_target, vulns_file = nil)
klass.new(
@@ -844,12 +848,12 @@
-193
-194
-195
+186
+187
+188
- # File 'lib/common/collections/wp_items/detectable.rb', line 193
+ # File 'lib/common/collections/wp_items/detectable.rb', line 186
def item_class
Object.const_get(self.to_s.gsub(/.$/, ''))
@@ -857,81 +861,6 @@
Module: WebSite::InterestingHeaders
@@ -78,12 +78,12 @@
- Included in:
- - WpTarget
+ - WebSite
- Defined in:
- - lib/wpscan/wp_target/interesting_headers.rb
+ - lib/wpscan/web_site/interesting_headers.rb
@@ -106,7 +106,7 @@
Array.
-- + (Object) known_headers (protected) + + (Array) known_headers (protected) @@ -181,8 +179,6 @@
Array
-Array
--19 -20 -21 -22 -23 -24 25 26 27 @@ -227,10 +212,18 @@ 30 31 32 -33+33 +34 +35 +36 +37 +38 +39 +40 +41
# File 'lib/wpscan/wp_target/interesting_headers.rb', line 19 +# File 'lib/wpscan/web_site/interesting_headers.rb', line 25 def self.known_headers %w{ @@ -245,6 +238,8 @@ Pragma Vary Cache-Control + X-Pingback + Accept-Ranges } end
- - (Object) interesting_headers + - (Array) interesting_headers @@ -277,6 +272,24 @@
- # File 'lib/wpscan/wp_target/interesting_headers.rb', line 7 +# File 'lib/wpscan/web_site/interesting_headers.rb', line 8 def interesting_headers response = Browser.head(@uri.to_s) headers = response.headers - InterestingHeaders.known_headers.each do |h| - headers.delete(h) + # Header Names are case insensitve so convert them to upcase + headers_uppercase = headers.inject({}) do |hash, keys| + hash[keys[0].upcase] = keys[1] + hash end - headers.to_a.compact.sort + InterestingHeaders.known_headers.each do |h| + headers_uppercase.delete(h.upcase) + end + headers_uppercase.to_a.compact.sort end |
+ + + +54 +55 +56 +57 +58 +59 +60 +61+ |
+
+ # File 'lib/wpscan/web_site/robots_txt.rb', line 54 + +def self.known_dirs + %w{ + / + /wp-admin/ + /wp-includes/ + /wp-content/ + } +end+ |
+
Instance Method Details
+ + ++ + - (Boolean) has_robots? + + + + + +
Checks if a robots.txt file exists
+ + +
+ + + +8 +9 +10+ |
+
+ # File 'lib/wpscan/web_site/robots_txt.rb', line 8 + +def has_robots? + Browser.get(robots_url).code == 200 +end+ |
+
+ + - (Array) parse_robots_txt + + + + + +
Parse robots.txt
+ + +
+ + + +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49+ |
+
+ # File 'lib/wpscan/web_site/robots_txt.rb', line 23 + +def parse_robots_txt + return unless has_robots? + + return_object = [] + response = Browser.get(robots_url.to_s) + body = response.body + # Get all allow and disallow urls + entries = body.scan(/^(?:dis)?allow:\s*(.*)$/i) + if entries + entries.flatten! + entries.compact.sort! + wordpress_path = @uri.path + RobotsTxt.known_dirs.each do |d| + entries.delete(d) + # also delete when wordpress is installed in subdir + dir_with_subdir = "#{wordpress_path}/#{d}".gsub(/\/+/, '/') + entries.delete(dir_with_subdir) + end + + entries.each do |d| + temp = @uri.clone + temp.path = d + return_object << temp.to_s + end + end + return_object +end+ |
+
+ + - (String) robots_url + + + + + +
Gets a robots.txt URL
+ + +
+ + + +14 +15 +16 +17 +18+ |
+
+ # File 'lib/wpscan/web_site/robots_txt.rb', line 14 + +def robots_url + temp = @uri.clone + temp.path = '/robots.txt' + temp.to_s +end+ |
+
Methods included from Vulnerable
-#vulnerabilities, #vulnerable_to?
+#vulnerabilities, #vulnerable?, #vulnerable_to?
@@ -1420,7 +1420,7 @@ diff --git a/doc_yard/WpItem/Existable.html b/doc_yard/WpItem/Existable.html index 4f646d65..bf61bb20 100644 --- a/doc_yard/WpItem/Existable.html +++ b/doc_yard/WpItem/Existable.html @@ -412,7 +412,7 @@ for the verification Otherwise a new request is done diff --git a/doc_yard/WpItem/Findable.html b/doc_yard/WpItem/Findable.html index 49b039ea..eaa0e73c 100644 --- a/doc_yard/WpItem/Findable.html +++ b/doc_yard/WpItem/Findable.html @@ -100,7 +100,7 @@ diff --git a/doc_yard/WpItem/Infos.html b/doc_yard/WpItem/Infos.html index ed17882f..92190024 100644 --- a/doc_yard/WpItem/Infos.html +++ b/doc_yard/WpItem/Infos.html @@ -777,7 +777,7 @@ href="http://www.exploit-db.com/ghdb/3714">www.exploit-db.com/ghdb/3714/ diff --git a/doc_yard/WpItem/Output.html b/doc_yard/WpItem/Output.html index 2dbe3eca..ffc2eec3 100644 --- a/doc_yard/WpItem/Output.html +++ b/doc_yard/WpItem/Output.html @@ -215,7 +215,7 @@ diff --git a/doc_yard/WpItem/Versionable.html b/doc_yard/WpItem/Versionable.html index 42350f30..5549d74e 100644 --- a/doc_yard/WpItem/Versionable.html +++ b/doc_yard/WpItem/Versionable.html @@ -290,7 +290,7 @@ diff --git a/doc_yard/WpItem/Vulnerable.html b/doc_yard/WpItem/Vulnerable.html index 081c9313..8b2fa611 100644 --- a/doc_yard/WpItem/Vulnerable.html +++ b/doc_yard/WpItem/Vulnerable.html @@ -184,6 +184,28 @@ vulnerabilities. + + + ++ + - (Boolean) vulnerable? + + + + + +
+ + + +24 +25 +26+ |
+
+ # File 'lib/common/models/wp_item/vulnerable.rb', line 24 + +def vulnerable? + vulnerabilities.empty? ? false : true +end+ |
+
-29 -30 -31 -32 33 34 35 36 37 -38+38 +39 +40 +41 +42
# File 'lib/common/models/wp_item/vulnerable.rb', line 29 +# File 'lib/common/models/wp_item/vulnerable.rb', line 33 def vulnerable_to?(vuln) if version && vuln && vuln.fixed_in && !vuln.fixed_in.empty? @@ -477,7 +551,7 @@ vulnerabilities diff --git a/doc_yard/WpItems.html b/doc_yard/WpItems.html index 1edd4dba..87c7fe46 100644 --- a/doc_yard/WpItems.html +++ b/doc_yard/WpItems.html @@ -304,7 +304,7 @@Methods included from Detectable
-aggressive_detection, item_options, passive_detection, progress_bar, request_params, targets_items, targets_items_from_file, vulnerable_targets_items
+aggressive_detection, passive_detection, passive_detection_pattern, progress_bar, request_params, targets_items, targets_items_from_file, vulnerable_targets_items
@@ -761,7 +761,7 @@ diff --git a/doc_yard/WpItems/Detectable.html b/doc_yard/WpItems/Detectable.html index 0fef91da..3eabef5d 100644 --- a/doc_yard/WpItems/Detectable.html +++ b/doc_yard/WpItems/Detectable.html @@ -227,28 +227,6 @@ - - - - - -
# File 'lib/common/collections/wp_items/detectable.rb', line 15 @@ -663,7 +665,9 @@ if target_item.exists?(, response) if !results.include?(target_item) - results << target_item + if ![:only_vulnerable] || [:only_vulnerable] && target_item.vulnerable? + results << target_item + end end end end @@ -780,18 +784,18 @@+153 +154 +155 +156 +157 +158 +159 160 -161 -162 -163 -164 -165 -166 -167 -168+161
# File 'lib/common/collections/wp_items/detectable.rb', line 160 +# File 'lib/common/collections/wp_items/detectable.rb', line 153 def create_item(klass, name, wp_target, vulns_file = nil) klass.new( @@ -844,12 +848,12 @@-193 -194 -195+186 +187 +188
# File 'lib/common/collections/wp_items/detectable.rb', line 193 +# File 'lib/common/collections/wp_items/detectable.rb', line 186 def item_class Object.const_get(self.to_s.gsub(/.$/, '')) @@ -857,81 +861,6 @@