wmap 2.6.7 → 2.6.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e4f2a2dfe9b4b119331eefffc7b9b025d9953c2ce5f7255e4d2a08929a591c3
4
- data.tar.gz: 3d018d69469cf4e4551b38397657341661fd95c3f59bebe8bb21405d4e107881
3
+ metadata.gz: 5cbae048aecd25ee91bdbbf75657d8f4329e9abd2c65cd90cedd65b553659ed4
4
+ data.tar.gz: 1043ec8e2dd15287c6d11b3a0094ca4b65c4684aec96cdea03085cfea431ceb8
5
5
  SHA512:
6
- metadata.gz: 7e7d27b4d4abfc34ab3df0933412b4c99e94af93f71251a2e7a0706b4782ad62a2541dbf7c5f391f47d5a3b9eae9feb45ce1690b2e43fddab4f52a14e7bb334b
7
- data.tar.gz: 0117422a9eac9f1c7a66783a0a4ca870711aeaa95252a9df8fe4f9ce2f8f10fd4ba461b2146a681f3b867becb9bace05c61a3e11b284714732432c95e12dc983
6
+ metadata.gz: b89c65b1ec441b0307ef85a322f8ced64e9443694a021301989a52761cc62496e3c2552fb21c709a01f1bf8e7834634f8d2e4d9ce6432521c6a197e02a9f7290
7
+ data.tar.gz: 71b0beedf0e8c9f75172cde52c6f40b9620a96de5ecfc69c031908e6c86534818ca1f5208711a3eb9c5852a09c1b2beda864d25c620399737442e65016bcbf98
data/README.md CHANGED
@@ -15,12 +15,13 @@
15
15
 
16
16
 
17
17
  ## What's this program for?
