wmap 2.7.6 → 2.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/wmap +9 -1
- data/dicts/tlds.txt +9 -30
- data/lib/wmap.rb +1 -0
- data/lib/wmap/cidr_tracker.rb +3 -2
- data/lib/wmap/site_tracker/wp_tracker.rb +2 -226
- data/lib/wmap/url_crawler.rb +9 -21
- data/lib/wmap/utils/domain_root.rb +1 -1
- data/lib/wmap/utils/logger.rb +31 -34
- data/lib/wmap/utils/url_magic.rb +37 -4
- data/lib/wmap/utils/utils.rb +10 -12
- data/lib/wmap/utils/wp_detect.rb +358 -0
- data/test/cidr_tracker_test.rb +36 -0
- data/test/utils_test.rb +51 -46
- data/version.txt +2 -2
- data/wmap.gemspec +1 -1
- metadata +7 -9
- data/bin/RHPG +0 -107
- data/bin/wmaps +0 -23
- data/settings/tag_signatures +0 -6
@@ -0,0 +1,36 @@
|
|
1
|
+
#--
|
2
|
+
# Wmap
|
3
|
+
#
|
4
|
+
# A pure Ruby library for the Internet web application discovery and tracking.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2012-2015 Yang Li <yang.li@owasp.org>
|
7
|
+
#++
|
8
|
+
# Unit Test File for Wmap::DomainTracker.instance class
|
9
|
+
|
10
|
+
require "minitest/autorun"
|
11
|
+
require "Wmap"
|
12
|
+
|
13
|
+
class CidrTrackerTest < MiniTest::Unit::TestCase
|
14
|
+
include Wmap::Utils
|
15
|
+
|
16
|
+
def test_cidr_add
|
17
|
+
w = Wmap::CidrTracker.new
|
18
|
+
w.add("192.168.1.0/24")
|
19
|
+
assert_equal true, w.known_cidr_blks.key?("192.168.1.0/24")
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_cidr_delete
|
23
|
+
w = Wmap::CidrTracker.new
|
24
|
+
w.add("10.0.0.0/8")
|
25
|
+
w.delete("10.0.0.0/8")
|
26
|
+
assert_equal false, w.known_cidr_blks.key?("10.0.0.0/8")
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_ip_trusted?
|
30
|
+
w = Wmap::CidrTracker.new
|
31
|
+
w.add("192.168.1.0/24")
|
32
|
+
assert_equal true, w.ip_trusted?("192.168.1.1")
|
33
|
+
assert_equal true, w.ip_trusted?("192.168.1.255")
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/test/utils_test.rb
CHANGED
@@ -12,7 +12,7 @@ require "Wmap"
|
|
12
12
|
|
13
13
|
class UtilsTest < MiniTest::Unit::TestCase
|
14
14
|
include Wmap::Utils
|
15
|
-
|
15
|
+
|
16
16
|
def test_sld_domain_conversion
|
17
17
|
assert_equal "yahoo.com", get_domain_root("yahoo.com")
|
18
18
|
end
|
@@ -28,75 +28,75 @@ class UtilsTest < MiniTest::Unit::TestCase
|
|
28
28
|
def test_is_domain_root_case_1?
|
29
29
|
assert_equal false, is_domain_root?("www.yahoo.co.uk")
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def test_is_domain_root_case_2?
|
33
33
|
assert_equal true, is_domain_root?("yahoo.co.uk")
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
def test_get_sub_domain
|
37
37
|
assert_equal "mail.yahoo.co.uk", get_sub_domain("www.mail.yahoo.co.uk")
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_is_url_case_1?
|
41
41
|
assert_equal true, is_url?("http://www.mail.yahoo.co.uk/")
|
42
|
-
end
|
42
|
+
end
|
43
43
|
|
44
44
|
def test_is_url_case_2?
|
45
45
|
assert_equal true, is_url?("https://www.mail.yahoo.co.uk/")
|
46
|
-
end
|
46
|
+
end
|
47
47
|
|
48
48
|
def test_is_url_case_3?
|
49
49
|
assert_equal false, is_url?("http://www.mail.yahoo.uii/")
|
50
|
-
end
|
50
|
+
end
|
51
51
|
|
52
52
|
def test_is_url_case_4?
|
53
53
|
assert_equal false, is_url?("http:\\www.mail.yahoo.co.uk")
|
54
|
-
end
|
55
|
-
|
54
|
+
end
|
55
|
+
|
56
56
|
def test_is_ssl?
|
57
57
|
assert_equal false, is_ssl?("http://www.mail.yahoo.co.uk/")
|
58
|
-
end
|
59
|
-
|
58
|
+
end
|
59
|
+
|
60
60
|
def test_is_site?
|
61
61
|
assert_equal false, is_site?("https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com")
|
62
|
-
end
|
63
|
-
|
62
|
+
end
|
63
|
+
|
64
64
|
def test_url_2_host
|
65
65
|
assert_equal "login.yahoo.com", url_2_host("https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com")
|
66
|
-
end
|
67
|
-
|
66
|
+
end
|
67
|
+
|
68
68
|
def test_url_2_site_case_1
|
69
69
|
assert_equal "https://login.yahoo.com/", url_2_site("https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com")
|
70
|
-
end
|
70
|
+
end
|
71
71
|
|
72
72
|
def test_url_2_site_case_2
|
73
73
|
assert_equal "https://login.yahoo.com/", url_2_site("https://login.yahoo.com?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com")
|
74
|
-
end
|
74
|
+
end
|
75
75
|
|
76
76
|
def test_url_2_site_case_3
|
77
77
|
assert_equal "https://login.yahoo.com/", url_2_site("https://login.yahoo.com#.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com")
|
78
|
-
end
|
79
|
-
|
78
|
+
end
|
79
|
+
|
80
80
|
def test_url_2_path
|
81
81
|
assert_equal "/?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com", url_2_path("https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com")
|
82
|
-
end
|
82
|
+
end
|
83
83
|
|
84
84
|
def test_urls_on_same_domain?
|
85
85
|
assert_equal true, urls_on_same_domain?("https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com", "https://us-mg4.mail.yahoo.com/neo/launch?.rand=8hjd08hc6t1lq")
|
86
|
-
end
|
86
|
+
end
|
87
87
|
|
88
88
|
def test_host_2_url_case_1
|
89
89
|
assert_equal "https://mail.yahoo.com/", host_2_url("mail.yahoo.com",443)
|
90
|
-
end
|
90
|
+
end
|
91
91
|
|
92
92
|
def test_host_2_url_case_2
|
93
93
|
assert_equal "http://mail.yahoo.com/", host_2_url("mail.yahoo.com")
|
94
|
-
end
|
95
|
-
|
94
|
+
end
|
95
|
+
|
96
96
|
def test_make_absolute
|
97
97
|
assert_equal "http://games.yahoo.com/game/the-magic-snowman-flash.html", make_absolute("http://games.yahoo.com/","game/the-magic-snowman-flash.html")
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def test_create_absolute_url_from_base
|
101
101
|
assert_equal "http://images.search.yahoo.com/search/images?p=raiders", create_absolute_url_from_base("http://images.search.yahoo.com/images","/search/images?p=raiders")
|
102
102
|
end
|
@@ -108,7 +108,7 @@ class UtilsTest < MiniTest::Unit::TestCase
|
|
108
108
|
def test_normalize_url_case_1
|
109
109
|
assert_equal "http://images.search.yahoo.com/images/search/images?p=raiders", normalize_url("http://images.search.yahoo.com/./images/search/images?p=raiders")
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
def test_normalize_url_case_2
|
113
113
|
assert_equal "http://images.search.yahoo.com/images/search/images?p=raiders", normalize_url("http://images.search.yahoo.com/../images/../search/images?p=raiders")
|
114
114
|
end
|
@@ -116,53 +116,58 @@ class UtilsTest < MiniTest::Unit::TestCase
|
|
116
116
|
def test_normalize_url_case_3
|
117
117
|
assert_equal "http://images.search.yahoo.com/images/search/images?p=raiders", normalize_url("http://images.search.yahoo.com./../images/../search/images?p=raiders")
|
118
118
|
end
|
119
|
-
|
119
|
+
|
120
120
|
def test_is_ip_case_1?
|
121
121
|
assert_equal false, is_ip?("256.2.3.1")
|
122
|
-
end
|
122
|
+
end
|
123
123
|
|
124
124
|
def test_is_ip_case_2?
|
125
125
|
assert_equal false, is_ip?("25.2.3.1.22")
|
126
|
-
end
|
126
|
+
end
|
127
127
|
|
128
128
|
def test_is_ip_case_3?
|
129
129
|
assert_equal true, is_ip?("196.168.230.1")
|
130
|
-
end
|
130
|
+
end
|
131
131
|
|
132
132
|
def test_is_fqdn_case_1?
|
133
133
|
assert_equal true, is_fqdn?("images.search.yahoo.com")
|
134
|
-
end
|
134
|
+
end
|
135
135
|
|
136
136
|
def test_is_fqdn_case_2?
|
137
137
|
assert_equal true, is_fqdn?("yahoo.com")
|
138
|
-
end
|
139
|
-
|
138
|
+
end
|
139
|
+
|
140
140
|
def test_is_fqdn_case_3?
|
141
|
-
|
142
|
-
|
143
|
-
|
141
|
+
# according to latest tlds list - http://data.iana.org/TLD/tlds-alpha-by-domain.txt
|
142
|
+
assert_equal true, is_fqdn?("images.search.yahoo")
|
143
|
+
end
|
144
|
+
|
144
145
|
def test_is_fqdn_case_4?
|
145
146
|
assert_equal false, is_fqdn?("images")
|
146
|
-
end
|
147
|
-
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_is_fqdn_case_5?
|
150
|
+
assert_equal false, is_fqdn?("images.search.gargle")
|
151
|
+
end
|
152
|
+
|
148
153
|
def test_is_cidr_case_1?
|
149
154
|
assert_equal false, is_cidr?("196.168.230.1")
|
150
|
-
end
|
155
|
+
end
|
151
156
|
|
152
157
|
def test_is_cidr_case_2?
|
153
158
|
assert_equal false, is_cidr?("196.168.2.257/12")
|
154
|
-
end
|
155
|
-
|
159
|
+
end
|
160
|
+
|
156
161
|
def test_is_cidr_case_3?
|
157
162
|
assert_equal true, is_cidr?("196.168.2.25/12")
|
158
|
-
end
|
159
|
-
|
163
|
+
end
|
164
|
+
|
160
165
|
def test_cidr_2_ips
|
161
166
|
assert_equal ["192.168.1.1"], cidr_2_ips("192.168.1.1/32")
|
162
|
-
end
|
163
|
-
|
167
|
+
end
|
168
|
+
|
164
169
|
def test_sort_ips
|
165
170
|
assert_equal ["192.168.1.1", "192.168.1.2", "192.168.2.1"], sort_ips(["192.168.1.2", "192.168.2.1","192.168.1.1"])
|
166
|
-
end
|
167
|
-
|
171
|
+
end
|
172
|
+
|
168
173
|
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
|
-
date =
|
6
|
+
version = 2.8.2
|
7
|
+
date = 2021-07-23
|
8
8
|
|
9
9
|
author = Sam (Yang) Li
|
10
10
|
email = yang.li@owasp.org
|
data/wmap.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.description = "wmap is written to perform Internet web application / service discovery. The discovery results are designed to be automatically tracked by the software."
|
37
37
|
s.email = info["email"]
|
38
38
|
s.executables = ["wmap","wscan","wadd","wadds","wdel","wcheck","wdump","spiderBot","googleBot","updateAll","prime","deprime","refresh","trust","trusts","distrust","run_tests"]
|
39
|
-
s.files = ["CHANGELOG.md", "TODO", "settings/discovery_ports","
|
39
|
+
s.files = ["CHANGELOG.md", "TODO", "settings/discovery_ports", "LICENSE.txt",
|
40
40
|
"version.txt","README.md", "wmap.gemspec"]
|
41
41
|
s.files += Dir['lib/*.rb'] + Dir['lib/wmap/*.rb'] + Dir['lib/wmap/**/*'] + Dir['bin/*'] + Dir['settings/*'] + Dir['demos/*'] + Dir['test/*'] + Dir['dicts/*']
|
42
42
|
#s.homepage = "none"
|
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.
|
4
|
+
version: 2.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam (Yang) Li
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dnsruby
|
@@ -234,7 +234,6 @@ files:
|
|
234
234
|
- LICENSE.txt
|
235
235
|
- README.md
|
236
236
|
- TODO
|
237
|
-
- bin/RHPG
|
238
237
|
- bin/deprime
|
239
238
|
- bin/distrust
|
240
239
|
- bin/googleBot
|
@@ -251,7 +250,6 @@ files:
|
|
251
250
|
- bin/wdel
|
252
251
|
- bin/wdump
|
253
252
|
- bin/wmap
|
254
|
-
- bin/wmaps
|
255
253
|
- bin/wscan
|
256
254
|
- demos/bruter.rb
|
257
255
|
- demos/dns_brutes.rb
|
@@ -303,11 +301,12 @@ files:
|
|
303
301
|
- lib/wmap/utils/logger.rb
|
304
302
|
- lib/wmap/utils/url_magic.rb
|
305
303
|
- lib/wmap/utils/utils.rb
|
304
|
+
- lib/wmap/utils/wp_detect.rb
|
306
305
|
- lib/wmap/whois.rb
|
307
306
|
- settings/discovery_ports
|
308
307
|
- settings/google_keywords.txt
|
309
308
|
- settings/google_locator.txt
|
310
|
-
-
|
309
|
+
- test/cidr_tracker_test.rb
|
311
310
|
- test/domain_tracker_test.rb
|
312
311
|
- test/utils_test.rb
|
313
312
|
- version.txt
|
@@ -334,9 +333,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
333
|
- !ruby/object:Gem::Version
|
335
334
|
version: '0'
|
336
335
|
requirements: []
|
337
|
-
|
338
|
-
|
339
|
-
signing_key:
|
336
|
+
rubygems_version: 3.0.9
|
337
|
+
signing_key:
|
340
338
|
specification_version: 4
|
341
339
|
summary: A pure Ruby web application and service discovery API.
|
342
340
|
test_files: []
|
data/bin/RHPG
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Executable to lookup then merge site tech details into the RHPG asset spreadsheet in CSV format only
|
3
|
-
#
|
4
|
-
## Usage: RHPG [RHPG.csv]
|
5
|
-
require "wmap"
|
6
|
-
require "csv"
|
7
|
-
include Wmap::Utils
|
8
|
-
|
9
|
-
def print_usage
|
10
|
-
puts "Program to lookup then merge the site details into RHPG asset spreadsheet. \nUsage: RHPG [RHPG.csv]"
|
11
|
-
end
|
12
|
-
|
13
|
-
# Lookup the site store for a domain; then return the fingger print info of the site
|
14
|
-
def site_tracker_lookup(domain)
|
15
|
-
tracker=Wmap::SiteTracker.instance
|
16
|
-
tracker.verbose=false
|
17
|
-
#first order search
|
18
|
-
tracker.known_sites.each do |key,val|
|
19
|
-
if key.include?(domain.strip.downcase) && key.include?("https")
|
20
|
-
tracker=nil
|
21
|
-
return [key] + val.values
|
22
|
-
end
|
23
|
-
end
|
24
|
-
#second order search
|
25
|
-
tracker.known_sites.each do |key,val|
|
26
|
-
if key.include?(domain.strip.downcase)
|
27
|
-
tracker=nil
|
28
|
-
return [key] + val.values
|
29
|
-
end
|
30
|
-
end
|
31
|
-
tracker=nil
|
32
|
-
return [nil]*9
|
33
|
-
end
|
34
|
-
|
35
|
-
# look up the wp site data store for a domain; then return the wp finger print info: [is_wp?,wp_ver]
|
36
|
-
def wp_tracker_lookup(domain)
|
37
|
-
tracker=Wmap::WpTracker.new(:verbose=>false)
|
38
|
-
# first order
|
39
|
-
tracker.known_wp_sites.each do |key,val|
|
40
|
-
if key.include?(domain.strip.downcase) && val
|
41
|
-
ver=tracker.wp_ver(key)
|
42
|
-
tracker=nil
|
43
|
-
return [val,ver]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
# second order
|
47
|
-
tracker.known_wp_sites.each do |key,val|
|
48
|
-
if key.include?(domain.strip.downcase) && key.include?("https") && val
|
49
|
-
tracker=nil
|
50
|
-
return [val,nil]
|
51
|
-
end
|
52
|
-
end
|
53
|
-
# third order
|
54
|
-
tracker.known_wp_sites.each do |key,val|
|
55
|
-
if key.include?(domain.strip.downcase)
|
56
|
-
tracker=nil
|
57
|
-
return [val,nil]
|
58
|
-
end
|
59
|
-
end
|
60
|
-
tracker=nil
|
61
|
-
return [nil,nil]
|
62
|
-
end
|
63
|
-
|
64
|
-
# perform the wpscan on a site
|
65
|
-
def wpscan(domain)
|
66
|
-
url=site_tracker_lookup(domain)[0]
|
67
|
-
return nil if url.nil?
|
68
|
-
if url.include?("https")
|
69
|
-
command="wpscan --disable-tls-checks --ignore-main-redirect --url=" + url + " -o " + domain + ".wpscan"
|
70
|
-
else
|
71
|
-
command="wpscan --ignore-main-redirect --url=" + url + " -o " + domain + ".wpscan"
|
72
|
-
end
|
73
|
-
system(command)
|
74
|
-
end
|
75
|
-
|
76
|
-
puts Wmap.banner
|
77
|
-
print_usage
|
78
|
-
|
79
|
-
# open output file to write
|
80
|
-
CSV.open("output.csv", "wb") do |csv|
|
81
|
-
cnt=1
|
82
|
-
# open RHPG input file to read
|
83
|
-
CSV.foreach(ARGV[0]) do |row|
|
84
|
-
puts "Processing row #{cnt}"
|
85
|
-
#puts row.inspect
|
86
|
-
my_row=Array.new
|
87
|
-
if cnt > 1
|
88
|
-
if is_domain?(row[0])
|
89
|
-
=begin
|
90
|
-
if row[3] =~ /Keep/i && row[3] != /Redirect/i
|
91
|
-
unless File.exist?(row[0]+".wpscan")
|
92
|
-
wpscan(row[0])
|
93
|
-
end
|
94
|
-
end
|
95
|
-
=end
|
96
|
-
my_row = row + site_tracker_lookup(row[0]) + wp_tracker_lookup(row[0])
|
97
|
-
else
|
98
|
-
my_row = row + [nil]*10
|
99
|
-
end
|
100
|
-
else
|
101
|
-
my_row = row + ["Website","Primary IP","Port","Hosting Status","Server","Response Code","MD5 Finger-print","Redirection","Timestamp", "WordPress", "WordPress Version"]
|
102
|
-
end
|
103
|
-
cnt+=1
|
104
|
-
csv << my_row
|
105
|
-
end
|
106
|
-
puts "All done. "
|
107
|
-
end
|
data/bin/wmaps
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# script to automate the new site discovery through by crawling all unique sites in the site store
|
3
|
-
require "wmap"
|
4
|
-
require "parallel"
|
5
|
-
|
6
|
-
def wmap_worker(domain)
|
7
|
-
cmd = "wmap " + domain
|
8
|
-
puts "wmap discovery on domain: ", domain
|
9
|
-
system(cmd)
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
tracker=Wmap::DomainTracker.instance
|
14
|
-
Parallel.map(tracker.known_internet_domains.keys, :in_processes => 10) { |target|
|
15
|
-
puts "Working on #{target} ..." if @verbose
|
16
|
-
wmap_worker(target)
|
17
|
-
}
|
18
|
-
=begin
|
19
|
-
tracker.known_internet_domains.keys.map do |domain|
|
20
|
-
wmap_worker(domain)
|
21
|
-
end
|
22
|
-
=end
|
23
|
-
tracker=nil
|