wmap 2.7.6 → 2.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wmap.rb +1 -0
- data/lib/wmap/site_tracker/wp_tracker.rb +2 -226
- data/lib/wmap/utils/url_magic.rb +33 -2
- data/lib/wmap/utils/wp_detect.rb +354 -0
- data/version.txt +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 559cac84dd38902d968cc9e7327e77115ae3f946020caa21b7743ceb5777a96f
|
4
|
+
data.tar.gz: a4dcc0eafc10d7497c47c1f9955774b880ae5cdafa5ed0c6904ef5362087bd98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b430ed1da47cefd8cb8a7bedddd75ed2e7b1dafbfe94cdb2185ad2eb7e26d69a1429e79a9ece6b3cc68d6d964161f092e1143a00c0c64e241e930304d9e5a65
|
7
|
+
data.tar.gz: fe4d50b292849e51c202f47083c0837228d11934eb0d71c5a6262da24467480ce26994f5db91bdae5cf3b52dc0e6ef4fef698396575e820779c7420c731d0d87
|
data/lib/wmap.rb
CHANGED
@@ -7,16 +7,14 @@
|
|
7
7
|
#++
|
8
8
|
require "parallel"
|
9
9
|
#require "singleton"
|
10
|
-
|
11
|
-
require "open_uri_redirections"
|
12
|
-
require "nokogiri"
|
13
|
-
require "css_parser"
|
10
|
+
|
14
11
|
|
15
12
|
module Wmap
|
16
13
|
class SiteTracker
|
17
14
|
|
18
15
|
class WpTracker < Wmap::SiteTracker
|
19
16
|
include Wmap::Utils
|
17
|
+
include Wmap::Utils::WpDetect
|
20
18
|
#include Singleton
|
21
19
|
|
22
20
|
attr_accessor :http_timeout, :max_parallel, :verbose, :sites_wp, :data_dir
|
@@ -152,27 +150,6 @@ class WpTracker < Wmap::SiteTracker
|
|
152
150
|
end
|
153
151
|
alias_method :adds, :bulk_add
|
154
152
|
|
155
|
-
# logic to determin if it's a wordpress site
|
156
|
-
def is_wp?(url)
|
157
|
-
site=url_2_site(url)
|
158
|
-
if wp_readme?(site)
|
159
|
-
found=true
|
160
|
-
elsif wp_css?(site)
|
161
|
-
found=true
|
162
|
-
elsif wp_meta?(site)
|
163
|
-
found=true
|
164
|
-
elsif wp_login?(site)
|
165
|
-
found=true
|
166
|
-
elsif wp_rpc?(site)
|
167
|
-
found=true
|
168
|
-
else
|
169
|
-
found=false
|
170
|
-
end
|
171
|
-
return found
|
172
|
-
rescue => ee
|
173
|
-
puts "Exception on method #{__method__}: #{ee}: #{url}" if @verbose
|
174
|
-
end
|
175
|
-
|
176
153
|
# Refresh one site entry then update the instance variable (cache)
|
177
154
|
def refresh (target,use_cache=false)
|
178
155
|
return add(target,use_cache)
|
@@ -209,207 +186,6 @@ class WpTracker < Wmap::SiteTracker
|
|
209
186
|
# return Hash.new
|
210
187
|
end
|
211
188
|
|
212
|
-
# Wordpress detection checkpoint - readme.html
|
213
|
-
def wp_readme?(url)
|
214
|
-
site = url_2_site(url)
|
215
|
-
readme_url=site + "readme.html"
|
216
|
-
k=Wmap::UrlChecker.new
|
217
|
-
if k.response_code(readme_url) == 200
|
218
|
-
k=nil
|
219
|
-
doc=open_page(readme_url)
|
220
|
-
title=doc.css('title')
|
221
|
-
if title.to_s =~ /wordpress/i
|
222
|
-
return true
|
223
|
-
else
|
224
|
-
return false
|
225
|
-
end
|
226
|
-
else
|
227
|
-
k=nil
|
228
|
-
return false
|
229
|
-
end
|
230
|
-
rescue => ee
|
231
|
-
puts "Exception on method #{__method__} for site #{url}: #{ee}" if @verbose
|
232
|
-
return false
|
233
|
-
end
|
234
|
-
|
235
|
-
# Wordpress detection checkpoint - install.css
|
236
|
-
def wp_css?(url)
|
237
|
-
site = url_2_site(url)
|
238
|
-
css_url = site + "wp-admin/css/install.css"
|
239
|
-
k=Wmap::UrlChecker.new
|
240
|
-
if k.response_code(css_url) == 200
|
241
|
-
k=nil
|
242
|
-
parser = CssParser::Parser.new
|
243
|
-
parser.load_uri!(css_url)
|
244
|
-
rule = parser.find_by_selector('#logo a')
|
245
|
-
if rule.length >0
|
246
|
-
if rule[0] =~ /wordpress/i
|
247
|
-
return true
|
248
|
-
end
|
249
|
-
end
|
250
|
-
else
|
251
|
-
k=nil
|
252
|
-
return false
|
253
|
-
end
|
254
|
-
return false
|
255
|
-
rescue => ee
|
256
|
-
puts "Exception on method #{__method__} for site #{url}: #{ee}" if @verbose
|
257
|
-
return false
|
258
|
-
end
|
259
|
-
|
260
|
-
# Wordpress detection checkpoint - meta generator
|
261
|
-
def wp_meta?(url)
|
262
|
-
site=url_2_site(url)
|
263
|
-
k=Wmap::UrlChecker.new
|
264
|
-
if k.response_code(site) == 200
|
265
|
-
k=nil
|
266
|
-
doc=open_page(site)
|
267
|
-
meta=doc.css('meta')
|
268
|
-
if meta.to_s =~ /wordpress/i
|
269
|
-
return true
|
270
|
-
else
|
271
|
-
return false
|
272
|
-
end
|
273
|
-
end
|
274
|
-
return false
|
275
|
-
rescue => ee
|
276
|
-
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
277
|
-
return false
|
278
|
-
end
|
279
|
-
|
280
|
-
# Wordpress detection checkpoint - wp-login
|
281
|
-
def wp_login?(url)
|
282
|
-
site=url_2_site(url)
|
283
|
-
login_url=site + "wp-login.php"
|
284
|
-
k=Wmap::UrlChecker.new
|
285
|
-
if k.response_code(login_url) == 200
|
286
|
-
k=nil
|
287
|
-
doc=open_page(login_url)
|
288
|
-
links=doc.css('link')
|
289
|
-
if links.to_s =~ /login.min.css/i
|
290
|
-
return true
|
291
|
-
else
|
292
|
-
return false
|
293
|
-
end
|
294
|
-
end
|
295
|
-
return false
|
296
|
-
rescue => ee
|
297
|
-
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
298
|
-
return false
|
299
|
-
end
|
300
|
-
|
301
|
-
# Wordpress detection checkpoint - xml-rpc
|
302
|
-
def wp_rpc?(url)
|
303
|
-
site=url_2_site(url)
|
304
|
-
rpc_url=site + "xmlrpc.php"
|
305
|
-
k=Wmap::UrlChecker.new
|
306
|
-
#puts "res code", k.response_code(rpc_url)
|
307
|
-
if k.response_code(rpc_url) == 405 # method not allowed
|
308
|
-
k=nil
|
309
|
-
return true
|
310
|
-
end
|
311
|
-
return false
|
312
|
-
rescue => ee
|
313
|
-
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
314
|
-
return false
|
315
|
-
end
|
316
|
-
|
317
|
-
# Extract the WordPress version
|
318
|
-
def wp_ver(url)
|
319
|
-
if !wp_ver_readme(url).nil?
|
320
|
-
puts "WordPress version found by wp_ver_readme method. " if @verbose
|
321
|
-
return wp_ver_readme(url)
|
322
|
-
elsif !wp_ver_login(url,"login.min.css").nil?
|
323
|
-
puts "WordPress version found by login.min.css file. " if @verbose
|
324
|
-
return wp_ver_login(url,"login.min.css")
|
325
|
-
elsif !wp_ver_login(url,"buttons.min.css").nil?
|
326
|
-
puts "WordPress version found by buttons.min.css file. " if @verbose
|
327
|
-
return wp_ver_login(url,"buttons.min.css")
|
328
|
-
elsif !wp_ver_login(url,"wp-admin.min.css").nil?
|
329
|
-
puts "WordPress version found by wp-admin.min.css file. " if @verbose
|
330
|
-
return wp_ver_login(url,"wp-admin.min.css")
|
331
|
-
elsif !wp_ver_meta(url).nil?
|
332
|
-
puts "WordPress version found by wp_ver_meta method. " if @verbose
|
333
|
-
return wp_ver_meta(url)
|
334
|
-
else
|
335
|
-
return nil
|
336
|
-
end
|
337
|
-
rescue => ee
|
338
|
-
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
339
|
-
return nil
|
340
|
-
end
|
341
|
-
|
342
|
-
# Identify wordpress version through the login page
|
343
|
-
def wp_ver_login(url,pattern)
|
344
|
-
puts "Check for #{pattern}" if @verbose
|
345
|
-
site=url_2_site(url)
|
346
|
-
login_url=site + "wp-login.php"
|
347
|
-
k=Wmap::UrlChecker.new
|
348
|
-
#puts "Res code: #{k.response_code(login_url)}" if @verbose
|
349
|
-
if k.response_code(login_url) == 200
|
350
|
-
doc=open_page(login_url)
|
351
|
-
#puts doc.inspect
|
352
|
-
links=doc.css('link')
|
353
|
-
#puts links.inspect if @verbose
|
354
|
-
links.each do |tag|
|
355
|
-
if tag.to_s.include?(pattern)
|
356
|
-
puts tag.to_s if @verbose
|
357
|
-
k=nil
|
358
|
-
return tag.to_s.scan(/[\d+\.]+\d+/).first
|
359
|
-
end
|
360
|
-
end
|
361
|
-
end
|
362
|
-
k=nil
|
363
|
-
return nil
|
364
|
-
rescue => ee
|
365
|
-
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
366
|
-
return nil
|
367
|
-
end
|
368
|
-
|
369
|
-
# Identify wordpress version through the meta link
|
370
|
-
def wp_ver_meta(url)
|
371
|
-
site=url_2_site(url)
|
372
|
-
k=Wmap::UrlChecker.new
|
373
|
-
if k.response_code(site) == 200
|
374
|
-
doc=open_page(site)
|
375
|
-
#puts doc.inspect
|
376
|
-
meta=doc.css('meta')
|
377
|
-
#puts meta.inspect
|
378
|
-
meta.each do |tag|
|
379
|
-
if tag['content'].to_s =~ /wordpress/i
|
380
|
-
#puts tag.to_s
|
381
|
-
k=nil
|
382
|
-
return tag['content'].to_s.scan(/[\d+\.]+\d+/).first
|
383
|
-
end
|
384
|
-
end
|
385
|
-
end
|
386
|
-
k=nil
|
387
|
-
return nil
|
388
|
-
rescue => ee
|
389
|
-
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
390
|
-
return nil
|
391
|
-
end
|
392
|
-
|
393
|
-
# Wordpress version detection via - readme.html
|
394
|
-
def wp_ver_readme(url)
|
395
|
-
site=url_2_site(url)
|
396
|
-
readme_url=site + "readme.html"
|
397
|
-
k=Wmap::UrlChecker.new
|
398
|
-
puts "Res code: #{k.response_code(readme_url)}" if @verbose
|
399
|
-
if k.response_code(readme_url) == 200
|
400
|
-
k=nil
|
401
|
-
doc=open_page(readme_url)
|
402
|
-
puts doc if @verbose
|
403
|
-
logo=doc.css('h1#logo')[0]
|
404
|
-
puts logo.inspect if @verbose
|
405
|
-
return logo.to_s.scan(/[\d+\.]+\d+/).first
|
406
|
-
end
|
407
|
-
k=nil
|
408
|
-
return nil
|
409
|
-
rescue => ee
|
410
|
-
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
411
|
-
return nil
|
412
|
-
end
|
413
189
|
|
414
190
|
end
|
415
191
|
end
|
data/lib/wmap/utils/url_magic.rb
CHANGED
@@ -263,7 +263,7 @@ module Wmap
|
|
263
263
|
return absolute_url
|
264
264
|
rescue => ee
|
265
265
|
puts "Exception on method #{__method__}: #{ee}" if @verbose
|
266
|
-
|
266
|
+
return nil
|
267
267
|
end
|
268
268
|
|
269
269
|
# Normalize the URL to a consistent manner in order to determine if a link has been visited or cached before
|
@@ -292,7 +292,6 @@ module Wmap
|
|
292
292
|
return url
|
293
293
|
end
|
294
294
|
|
295
|
-
|
296
295
|
# Test the URL and return the response code
|
297
296
|
def response_code (url)
|
298
297
|
puts "Check the http response code on the url: #{url}" if @verbose
|
@@ -344,6 +343,38 @@ module Wmap
|
|
344
343
|
return code
|
345
344
|
end
|
346
345
|
|
346
|
+
# Test the URL and return the response headers
|
347
|
+
def response_headers (url)
|
348
|
+
puts "Check the http response headers on the url: #{url}" if @verbose
|
349
|
+
raise "Invalid url: #{url}" unless is_url?(url)
|
350
|
+
headers = Hash.new
|
351
|
+
url=url.strip.downcase
|
352
|
+
timeo = Max_http_timeout/1000.0
|
353
|
+
uri = URI.parse(url)
|
354
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
355
|
+
http.open_timeout = timeo
|
356
|
+
http.read_timeout = timeo
|
357
|
+
if (url =~ /https\:/i)
|
358
|
+
http.use_ssl = true
|
359
|
+
#http.ssl_version = :SSLv3
|
360
|
+
# Bypass the remote web server cert validation test
|
361
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
362
|
+
end
|
363
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
364
|
+
response = http.request(request)
|
365
|
+
puts "Server response the following: #{response}" if @verbose
|
366
|
+
response.each_header do |key,val|
|
367
|
+
puts "#{key} => #{val}" if @verbose
|
368
|
+
headers.merge!({key => val})
|
369
|
+
end
|
370
|
+
puts "Response headers on #{url}: #{headers}" if @verbose
|
371
|
+
return headers
|
372
|
+
rescue => ee
|
373
|
+
puts "Exception on method #{__method__}: #{ee}" if @verbose
|
374
|
+
return nil
|
375
|
+
end
|
376
|
+
|
377
|
+
|
347
378
|
# Given an URL, open the page, then return the DOM text from a normal user perspective
|
348
379
|
def open_page(url)
|
349
380
|
args = {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE, allow_redirections: :safe, read_timeout: Max_http_timeout/1000}
|
@@ -0,0 +1,354 @@
|
|
1
|
+
#--
|
2
|
+
# Wmap
|
3
|
+
#
|
4
|
+
# A pure Ruby library for Internet web application discovery and tracking.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2012-2015 Yang Li <yang.li@owasp.org>
|
7
|
+
#++
|
8
|
+
|
9
|
+
# Utilities for wp_tracker class only; must use with other Utils modules.
|
10
|
+
module Wmap
|
11
|
+
module Utils
|
12
|
+
module WpDetect
|
13
|
+
extend self
|
14
|
+
|
15
|
+
# Main method to detect if it's a wordpress site
|
16
|
+
def is_wp?(url)
|
17
|
+
site=url_2_site(url)
|
18
|
+
if wp_readme?(site)
|
19
|
+
return true
|
20
|
+
elsif wp_css?(site)
|
21
|
+
return true
|
22
|
+
elsif wp_meta?(site)
|
23
|
+
return true
|
24
|
+
elsif wp_login?(site)
|
25
|
+
return true
|
26
|
+
elsif wp_rpc?(site)
|
27
|
+
return true
|
28
|
+
elsif wp_gen?(site)
|
29
|
+
return true
|
30
|
+
elsif wp_load_styles?(site)
|
31
|
+
return true
|
32
|
+
else
|
33
|
+
return false
|
34
|
+
end
|
35
|
+
rescue => ee
|
36
|
+
puts "Exception on method #{__method__}: #{ee}: #{url}" if @verbose
|
37
|
+
end
|
38
|
+
|
39
|
+
# Main method to extract the WordPress version
|
40
|
+
def wp_ver(url)
|
41
|
+
if !wp_ver_readme(url).nil?
|
42
|
+
puts "WordPress version found by wp_ver_readme method. " if @verbose
|
43
|
+
return wp_ver_readme(url)
|
44
|
+
elsif !wp_ver_login(url,"login.min.css").nil?
|
45
|
+
puts "WordPress version found by login.min.css file. " if @verbose
|
46
|
+
return wp_ver_login(url,"login.min.css")
|
47
|
+
elsif !wp_ver_login(url,"buttons.min.css").nil?
|
48
|
+
puts "WordPress version found by buttons.min.css file. " if @verbose
|
49
|
+
return wp_ver_login(url,"buttons.min.css")
|
50
|
+
elsif !wp_ver_login(url,"wp-admin.min.css").nil?
|
51
|
+
puts "WordPress version found by wp-admin.min.css file. " if @verbose
|
52
|
+
return wp_ver_login(url,"wp-admin.min.css")
|
53
|
+
elsif !wp_ver_meta(url).nil?
|
54
|
+
puts "WordPress version found by wp_ver_meta method. " if @verbose
|
55
|
+
return wp_ver_meta(url)
|
56
|
+
elsif !wp_ver_generator(url).nil?
|
57
|
+
puts "WordPress version found by wp_ver_generator method. " if @verbose
|
58
|
+
return wp_ver_generator(url)
|
59
|
+
elsif !wp_ver_load_styles(url).nil?
|
60
|
+
puts "WordPress version found by wp_ver_load_styles method. " if @verbose
|
61
|
+
return wp_ver_load_styles(url)
|
62
|
+
else
|
63
|
+
return nil
|
64
|
+
end
|
65
|
+
rescue => ee
|
66
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
67
|
+
return nil
|
68
|
+
end
|
69
|
+
|
70
|
+
# Wordpress detection checkpoint - readme.html
|
71
|
+
def wp_readme?(url)
|
72
|
+
site = url_2_site(url)
|
73
|
+
readme_url=site + "readme.html"
|
74
|
+
k=Wmap::UrlChecker.new
|
75
|
+
if k.response_code(readme_url) == 200
|
76
|
+
k=nil
|
77
|
+
doc=open_page(readme_url)
|
78
|
+
title=doc.css('title')
|
79
|
+
if title.to_s =~ /wordpress/i
|
80
|
+
return true
|
81
|
+
else
|
82
|
+
return false
|
83
|
+
end
|
84
|
+
else
|
85
|
+
k=nil
|
86
|
+
return false
|
87
|
+
end
|
88
|
+
rescue => ee
|
89
|
+
puts "Exception on method #{__method__} for site #{url}: #{ee}" if @verbose
|
90
|
+
return false
|
91
|
+
end
|
92
|
+
|
93
|
+
# Wordpress detection checkpoint - install.css
|
94
|
+
def wp_css?(url)
|
95
|
+
site = url_2_site(url)
|
96
|
+
css_url = site + "wp-admin/css/install.css"
|
97
|
+
k=Wmap::UrlChecker.new
|
98
|
+
if k.response_code(css_url) == 200
|
99
|
+
k=nil
|
100
|
+
parser = CssParser::Parser.new
|
101
|
+
parser.load_uri!(css_url)
|
102
|
+
rule = parser.find_by_selector('#logo a')
|
103
|
+
if rule.length >0
|
104
|
+
if rule[0] =~ /wordpress/i
|
105
|
+
return true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
else
|
109
|
+
k=nil
|
110
|
+
return false
|
111
|
+
end
|
112
|
+
return false
|
113
|
+
rescue => ee
|
114
|
+
puts "Exception on method #{__method__} for site #{url}: #{ee}" if @verbose
|
115
|
+
return false
|
116
|
+
end
|
117
|
+
|
118
|
+
# Wordpress detection checkpoint - WP meta tag
|
119
|
+
def wp_meta?(url)
|
120
|
+
site=url_2_site(url)
|
121
|
+
k=Wmap::UrlChecker.new
|
122
|
+
if k.response_code(site) == 200
|
123
|
+
k=nil
|
124
|
+
doc=open_page(site)
|
125
|
+
meta=doc.css('meta')
|
126
|
+
if meta.to_s =~ /wordpress/i
|
127
|
+
return true
|
128
|
+
else
|
129
|
+
return false
|
130
|
+
end
|
131
|
+
end
|
132
|
+
return false
|
133
|
+
rescue => ee
|
134
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
135
|
+
return false
|
136
|
+
end
|
137
|
+
|
138
|
+
# Wordpress detection checkpoint - WP generator tag
|
139
|
+
def wp_gen?(url)
|
140
|
+
puts "#{__method__} check for #{url}" if @verbose
|
141
|
+
site = url_2_site(url)
|
142
|
+
gen_url_1 = site + "feed/"
|
143
|
+
gen_url_2 = site + "comments/feed"
|
144
|
+
k=Wmap::UrlChecker.new
|
145
|
+
if k.response_code(gen_url_1) == 200
|
146
|
+
doc=open_page(gen_url_1)
|
147
|
+
elsif k.response_code(gen_url_2) == 200
|
148
|
+
doc=open_page(gen_url_2)
|
149
|
+
else
|
150
|
+
k=nil
|
151
|
+
return false
|
152
|
+
end
|
153
|
+
#puts doc.inspect
|
154
|
+
gens=doc.css('generator')
|
155
|
+
if gens.nil?
|
156
|
+
k=nil
|
157
|
+
return false
|
158
|
+
end
|
159
|
+
gens.each do |gen|
|
160
|
+
if gen.text.to_s =~ /wordpress/i
|
161
|
+
k=doc=nil
|
162
|
+
return true
|
163
|
+
end
|
164
|
+
end
|
165
|
+
k=doc=nil
|
166
|
+
return false
|
167
|
+
rescue => ee
|
168
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
169
|
+
return false
|
170
|
+
end
|
171
|
+
|
172
|
+
# Wordpress detection checkpoint - wp-login
|
173
|
+
def wp_login?(url)
|
174
|
+
site=url_2_site(url)
|
175
|
+
login_url=site + "wp-login.php"
|
176
|
+
k=Wmap::UrlChecker.new
|
177
|
+
if k.response_code(login_url) == 200
|
178
|
+
k=nil
|
179
|
+
doc=open_page(login_url)
|
180
|
+
links=doc.css('link')
|
181
|
+
if links.to_s =~ /login.min.css/i
|
182
|
+
return true
|
183
|
+
else
|
184
|
+
return false
|
185
|
+
end
|
186
|
+
end
|
187
|
+
return false
|
188
|
+
rescue => ee
|
189
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
190
|
+
return false
|
191
|
+
end
|
192
|
+
|
193
|
+
# Wordpress detection checkpoint - xml-rpc
|
194
|
+
def wp_rpc?(url)
|
195
|
+
site=url_2_site(url)
|
196
|
+
rpc_url=site + "xmlrpc.php"
|
197
|
+
k=Wmap::UrlChecker.new
|
198
|
+
#puts "res code", k.response_code(rpc_url)
|
199
|
+
if k.response_code(rpc_url) == 405 # method not allowed
|
200
|
+
k=nil
|
201
|
+
return true
|
202
|
+
end
|
203
|
+
return false
|
204
|
+
rescue => ee
|
205
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
206
|
+
return false
|
207
|
+
end
|
208
|
+
|
209
|
+
# Wordpress detection checkpoint - /wp-admin/load-styles.php
|
210
|
+
def wp_load_styles?(url)
|
211
|
+
site = url_2_site(url)
|
212
|
+
load_styles_url=site + "wp-admin/load-styles.php"
|
213
|
+
k=Wmap::UrlChecker.new
|
214
|
+
if k.response_code(load_styles_url) == 200 && k.response_headers(load_styles_url).keys.include?("etag")
|
215
|
+
k=nil
|
216
|
+
return true
|
217
|
+
else
|
218
|
+
k=nil
|
219
|
+
return false
|
220
|
+
end
|
221
|
+
rescue => ee
|
222
|
+
puts "Exception on method #{__method__} for site #{url}: #{ee}" if @verbose
|
223
|
+
return false
|
224
|
+
end
|
225
|
+
|
226
|
+
# Identify wordpress version through the login page
|
227
|
+
def wp_ver_login(url,pattern)
|
228
|
+
puts "Check for #{pattern}" if @verbose
|
229
|
+
site=url_2_site(url)
|
230
|
+
login_url=site + "wp-login.php"
|
231
|
+
k=Wmap::UrlChecker.new
|
232
|
+
#puts "Res code: #{k.response_code(login_url)}" if @verbose
|
233
|
+
if k.response_code(login_url) == 200
|
234
|
+
doc=open_page(login_url)
|
235
|
+
#puts doc.inspect
|
236
|
+
links=doc.css('link')
|
237
|
+
#puts links.inspect if @verbose
|
238
|
+
links.each do |tag|
|
239
|
+
if tag.to_s.include?(pattern)
|
240
|
+
puts tag.to_s if @verbose
|
241
|
+
k=nil
|
242
|
+
return tag.to_s.scan(/[\d+\.]+\d+/).first
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
k=nil
|
247
|
+
return nil
|
248
|
+
rescue => ee
|
249
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
250
|
+
return nil
|
251
|
+
end
|
252
|
+
|
253
|
+
# Identify wordpress version through the meta link
|
254
|
+
def wp_ver_meta(url)
|
255
|
+
site=url_2_site(url)
|
256
|
+
k=Wmap::UrlChecker.new
|
257
|
+
if k.response_code(site) == 200
|
258
|
+
doc=open_page(site)
|
259
|
+
#puts doc.inspect
|
260
|
+
meta=doc.css('meta')
|
261
|
+
#puts meta.inspect
|
262
|
+
meta.each do |tag|
|
263
|
+
if tag['content'].to_s =~ /wordpress/i
|
264
|
+
#puts tag.to_s
|
265
|
+
k=nil
|
266
|
+
return tag['content'].to_s.scan(/[\d+\.]+\d+/).first
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
k=nil
|
271
|
+
return nil
|
272
|
+
rescue => ee
|
273
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
274
|
+
return nil
|
275
|
+
end
|
276
|
+
|
277
|
+
# Identify wordpress version through the generator tag: <generator>https://wordpress.org/?v=4.9.8</generator>
|
278
|
+
def wp_ver_generator(url)
|
279
|
+
puts "#{__method__} check for #{url}" if @verbose
|
280
|
+
site = url_2_site(url)
|
281
|
+
gen_url_1 = site + "feed/"
|
282
|
+
gen_url_2 = site + "comments/feed"
|
283
|
+
k=Wmap::UrlChecker.new
|
284
|
+
if k.response_code(gen_url_1) == 200
|
285
|
+
doc=open_page(gen_url_1)
|
286
|
+
elsif k.response_code(gen_url_2) == 200
|
287
|
+
doc=open_page(gen_url_2)
|
288
|
+
else
|
289
|
+
k=nil
|
290
|
+
return nil
|
291
|
+
end
|
292
|
+
#puts doc.inspect
|
293
|
+
gens=doc.css('generator')
|
294
|
+
if gens.nil?
|
295
|
+
k=nil
|
296
|
+
return nil
|
297
|
+
end
|
298
|
+
gens.each do |gen|
|
299
|
+
if gen.text.to_s =~ /wordpress/i
|
300
|
+
k=nil
|
301
|
+
return gen.text.to_s.scan(/[\d+\.]+\d+/).first
|
302
|
+
end
|
303
|
+
end
|
304
|
+
k=doc=nil
|
305
|
+
return nil
|
306
|
+
rescue => ee
|
307
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
308
|
+
return nil
|
309
|
+
end
|
310
|
+
|
311
|
+
# Wordpress version detection via - readme.html
|
312
|
+
def wp_ver_readme(url)
|
313
|
+
site=url_2_site(url)
|
314
|
+
readme_url=site + "readme.html"
|
315
|
+
k=Wmap::UrlChecker.new
|
316
|
+
puts "Res code: #{k.response_code(readme_url)}" if @verbose
|
317
|
+
if k.response_code(readme_url) == 200
|
318
|
+
k=nil
|
319
|
+
doc=open_page(readme_url)
|
320
|
+
puts doc if @verbose
|
321
|
+
logo=doc.css('h1#logo')[0]
|
322
|
+
puts logo.inspect if @verbose
|
323
|
+
return logo.to_s.scan(/[\d+\.]+\d+/).first
|
324
|
+
end
|
325
|
+
k=nil
|
326
|
+
return nil
|
327
|
+
rescue => ee
|
328
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
329
|
+
return nil
|
330
|
+
end
|
331
|
+
|
332
|
+
# Wordpress version detection via - /wp-admin/load-styles.php
|
333
|
+
def wp_ver_load_styles(url)
|
334
|
+
site=url_2_site(url)
|
335
|
+
load_styles_url = site + "wp-admin/load-styles.php"
|
336
|
+
k=Wmap::UrlChecker.new
|
337
|
+
if k.response_code(load_styles_url) == 200
|
338
|
+
headers = k.response_headers(load_styles_url)
|
339
|
+
if headers.keys.include?("etag")
|
340
|
+
k=nil
|
341
|
+
return headers["etag"]
|
342
|
+
end
|
343
|
+
end
|
344
|
+
k=nil
|
345
|
+
return nil
|
346
|
+
rescue => ee
|
347
|
+
puts "Exception on method #{__method__} for url #{url}: #{ee}" if @verbose
|
348
|
+
return nil
|
349
|
+
end
|
350
|
+
|
351
|
+
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
data/version.txt
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
###############################################################################
|
4
4
|
package = wmap
|
5
5
|
# wmap version 2.0 == web_discovery version 1.5.3
|
6
|
-
version = 2.7.
|
7
|
-
date = 2020-03-
|
6
|
+
version = 2.7.7
|
7
|
+
date = 2020-03-24
|
8
8
|
|
9
9
|
author = Sam (Yang) Li
|
10
10
|
email = yang.li@owasp.org
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam (Yang) Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dnsruby
|
@@ -303,6 +303,7 @@ files:
|
|
303
303
|
- lib/wmap/utils/logger.rb
|
304
304
|
- lib/wmap/utils/url_magic.rb
|
305
305
|
- lib/wmap/utils/utils.rb
|
306
|
+
- lib/wmap/utils/wp_detect.rb
|
306
307
|
- lib/wmap/whois.rb
|
307
308
|
- settings/discovery_ports
|
308
309
|
- settings/google_keywords.txt
|