18
- This program is designed for the web application asset discovery and tracking. It was originally developed to
19
- to cover the gaps of a similar commercial product. Over the time it grows to be a more capable and complete replacement (IMHO).
18
+ This program is part of the [OWASP Web Mapper Project](https://www.owasp.org/index.php/OWASP_Web_Mapper_Project). It's designed for the web application asset discovery and tracking. It was originally developed to cover the gaps of a similar commercial offering. Over the time it grows to be a more capable and complete replacement (IMHO).
19
+
20
+ Note that program is mainly operating on Command Line Interface (CLI). For better user experience, you might want to use the [Web Mapper Portal Application](https://github.com/yangsec888/www_wmap) instead.
20
21
 
21
22
 
22
23
  ## WMAP in Motion
23
- Use the demo web app build on top of wmap gem: http://wmap.io
24
+ You can try out the complete [demo web app](http://wmap.io/) deployed in the DigitalOcean cloud: http://wmap.io/
24
25
 
25
26
 
26
27
  ## Installation
@@ -35,7 +36,8 @@ Nokogiri is a native xml/html parser used by the project. It's fast and powerful
35
36
  ### Dependency
36
37
  You need the Ruby 2.1.0 or above in order to use this program. In my test environment, I was able to set it up with <a href="https://rvm.io/">RVM</a>. Please refer to this page for more installation information: https://www.ruby-lang.org/en/documentation/installation/
37
38
 
38
- In addition, the following Ruby GEM dependency are needed by different components of this software. The should be installed automatically:
39
+ In addition, the following Ruby GEM dependency are needed by different features of this software. They should be installed automatically when you install the 'wmap' gem above.
40
+ ```
39
41
  require "dnsruby"
40
42
  require "geoip"
41
43
  require "minitest/autorun"
@@ -48,11 +50,13 @@ In addition, the following Ruby GEM dependency are needed by different component
48
50
  require "parallel"
49
51
  require "whois"
50
52
  require 'httpclient'
51
-
53
+ ```
52
54
 
53
55
  In case you want to install the above gems separately, use the command below:
54
-
56
+ ```sh
55
57
  gem install dnsruby geoip minitest net-ping netaddr nokogiri css_parser open_uri_redirections openssl parallel whois httpclient
58
+ ```
59
+
56
60
 
57
61
  ### Ruby-whois Gem Patches
58
62
  This software depends on a patched version of Ruby gem ruby-whois (http://www.ruby-whois.org/) for the domain whois lookup feature. For better result, you could manually add the patches into your local whois gem installation directory as shown below:
@@ -106,7 +110,7 @@ If you need additional documentation / information other than this README file a
106
110
 
107
111
 
108
112
  ## Program Version
109
- The latest release is version [2.5.5+](version.txt). as of fall 2018. Please refer to the [CHANGELOG.md](CHANGELOG.md) for more history information.
113
+ The latest release is version [2.6.5+](version.txt). as of fall 2019. Please refer to the [CHANGELOG.md](CHANGELOG.md) for more history information.
110
114
 
111
115
 
112
116
  ## Author Contact
data/bin/updateAll CHANGED
@@ -1,14 +1,41 @@
1
1
  #!/usr/bin/env ruby
2
2
  # the up to date program to refresh all local cache tables in one shot. Note it requires an uninterrupted Internet connection to perform the job. It also takes a long time so patient is needed. Lastly, don't forget to backup the existing 'data' folder before execute this command, cause any unexpected interruption may wreak havoc on the existing data file!!!
3
-
3
+ #
4
+ #
5
+ # Usage: updateAll -d <Optional Data Directory>
4
6
  require "wmap"
7
+ require "optparse"
8
+
9
+ # program command line options
10
+ options = {:data_dir => nil, :target => nil, :verbose => false}
11
+ parser = OptionParser.new do|opts|
12
+ opts.banner = Wmap.banner
13
+ opts.on('-d', '--data_dir data_dir', 'Web Mapper local cache data directory') do |data_dir|
14
+ options[:data_dir] = data_dir;
15
+ end
16
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
17
+ options[:verbose] = v;
18
+ end
19
+ opts.on('-h', '--help', 'Displays Help') do
20
+ puts opts
21
+ exit 0
22
+ end
23
+ end
24
+ parser.parse!
5
25
 
6
26
  puts Wmap.banner
7
27
  puts "Program to refresh the local data repository."
8
- Log_dir=File.dirname(__FILE__)+'/../logs/'
28
+ # Preparing - check out the working logs directory
29
+ if options[:data_dir]
30
+ # Log to the instance running directory
31
+ Log_dir = Pathname.new(options[:data_dir]).join('logs')
32
+ else
33
+ # Log the command entry
34
+ Log_dir=Pathname.new(Gem.loaded_specs['wmap'].full_gem_path).join('logs')
35
+ end
36
+ Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
9
37
  Wmap.wlog("Execute the command: updateAll","updateAll",Log_dir+"wmap.log")
10
38
 
11
- abort "Incorrect program argument - no argument needed! Proper Usage: updateAll" unless ARGV.length==0
12
39
  =begin
13
40
  puts "You're about to update Wmap data repository. It'll take a long time. And the Internet connection must be un-interrupted during the process. You're also expected to backup the data folder before proceeding. Are you ready? (Yes/No)"
14
41
  STDOUT.flush
@@ -21,22 +48,41 @@ end
21
48
  =end
22
49
  # Update sub-domain table
23
50
  sd=Wmap::DomainTracker::SubDomain.instance
51
+ if options[:data_dir]
52
+ sd.data_dir=options[:data_dir]
53
+ sd.sub_domains_file = sd.data_dir + "/" + "sub_domains"
54
+ sd.known_internet_sub_domains = sd.load_domains_from_file(sd.sub_domains_file)
55
+ end
24
56
  sd.update_from_host_store!
25
57
  subs=sd.known_internet_sub_domains.keys
26
58
  sd=nil
27
59
 
28
60
  # Update Domain table
29
61
  dm=Wmap::DomainTracker.instance
62
+ if options[:data_dir]
63
+ dm.data_dir=options[:data_dir]
64
+ dm.domains_file=dm.data_dir + "/" + "domains"
65
+ dm.load_domains_from_file(dm.domains_file)
66
+ end
30
67
  domains=dm.known_internet_domains.keys
31
68
  dm=nil
32
69
 
33
70
  # Brute force sub-domains to detect sub-domain hosts
34
- bruter=Wmap::DnsBruter.new
71
+ bruter=Wmap::DnsBruter.new(:verbose => options[:verbose])
72
+ if options[:data_dir]
73
+ bruter.data_dir=options[:data_dir]
74
+ bruter.file_hosts = bruter.data_dir + "/" + "hosts"
75
+ end
35
76
  sub_hosts=bruter.brutes(subs).values.flatten
36
77
  hosts=bruter.brutes(domains).values.flatten
37
78
 
38
79
  # Update primary host store
39
80
  ph=Wmap::HostTracker::PrimaryHost.instance
81
+ if options[:data_dir]
82
+ ph.data_dir=options[:data_dir]
83
+ ph.hosts_file = ph.data_dir + "/" + "prime_hosts"
84
+ ph.load_known_hosts_from_file(ph.hosts_file)
85
+ end
40
86
  ph.update_from_site_store!
41
87
  ph.refresh_all
42
88
  ph.save!
@@ -44,6 +90,11 @@ ph=nil
44
90
 
45
91
  # Update host store
46
92
  h=Wmap::HostTracker.instance
93
+ if options[:data_dir]
94
+ h.data_dir=options[:data_dir]
95
+ h.hosts_file=h.data_dir + "/" +"hosts"
96
+ h.load_known_hosts_from_file(h.hosts_file)
97
+ end
47
98
  h.refresh_all
48
99
  h.adds(sub_hosts)
49
100
  h.adds(hosts)
@@ -52,10 +103,21 @@ h=nil
52
103
 
53
104
  # Update site store
54
105
  st=Wmap::SiteTracker.instance
106
+ if options[:data_dir]
107
+ st.data_dir=options[:data_dir]
108
+ st.sites_file=st.data_dir + "/" +"sites"
109
+ st.load_site_stores_from_file(st.sites_file)
110
+ end
55
111
  st.refresh_all
112
+ # double-check the de-activated sites in case the site is back on-line again
56
113
  dt=Wmap::SiteTracker::DeactivatedSite.instance
114
+ if options[:data_dir]
115
+ dt.data_dir = options[:data_dir]
116
+ dt.sites_file = dt.data_dir + "/" + "deactivated_sites"
117
+ dt.known_sites = dt.load_site_stores_from_file(dt.sites_file)
118
+ end
57
119
  ds=dt.known_sites.keys
58
- st.adds(ds) #double-check the de-activated sites in case the site is back on-line again
120
+ st.adds(ds)
59
121
  st.save!
60
122
  st=nil
61
123
  dt=nil
data/bin/wmap CHANGED
@@ -28,7 +28,7 @@ parser.parse!
28
28
 
29
29
  # print program banner
30
30
  puts Wmap.banner
31
- print_usage unless options[:target]
31
+ # print_usage unless options[:target]
32
32
 
33
33
  # Preparing - check out the working logs directory
34
34
  if options[:data_dir]
@@ -13,7 +13,7 @@ require "parallel"
13
13
  class Wmap::DnsBruter
14
14
  include Wmap::Utils
15
15
 
16
- attr_accessor :hosts_dict, :verbose, :max_parallel, :data_dir
16
+ attr_accessor :hosts_dict, :verbose, :max_parallel, :data_dir, :file_hosts
17
17
  attr_reader :discovered_hosts_from_dns_bruter, :fail_domain_cnt
18
18
 
19
19
  # Set default instance variables
@@ -22,11 +22,9 @@ class Wmap::DnsBruter
22
22
  @data_dir=params.fetch(:data_dir, File.dirname(__FILE__)+'/../../data/')
23
23
  Dir.mkdir(@data_dir) unless Dir.exist?(@data_dir)
24
24
  @file_hosts = @data_dir + 'hosts'
25
- @file_hosts_dict = File.dirname(__FILE__)+'/../../dicts/hostnames-dict.txt'
26
-
27
25
  @verbose=params.fetch(:verbose, false)
28
26
  @discovered_hosts_from_dns_bruter=Hash.new
29
- @hosts_dict=params.fetch(:hosts_dict, @file_hosts_dict)
27
+ @hosts_dict=params.fetch(:hosts_dict, File.dirname(__FILE__)+'/../../dicts/hostnames-dict.txt')
30
28
  @max_parallel=params.fetch(:max_parallel, 30)
31
29
  @fail_domain_cnt=Hash.new
32
30
  end
@@ -23,6 +23,7 @@ class SubDomain < Wmap::DomainTracker
23
23
  def initialize (params = {})
24
24
  @verbose=params.fetch(:verbose, false)
25
25
  @data_dir=params.fetch(:data_dir, File.dirname(__FILE__)+'/../../../data/')
26
+ Dir.mkdir(@data_dir) unless Dir.exist?(@data_dir)
26
27
  @max_parallel=params.fetch(:max_parallel, 40)
27
28
  # Hash table to hold the trusted domains
28
29
  @sub_domains_file=params.fetch(:sub_domains_file, @data_dir + 'sub_domains')
@@ -85,7 +86,9 @@ class SubDomain < Wmap::DomainTracker
85
86
  puts "Invoke internal procedures to update the sub-domain list from the host store."
86
87
  # Step 1 - obtain the latest sub-domains
87
88
  my_tracker = Wmap::HostTracker.instance
88
- my_tracker.data_dir=@data_dir
89
+ my_tracker.data_dir = @data_dir
90
+ my_tracker.hosts_file = my_tracker.data_dir + "/" + "hosts"
91
+ my_tracker.load_known_hosts_from_file(my_tracker.hosts_file)
89
92
  subs = my_tracker.dump_sub_domains - [nil,""]
90
93
  my_tracker = nil
91
94
  # Step 2 - update the sub-domain list
@@ -133,4 +136,4 @@ class SubDomain < Wmap::DomainTracker
133
136
 
134
137
  end
135
138
  end
136
- end
139
+ end
@@ -136,6 +136,7 @@ class Wmap::SiteTracker
136
136
  # Add logic to check site status before adding it
137
137
  checker=Wmap::UrlChecker.new(:data_dir=>@data_dir).check(site)
138
138
  raise "Site is currently down. Skip #{site}" if checker.nil?
139
+ raise "Site is time-out. Skip #{site}" if checker["code"] == 10000
139
140
  # Skip the http site if it's un-responsive; for the https we'll keep it because we're interested in analysing the SSL layer later
140
141
  if is_https?(site)
141
142
  # do nothing
@@ -36,7 +36,7 @@ class Wmap::WpTracker
36
36
  end
37
37
 
38
38
  # 'setter' to load the known wordpress sites into an instance variable
39
- def load_from_file (file=@file_stores, lc=true)
39
+ def load_from_file (file=@sites_wp, lc=true)
40
40
  puts "Loading trusted file: #{file}" if @verbose
41
41
  @known_wp_sites=Hash.new
42
42
  f_wp_sites=File.open(file, 'r')
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.6.7
7
- date = 2019-11-19
6
+ version = 2.6.8
7
+ date = 2019-11-15
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.6.7
4
+ version: 2.6.8
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: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2019-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dnsruby