wmap 2.4.6 → 2.4.8
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/CHANGELOG.md +2 -2
- data/bin/RHPG +24 -2
- data/bin/distrust +2 -3
- data/bin/trust +1 -1
- data/bin/trusts +1 -1
- data/bin/updateAll +12 -5
- data/bin/wadd +23 -4
- data/bin/wadds +23 -3
- data/bin/wdel +23 -4
- data/bin/wmap +10 -6
- data/bin/wmaps +3 -4
- data/demos/bruter.rb +1 -1
- data/demos/dns_brutes.rb +1 -1
- data/demos/filter_domain.rb +1 -1
- data/demos/filter_known_services.rb +2 -2
- data/demos/filter_prime.rb +1 -1
- data/demos/filter_site.rb +2 -2
- data/demos/filter_siteip.rb +1 -1
- data/demos/filter_url.rb +1 -1
- data/demos/new_fnd.rb +2 -2
- data/demos/site_format.rb +1 -1
- data/demos/whois_domain.rb +2 -2
- data/lib/wmap/dns_bruter.rb +4 -2
- data/lib/wmap/domain_tracker/sub_domain.rb +6 -3
- data/lib/wmap/domain_tracker.rb +3 -2
- data/lib/wmap/host_tracker/primary_host.rb +17 -13
- data/lib/wmap/host_tracker.rb +36 -29
- data/lib/wmap/site_tracker/deactivated_site.rb +2 -2
- data/lib/wmap/site_tracker.rb +25 -12
- data/lib/wmap/url_checker.rb +5 -4
- data/lib/wmap/utils/utils.rb +33 -33
- data/lib/wmap/wp_tracker.rb +75 -7
- data/lib/wmap.rb +12 -11
- data/logs/wmap.log +30 -0
- data/test/domain_tracker_test.rb +5 -5
- data/version.txt +2 -2
- data/wmap.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '039be636ec3179df0106265ea90c9ac86a27f34c1291564a266f97d03105c86c'
|
4
|
+
data.tar.gz: 73453c025547726381e0effd66bae71977b1a242952a6b83e6e8ba7c5d81378f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdfd196feab5fcd300a8b7856ca1731f90e799cb13ae1545a81aa5ababc859131fdcd9f6f522b6945de200e312e661d89e1cd824e0d0f4587a2d8c7c1e49fe9a
|
7
|
+
data.tar.gz: 27a27879fed90a64f9ff71407388b6e8cbc1ad6e6c8d67964cdfed8a03e729f2a725ed69b738c2c6636912256f3e9fb3a32fd74e923d193b7d5ea5ad290bafa4
|
data/CHANGELOG.md
CHANGED
@@ -39,9 +39,9 @@
|
|
39
39
|
- 02/11/2015 A bug fix on the Wmap::SiteTracker.get_prim_uniq_sites method, where host resolved to multiple IPs could
|
40
40
|
- cause exception in the rare case.
|
41
41
|
- 02/10/2015 Implement the 'singleton' module in the Wmap::HostTracker::PrimaryHost class
|
42
|
-
- 02/05/2015 Implement singleton pattern on the Wmap::DomainTracker::SubDomain, Wmap::SiteTracker::DeactivatedSite class.
|
42
|
+
- 02/05/2015 Implement singleton pattern on the Wmap::DomainTracker.instance::SubDomain, Wmap::SiteTracker::DeactivatedSite class.
|
43
43
|
- 02/03/2015 Implement singleton pattern on the logger module, re-organize the log file structure and location.
|
44
|
-
- 01/30/2015 Implement the singleton pattern on the Wmap::SiteTracker, Wmap::DomainTracker class.
|
44
|
+
- 01/30/2015 Implement the singleton pattern on the Wmap::SiteTracker, Wmap::DomainTracker.instance class.
|
45
45
|
- 01/27/2015 Separate the logger sub-module and implement the singleton pattern on the logger.
|
46
46
|
- 01/24/2015 Implement the 'singleton' module in the Wmap::HostTracker class, in order to avoid race condition
|
47
47
|
- under the parallel engine
|
data/bin/RHPG
CHANGED
@@ -10,8 +10,10 @@ def print_usage
|
|
10
10
|
puts "Program to lookup then merge the site details into RHPG asset spreadsheet. \nUsage: RHPG [RHPG.csv]"
|
11
11
|
end
|
12
12
|
|
13
|
+
# Lookup the site store for a domain; then return the fingger print info of the site
|
13
14
|
def site_lookup(domain)
|
14
|
-
tracker=Wmap::SiteTracker.
|
15
|
+
tracker=Wmap::SiteTracker.instance
|
16
|
+
tracker.verbose=false
|
15
17
|
#first order search
|
16
18
|
tracker.known_sites.each do |key,val|
|
17
19
|
if key.include?(domain.strip.downcase) && key.include?("https")
|
@@ -30,6 +32,7 @@ def site_lookup(domain)
|
|
30
32
|
return [nil]*9
|
31
33
|
end
|
32
34
|
|
35
|
+
# look up the wp site data store for a domain; then return the wp finger print info: [is_wp?,wp_ver]
|
33
36
|
def wp_site_lookup(domain)
|
34
37
|
tracker=Wmap::WpTracker.new(:verbose=>false)
|
35
38
|
# first order
|
@@ -42,7 +45,7 @@ def wp_site_lookup(domain)
|
|
42
45
|
end
|
43
46
|
# second order
|
44
47
|
tracker.known_wp_sites.each do |key,val|
|
45
|
-
if key.include?(domain.strip.downcase) && key.include?("https")
|
48
|
+
if key.include?(domain.strip.downcase) && key.include?("https") && val
|
46
49
|
tracker=nil
|
47
50
|
return [val,nil]
|
48
51
|
end
|
@@ -58,6 +61,18 @@ def wp_site_lookup(domain)
|
|
58
61
|
return [nil,nil]
|
59
62
|
end
|
60
63
|
|
64
|
+
# perform the wpscan on a site
|
65
|
+
def wpscan(domain)
|
66
|
+
url=site_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
|
+
|
61
76
|
puts Wmap.banner
|
62
77
|
print_usage
|
63
78
|
|
@@ -71,6 +86,13 @@ CSV.open("output.csv", "wb") do |csv|
|
|
71
86
|
my_row=Array.new
|
72
87
|
if cnt > 1
|
73
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
|
74
96
|
my_row = row + site_lookup(row[0]) + wp_site_lookup(row[0])
|
75
97
|
else
|
76
98
|
my_row = row + [nil]*10
|
data/bin/distrust
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Executable to remove entry from the ring of the trust. I.E. the trusted domain or CIDR
|
2
|
+
# Executable to remove entry from the ring of the trust. I.E. the trusted domain or CIDR
|
3
3
|
require "wmap"
|
4
4
|
|
5
5
|
def print_usage
|
@@ -18,7 +18,7 @@ abort "Incorrect program argument! Proper Usage: distrust [domain | netblock]" u
|
|
18
18
|
puts "Start the demonizing ..."
|
19
19
|
|
20
20
|
|
21
|
-
if dt.is_domain?(ARGV[0])
|
21
|
+
if dt.is_domain?(ARGV[0])
|
22
22
|
result=dt.delete(ARGV[0])
|
23
23
|
unless result.nil?
|
24
24
|
dt.save!
|
@@ -35,4 +35,3 @@ if ct.is_cidr?(ARGV[0].to_s)
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
ct=nil
|
38
|
-
|
data/bin/trust
CHANGED
@@ -11,7 +11,7 @@ print_usage
|
|
11
11
|
Log_dir=File.dirname(__FILE__)+'/../logs/'
|
12
12
|
Wmap.wlog("Execute the command: trust #{ARGV[0]}","trust",Log_dir+"wmap.log")
|
13
13
|
|
14
|
-
dt=Wmap::DomainTracker.
|
14
|
+
dt=Wmap::DomainTracker.instance
|
15
15
|
ct=Wmap::CidrTracker.new(:verbose=>true)
|
16
16
|
abort "Incorrect program argument! Proper usage: trust [domain | netblock]" unless ARGV.length==1 && (dt.is_fqdn?(ARGV[0]) || ct.is_cidr?(ARGV[0]))
|
17
17
|
|
data/bin/trusts
CHANGED
@@ -11,7 +11,7 @@ print_usage
|
|
11
11
|
Log_dir=File.dirname(__FILE__)+'/../logs/'
|
12
12
|
Wmap.wlog("Execute the command: trust #{ARGV[0]}","trust",Log_dir+"wmap.log")
|
13
13
|
|
14
|
-
dt=Wmap::DomainTracker.new
|
14
|
+
dt=Wmap::DomainTracker.instance.new
|
15
15
|
ct=Wmap::CidrTracker.new(:verbose=>true)
|
16
16
|
abort "Incorrect program argument! Proper usage: trust [domain | netblock]" unless ARGV.length==1 && (File.exist?(ARGV[0]))
|
17
17
|
|
data/bin/updateAll
CHANGED
@@ -19,33 +19,40 @@ else
|
|
19
19
|
abort "You got it. Mission is successfully aborted. "
|
20
20
|
end
|
21
21
|
# Update sub-domain table
|
22
|
-
sd=Wmap::DomainTracker::SubDomain.
|
22
|
+
sd=Wmap::DomainTracker::SubDomain.instance
|
23
23
|
sd.update_from_host_store!
|
24
24
|
subs=sd.known_internet_sub_domains.keys
|
25
25
|
sd=nil
|
26
26
|
|
27
|
+
# Update Domain table
|
28
|
+
dm=Wmap::DomainTracker.instance
|
29
|
+
domains=dm.known_internet_domains.keys
|
30
|
+
dm=nil
|
31
|
+
|
27
32
|
# Brute force sub-domains to detect sub-domain hosts
|
28
33
|
bruter=Wmap::DnsBruter.new
|
29
34
|
sub_hosts=bruter.brutes(subs).values.flatten
|
35
|
+
hosts=bruter.brutes(domains).values.flatten
|
30
36
|
|
31
37
|
# Update primary host store
|
32
|
-
ph=Wmap::HostTracker::PrimaryHost.
|
38
|
+
ph=Wmap::HostTracker::PrimaryHost.instance
|
33
39
|
ph.update_from_site_store!
|
34
40
|
ph.refresh_all
|
35
41
|
ph.save!
|
36
42
|
ph=nil
|
37
43
|
|
38
44
|
# Update host store
|
39
|
-
h=Wmap::HostTracker.
|
45
|
+
h=Wmap::HostTracker.instance
|
40
46
|
h.refresh_all
|
41
47
|
h.adds(sub_hosts)
|
48
|
+
h.adds(hosts)
|
42
49
|
h.save!
|
43
50
|
h=nil
|
44
51
|
|
45
52
|
# Update site store
|
46
|
-
st=Wmap::SiteTracker.
|
53
|
+
st=Wmap::SiteTracker.instance
|
47
54
|
st.refresh_all
|
48
|
-
dt=Wmap::SiteTracker::DeactivatedSite.
|
55
|
+
dt=Wmap::SiteTracker::DeactivatedSite.instance
|
49
56
|
ds=dt.known_sites.keys
|
50
57
|
st.adds(ds) #double-check the de-activated sites in case the site is back on-line again
|
51
58
|
st.save!
|
data/bin/wadd
CHANGED
@@ -4,16 +4,35 @@
|
|
4
4
|
require "wmap"
|
5
5
|
|
6
6
|
def print_usage
|
7
|
-
puts "Program to add an entry into the local data repository. Usage: wadd [
|
7
|
+
puts "Program to add an entry into the local data repository. Usage: wadd <site> [data_dir]"
|
8
8
|
end
|
9
9
|
|
10
10
|
puts Wmap.banner
|
11
11
|
print_usage
|
12
|
-
|
12
|
+
if ARGV.length == 1
|
13
|
+
# Log the command entry
|
14
|
+
Log_dir = File.dirname(__FILE__) + '/../logs/'
|
15
|
+
elsif ARGV.length == 2
|
16
|
+
# Log to the instance running directory
|
17
|
+
Log_dir = File.dirname(__FILE__) + '/../logs/' + ARGV[1]
|
18
|
+
else
|
19
|
+
Log_dir = File.dirname(__FILE__) + '/../logs/'
|
20
|
+
end
|
21
|
+
Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
|
13
22
|
Wmap.wlog("Execute the command: wadd #{ARGV[0]}","wadd",Log_dir+"wmap.log")
|
14
23
|
|
15
|
-
|
16
|
-
|
24
|
+
if ARGV.length == 1
|
25
|
+
puts puts "Invoke the SiteTracker."
|
26
|
+
st=Wmap::SiteTracker.instance
|
27
|
+
st.verbose=false
|
28
|
+
elsif ARGV.length == 2
|
29
|
+
puts puts "Invoke the SiteTracker."
|
30
|
+
st=Wmap::SiteTracker.instance
|
31
|
+
st.verbose=false
|
32
|
+
st.data_dir=ARGV[1]
|
33
|
+
else
|
34
|
+
aborts "Error firing up SiteTracker instance!"
|
35
|
+
end
|
17
36
|
|
18
37
|
# Evaluate the argument and update the data store accordingly
|
19
38
|
if st.is_site?(ARGV[0])
|
data/bin/wadds
CHANGED
@@ -8,11 +8,30 @@ end
|
|
8
8
|
|
9
9
|
puts Wmap.banner
|
10
10
|
print_usage
|
11
|
-
|
11
|
+
abort "Incorrect program argument!" unless File.exist?(ARGV[0])
|
12
|
+
|
13
|
+
if ARGV.length == 1
|
14
|
+
# Log the command entry
|
15
|
+
Log_dir = File.dirname(__FILE__)+'/../logs/'
|
16
|
+
elsif ARGV.length == 2
|
17
|
+
# Log to the instance running directory
|
18
|
+
Log_dir = File.dirname(__FILE__)+'/../logs/' + ARGV[1]
|
19
|
+
end
|
20
|
+
Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
|
12
21
|
Wmap.wlog("Execute the command: wadds #{ARGV[0]}","wadds",Log_dir+"wmap.log")
|
13
22
|
|
14
|
-
|
15
|
-
|
23
|
+
if ARGV.length == 1
|
24
|
+
puts puts "Invoke the SiteTracker."
|
25
|
+
st=Wmap::SiteTracker.instance
|
26
|
+
st.verbose=false
|
27
|
+
elsif ARGV.length == 2
|
28
|
+
puts puts "Invoke the SiteTracker."
|
29
|
+
st=Wmap::SiteTracker.instance
|
30
|
+
st.verbose=false
|
31
|
+
st.data_dir=ARGV[1]
|
32
|
+
else
|
33
|
+
aborts "Error firing up SiteTracker instance!"
|
34
|
+
end
|
16
35
|
|
17
36
|
# Evaluate the argument and update the data store accordingly
|
18
37
|
sites=st.file_2_list(ARGV[0]).map { |x| st.url_2_site(x) }
|
@@ -22,5 +41,6 @@ if sites.length > 0
|
|
22
41
|
st.save! if news.length>0
|
23
42
|
st=nil
|
24
43
|
else
|
44
|
+
st=nil
|
25
45
|
abort "No site entry found in file: #{ARGV[0]}. Please check your file format to ensure one site per line."
|
26
46
|
end
|
data/bin/wdel
CHANGED
@@ -4,16 +4,35 @@
|
|
4
4
|
require "wmap"
|
5
5
|
|
6
6
|
def print_usage
|
7
|
-
puts "Program to delete an entry from the local data repository. Usage: wdel [
|
7
|
+
puts "Program to delete an entry from the local data repository. Usage: wdel <site> [data_dir]"
|
8
8
|
end
|
9
9
|
|
10
10
|
puts Wmap.banner
|
11
11
|
print_usage
|
12
|
-
|
12
|
+
if ARGV.length == 1
|
13
|
+
# Log the command entry
|
14
|
+
Log_dir = File.dirname(__FILE__) + '/../logs/'
|
15
|
+
elsif ARGV.length == 2
|
16
|
+
# Log to the instance running directory
|
17
|
+
Log_dir = File.dirname(__FILE__) + '/../logs/' + ARGV[1]
|
18
|
+
else
|
19
|
+
Log_dir = File.dirname(__FILE__) + '/../logs/'
|
20
|
+
end
|
21
|
+
Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
|
13
22
|
Wmap.wlog("Execute the command: wdel #{ARGV[0]}","wdel",Log_dir+"wmap.log")
|
14
23
|
|
15
|
-
|
16
|
-
|
24
|
+
if ARGV.length == 1
|
25
|
+
puts puts "Invoke the SiteTracker."
|
26
|
+
st=Wmap::SiteTracker.instance
|
27
|
+
st.verbose=false
|
28
|
+
elsif ARGV.length == 2
|
29
|
+
puts puts "Invoke the SiteTracker."
|
30
|
+
st=Wmap::SiteTracker.instance
|
31
|
+
st.verbose=false
|
32
|
+
st.data_dir=ARGV[1]
|
33
|
+
else
|
34
|
+
aborts "Error firing up SiteTracker instance!"
|
35
|
+
end
|
17
36
|
|
18
37
|
# Evaluate the argument and update the data store accordingly
|
19
38
|
if st.is_site?(ARGV[0])
|
data/bin/wmap
CHANGED
@@ -16,9 +16,9 @@ if ARGV.length == 1
|
|
16
16
|
Log_dir=File.dirname(__FILE__)+'/../logs/'
|
17
17
|
elsif ARGV.length == 2
|
18
18
|
# Log to the instance running directory
|
19
|
-
Log_dir=
|
20
|
-
Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
|
19
|
+
Log_dir=File.dirname(__FILE__)+'/../logs/'+ARGV[1]
|
21
20
|
end
|
21
|
+
Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
|
22
22
|
|
23
23
|
Wmap.wlog("Execute the command: wmap #{ARGV[0]}","wmap",Log_dir+"wmap.log")
|
24
24
|
print_usage unless (ARGV.length==1 or ARGV.length==2)
|
@@ -67,10 +67,13 @@ end
|
|
67
67
|
# second step - update the hosts repository
|
68
68
|
if ARGV.length == 1
|
69
69
|
puts puts "Invoke the HostTracker."
|
70
|
-
host_tracker = Wmap::HostTracker.
|
70
|
+
host_tracker = Wmap::HostTracker.instance
|
71
|
+
host_tracker.verbose=true
|
71
72
|
elsif ARGV.length == 2
|
72
73
|
puts "Invoke the HostTracker with optional directory setter."
|
73
|
-
host_tracker = Wmap::HostTracker.
|
74
|
+
host_tracker = Wmap::HostTracker.instance
|
75
|
+
host_tracker.verbose=true
|
76
|
+
host_tracker.data_dir = ARGV[1]
|
74
77
|
else
|
75
78
|
aborts "Error firing up HostTracker instance!"
|
76
79
|
end
|
@@ -137,10 +140,11 @@ else
|
|
137
140
|
puts "Automatically save the discovery results into the site tracking data repository: "
|
138
141
|
if ARGV.length == 1
|
139
142
|
puts "Start the SiteTracker. "
|
140
|
-
inventory=Wmap::SiteTracker.
|
143
|
+
inventory=Wmap::SiteTracker.instance
|
141
144
|
elsif ARGV.length == 2
|
142
145
|
puts "Start the SiteTracker with the optional directory setter. "
|
143
|
-
inventory=Wmap::SiteTracker.
|
146
|
+
inventory=Wmap::SiteTracker.instance
|
147
|
+
inventory.data_dir = ARGV[1]
|
144
148
|
else
|
145
149
|
aborts "Error firing up SiteTracker instance!"
|
146
150
|
end
|
data/bin/wmaps
CHANGED
@@ -10,15 +10,14 @@ def wmap_worker(domain)
|
|
10
10
|
end
|
11
11
|
|
12
12
|
|
13
|
-
tracker=Wmap::DomainTracker.
|
14
|
-
=begin
|
13
|
+
tracker=Wmap::DomainTracker.instance
|
15
14
|
Parallel.map(tracker.known_internet_domains.keys, :in_processes => 10) { |target|
|
16
15
|
puts "Working on #{target} ..." if @verbose
|
17
16
|
wmap_worker(target)
|
18
17
|
}
|
19
|
-
=
|
18
|
+
=begin
|
20
19
|
tracker.known_internet_domains.keys.map do |domain|
|
21
20
|
wmap_worker(domain)
|
22
21
|
end
|
23
|
-
|
22
|
+
=end
|
24
23
|
tracker=nil
|
data/demos/bruter.rb
CHANGED
@@ -4,7 +4,7 @@ require "wmap"
|
|
4
4
|
|
5
5
|
f_rpt=".rpt.txt"
|
6
6
|
# Step 1 - obtain list of domains to be brute-forced on
|
7
|
-
host_tracker=Wmap::HostTracker.
|
7
|
+
host_tracker=Wmap::HostTracker.instance
|
8
8
|
root_domains=host_tracker.dump_root_domains
|
9
9
|
sub_domains=host_tracker.instance.dump_sub_domains
|
10
10
|
# Step 2 - multi-thread brute forcer works on known domains and sub-domains
|
data/demos/dns_brutes.rb
CHANGED
@@ -4,7 +4,7 @@ require "wmap"
|
|
4
4
|
|
5
5
|
f_rpt=".rpt.txt"
|
6
6
|
# Step 1 - obtain list of domains to be brute-forced on
|
7
|
-
tracker=Wmap::HostTracker.
|
7
|
+
tracker=Wmap::HostTracker.instance
|
8
8
|
root_domains=tracker.dump_root_domains
|
9
9
|
sub_domains=tracker.dump_sub_domains
|
10
10
|
# Step 2 - multi-thread brute forcer works on known domains and sub-domains
|
data/demos/filter_domain.rb
CHANGED
@@ -6,7 +6,7 @@ require "wmap"
|
|
6
6
|
|
7
7
|
# Create a known service map by parsing last quarter scan list
|
8
8
|
def parse_old
|
9
|
-
host_tracker=Wmap::HostTracker.
|
9
|
+
host_tracker=Wmap::HostTracker.instance
|
10
10
|
@services=Hash.new
|
11
11
|
f_site=File.open(ARGV[0],'r')
|
12
12
|
f_site.each do |line|
|
@@ -30,7 +30,7 @@ end
|
|
30
30
|
|
31
31
|
# Go through the new scan list and look up for known service from last quarter
|
32
32
|
def diff
|
33
|
-
host_tracker=Wmap::HostTracker.
|
33
|
+
host_tracker=Wmap::HostTracker.instance
|
34
34
|
f_new = File.open(ARGV[1],'r')
|
35
35
|
f_new.each do |line|
|
36
36
|
site=line.chomp.strip
|
data/demos/filter_prime.rb
CHANGED
data/demos/filter_site.rb
CHANGED
@@ -7,7 +7,7 @@ require "wmap"
|
|
7
7
|
@map=Hash.new
|
8
8
|
|
9
9
|
def build_map (file)
|
10
|
-
k=Wmap::SiteTracker.
|
10
|
+
k=Wmap::SiteTracker.instance
|
11
11
|
f=File.open(file,'r')
|
12
12
|
f.each do |line|
|
13
13
|
url=line.chomp.strip.downcase
|
@@ -23,7 +23,7 @@ end
|
|
23
23
|
|
24
24
|
|
25
25
|
build_map(ARGV[0])
|
26
|
-
s=Wmap::SiteTracker.
|
26
|
+
s=Wmap::SiteTracker.instance
|
27
27
|
f=File.open(ARGV[1],'r')
|
28
28
|
f.each do |line|
|
29
29
|
url=line.chomp.strip.downcase
|
data/demos/filter_siteip.rb
CHANGED
data/demos/filter_url.rb
CHANGED
data/demos/new_fnd.rb
CHANGED
@@ -11,7 +11,7 @@ require "wmap"
|
|
11
11
|
|
12
12
|
def load_keys (file)
|
13
13
|
puts "Load the key map from file: #{file}" if @verbose
|
14
|
-
host_tracker=Wmap::HostTracker.
|
14
|
+
host_tracker=Wmap::HostTracker.instance
|
15
15
|
my_keys=Hash.new
|
16
16
|
#begin
|
17
17
|
f_old=File.open(file)
|
@@ -45,7 +45,7 @@ def load_keys (file)
|
|
45
45
|
end
|
46
46
|
|
47
47
|
old_keys=load_keys(ARGV[0])
|
48
|
-
my_tracker=Wmap::HostTracker.
|
48
|
+
my_tracker=Wmap::HostTracker.instance
|
49
49
|
f_new=File.open(ARGV[1],'r')
|
50
50
|
f_new.each_line do |line|
|
51
51
|
ent=line.chomp.split(',')
|
data/demos/site_format.rb
CHANGED
data/demos/whois_domain.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
require "wmap"
|
6
6
|
|
7
7
|
puts Wmap.banner
|
8
|
-
dis=Wmap::DomainTracker.
|
8
|
+
dis=Wmap::DomainTracker.instance
|
9
9
|
dis.verbose=false
|
10
10
|
puts "Domain Whois Lookup Summary Report"
|
11
11
|
puts "Host | Domain | Primary Domain Name Server | Registrant Name | Registrant Oraganization | Registrant Address | Registrant Zip | Registrant City | Registrant State | Registration Country | Registration Contact Phone | Registration Contact Email | Technical Contact Name | Technical Contact Organization | Technical Contact Country | Technical Contract Phone | Technical Contact Email | Admin Contact Name | Admin Contact Organization | Domain Availability"
|
@@ -75,4 +75,4 @@ f_hosts.each do |line|
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
f_hosts.close
|
78
|
-
dis=nil
|
78
|
+
dis=nil
|
data/lib/wmap/dns_bruter.rb
CHANGED
@@ -163,7 +163,8 @@ class Wmap::DnsBruter
|
|
163
163
|
begin
|
164
164
|
host=host.strip
|
165
165
|
valid_hosts = Array.new
|
166
|
-
my_host_tracker = Wmap::HostTracker.
|
166
|
+
my_host_tracker = Wmap::HostTracker.instance
|
167
|
+
my_host_tracker.data_dir=@data_dir
|
167
168
|
# build the host dictionary for the brute force method
|
168
169
|
dict = Array.new
|
169
170
|
if File.exists?(@hosts_dict)
|
@@ -247,7 +248,8 @@ class Wmap::DnsBruter
|
|
247
248
|
puts "Start the parallel brute-forcing all domains with maximum child processes: #{num}"
|
248
249
|
begin
|
249
250
|
hosts=Array.new
|
250
|
-
my_dis=Wmap::HostTracker.
|
251
|
+
my_dis=Wmap::HostTracker.instance
|
252
|
+
my_dis.data_dir=@data_dir
|
251
253
|
known_domains=my_dis.dump_root_domains
|
252
254
|
hosts=dns_brute_domains(num, known_domains)
|
253
255
|
my_dis.adds(hosts)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
#
|
6
6
|
# Copyright (c) 2012-2015 Yang Li <yang.li@owasp.org>
|
7
7
|
#++
|
8
|
-
|
8
|
+
require "singleton"
|
9
9
|
|
10
10
|
|
11
11
|
module Wmap
|
@@ -15,7 +15,7 @@ class DomainTracker
|
|
15
15
|
# of the sub-domains and the associated entities
|
16
16
|
class SubDomain < Wmap::DomainTracker
|
17
17
|
include Wmap::Utils
|
18
|
-
|
18
|
+
include Singleton
|
19
19
|
|
20
20
|
attr_accessor :verbose, :domains_file, :max_parallel, :data_dir
|
21
21
|
attr_reader :known_internet_sub_domains
|
@@ -90,7 +90,10 @@ class SubDomain < Wmap::DomainTracker
|
|
90
90
|
puts "Invoke internal procedures to update the sub-domain list from the host store."
|
91
91
|
begin
|
92
92
|
# Step 1 - obtain the latest sub-domains
|
93
|
-
|
93
|
+
my_tracker = Wmap::HostTracker.instance
|
94
|
+
my_tracker.data_dir=@data_dir
|
95
|
+
subs = my_tracker.dump_sub_domains - [nil,""]
|
96
|
+
my_tracker = nil
|
94
97
|
# Step 2 - update the sub-domain list
|
95
98
|
unless subs.empty?
|
96
99
|
#subs.map { |x| self.add(x) unless domain_known?(x) }
|
data/lib/wmap/domain_tracker.rb
CHANGED
@@ -6,13 +6,13 @@
|
|
6
6
|
# Copyright (c) 2012-2015 Yang Li <yang.li@owasp.org>
|
7
7
|
#++
|
8
8
|
require "parallel"
|
9
|
-
|
9
|
+
require "singleton"
|
10
10
|
|
11
11
|
|
12
12
|
# Class to track the known (trusted) Internet domains
|
13
13
|
class Wmap::DomainTracker
|
14
14
|
include Wmap::Utils
|
15
|
-
|
15
|
+
include Singleton
|
16
16
|
|
17
17
|
|
18
18
|
attr_accessor :verbose, :max_parallel, :domains_file, :file_domains, :data_dir
|
@@ -110,6 +110,7 @@ class Wmap::DomainTracker
|
|
110
110
|
def add(host)
|
111
111
|
puts "Add entry to the local domains cache table: #{host}" if @verbose
|
112
112
|
#begin
|
113
|
+
return nil if host.nil? or host.empty?
|
113
114
|
host=host.strip.downcase
|
114
115
|
if @known_internet_domains.key?(host)
|
115
116
|
puts "Domain is already exist. Skipping: #{host}"
|
@@ -5,7 +5,7 @@
|
|
5
5
|
#
|
6
6
|
# Copyright (c) 2012-2015 Yang Li <yang.li@owasp.org>
|
7
7
|
#++
|
8
|
-
|
8
|
+
require "singleton" # Implement singleton pattern to avoid race condition under parallel engine
|
9
9
|
|
10
10
|
|
11
11
|
module Wmap
|
@@ -14,7 +14,7 @@ module Wmap
|
|
14
14
|
# Class to differentiate the primary host-name from the potential aliases. This is needed in order to minimize the confusion on our final site inventory list, as it contains a large number of duplicates (aliases). More specifically, a filter could be built by using this class to track the primary url of a website.
|
15
15
|
class PrimaryHost < Wmap::HostTracker
|
16
16
|
include Wmap::Utils
|
17
|
-
|
17
|
+
include Singleton
|
18
18
|
|
19
19
|
attr_accessor :hosts_file, :verbose, :data_dir
|
20
20
|
attr_reader :known_hosts, :known_ips
|
@@ -35,12 +35,13 @@ module Wmap
|
|
35
35
|
|
36
36
|
# Procedures to identify primary host-name from the site store SSL certificates. The assumption is that the CN used in the cert application must be primary hostname and used by the users.
|
37
37
|
def update_from_site_store!
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
#begin
|
39
|
+
puts "Invoke internal procedures to update the primary host-name table from the site store."
|
40
|
+
# Step 1 - update the prime host table based on the SSL cert CN fields
|
41
41
|
cns=Hash.new
|
42
42
|
checker=Wmap::UrlChecker.new(:data_dir=>@data_dir)
|
43
|
-
my_tracker = Wmap::SiteTracker.
|
43
|
+
my_tracker = Wmap::SiteTracker.instance
|
44
|
+
my_tracker.data_dir = @data_dir
|
44
45
|
my_tracker.get_ssl_sites.map do |site|
|
45
46
|
puts "Exam SSL enabled site entry #{site} ..."
|
46
47
|
my_host=url_2_host(site)
|
@@ -62,12 +63,12 @@ module Wmap
|
|
62
63
|
self.save!
|
63
64
|
checker=nil
|
64
65
|
my_tracker=nil
|
65
|
-
rescue Exception => ee
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
66
|
+
#rescue Exception => ee
|
67
|
+
# puts "Exception on method #{__method__}: #{ee}" if @verbose
|
68
|
+
# checker=nil
|
69
|
+
# my_tracker=nil
|
70
|
+
# return nil
|
71
|
+
#end
|
71
72
|
end
|
72
73
|
alias_method :update!, :update_from_site_store!
|
73
74
|
|
@@ -75,7 +76,10 @@ module Wmap
|
|
75
76
|
def update_from_site_redirections!
|
76
77
|
puts "Invoke internal procedures to update the primary host-name table from the site store."
|
77
78
|
begin
|
78
|
-
|
79
|
+
my_tracker=Wmap::SiteTracker.instance
|
80
|
+
my_tracker.data_dir=@data_dir
|
81
|
+
urls = my_tracker.get_redirection_urls
|
82
|
+
my_tracker = nil
|
79
83
|
urls.map do |url|
|
80
84
|
if is_url?(url)
|
81
85
|
host=url_2_host(url)
|