wmap 2.5.9 → 2.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 940635362c6d612134a052e37c5bbcd49ad7a8bb801b5a767ea4a59d141740ee
4
- data.tar.gz: 3538d199e5fe4c9fad108a87a96d002ca76e290a42bda9714e0d655ac7d9ef80
3
+ metadata.gz: b514075e869f95275a03d0d7a3951338b0307a3cd948cdcb074cb71c268c163d
4
+ data.tar.gz: 933123a0a7a51ec74edb3e7ac58c9247c329715301fbd02ed5d5f8b902c3d135
5
5
  SHA512:
6
- metadata.gz: c458e2c002a4aea5552cb2698c6776adab599aca664aa8f750b9fd42a9920634489e138c589dd58d9cb2924b2920cd5c0daf0731285ecb58fcb0bae45dfae8aa
7
- data.tar.gz: c07aa8ccd2f405535eeb48f675b76690bba42d3c5f2d7649b7170df873ab421f38532651c45bc09967bd3a761a87639cc5f1fb64cd189afead956f946376c27e
6
+ metadata.gz: 1ee291ad43397feb0ac7a20466eb373c2eed2f7ff516d00a2f6ebc4f94b597dd2ac8a21d1321d60dfc1155884703759602e63431a7bd8a11f30aa893192d5f0e
7
+ data.tar.gz: 69a4b53667c5c8c4bd24134c4c7122e5db9ee274c3f79cde037f7278c373d536933d6fbbed464e6f176e0cece4c6621eb951e884e9f61d881c64074721019ad3
data/bin/wmap CHANGED
@@ -128,8 +128,8 @@ else
128
128
  puts "Start the SiteTracker with the optional directory setter. "
129
129
  inventory=Wmap::SiteTracker.instance
130
130
  inventory.data_dir = ARGV[1]
131
- inventory.sites_file = inventory.data_dir + "sites"
132
- inventory.load_site_stores_from_file
131
+ inventory.sites_file = inventory.data_dir + "/" + "sites"
132
+ inventory.load_site_stores_from_file(inventory.sites_file)
133
133
  else
134
134
  aborts "Error firing up SiteTracker instance!"
135
135
  end
@@ -150,8 +150,8 @@ elsif ARGV.length == 2
150
150
  host_tracker = Wmap::HostTracker.instance
151
151
  host_tracker.verbose=true
152
152
  host_tracker.data_dir = ARGV[1]
153
- host_tracker.hosts_file = host_tracker.data_dir + "hosts"
154
- host_tracker.load_known_hosts_from_file
153
+ host_tracker.hosts_file = host_tracker.data_dir + "/" + "hosts"
154
+ host_tracker.load_known_hosts_from_file(host_tracker.hosts_file)
155
155
  else
156
156
  aborts "Error firing up HostTracker instance!"
157
157
  end
@@ -124,9 +124,9 @@ class Wmap::SiteTracker
124
124
  raise "Invalid web site format. Please check your record again."
125
125
  else
126
126
  domain_tracker=Wmap::DomainTracker.instance
127
- domain_tracker.domains_file=@data_dir+'domains'
127
+ domain_tracker.domains_file=@data_dir + "/" + "domains"
128
128
  File.write(domain_tracker.domains_file, "") unless File.exist?(domain_tracker.domains_file)
129
- domain_tracker.load_domains_from_file
129
+ domain_tracker.load_domains_from_file(domain_tracker.domains_file)
130
130
  trusted=domain_tracker.domain_known?(root)
131
131
  domain_tracker=nil
132
132
  end
@@ -143,15 +143,17 @@ class Wmap::SiteTracker
143
143
  raise "Site is currently down. Skip #{site}" if checker['code']==10000
144
144
  end
145
145
  raise "Exception on add method - Fail to resolve the host-name: Host - #{host}, IP - #{ip}. Skip #{site}" unless is_ip?(ip)
146
- my_tracker = Wmap::HostTracker.instance
147
- my_tracker.data_dir=@data_dir
146
+ host_tracker = Wmap::HostTracker.instance
147
+ host_tracker.data_dir= @data_dir
148
+ host_tracker.hosts_file = host_tracker.data_dir + "/" + "hosts"
149
+ host_tracker.load_known_hosts_from_file(host_tracker.hosts_file)
148
150
  # Update the local host table when necessary
149
151
  if is_ip?(host)
150
152
  # Case #1: Trusted site contains IP
151
- if my_tracker.ip_known?(host)
153
+ if host_tracker.ip_known?(host)
152
154
  # Try local reverse DNS lookup first
153
155
  puts "Local hosts table lookup for IP: #{ip}" if @verbose
154
- host=my_tracker.local_ip_2_host(host)
156
+ host=host_tracker.local_ip_2_host(host)
155
157
  puts "Host found from the local hosts table for #{ip}: #{host}" if @verbose
156
158
  site.sub!(/\d+\.\d+\.\d+\.\d+/,host)
157
159
  else
@@ -160,17 +162,12 @@ class Wmap::SiteTracker
160
162
  host1=ip_2_host(host)
161
163
  puts "host1: #{host1}" if @verbose
162
164
  if is_fqdn?(host1)
163
- host_tracker=Wmap::HostTracker.instance
164
- host_tracker.data_dir=@data_dir
165
- host_tracker.hosts_file=host_tracker.data_dir + "hosts"
166
- host_tracker.load_known_hosts_from_file
167
165
  if host_tracker.domain_known?(host1)
168
166
  # replace IP with host-name only if domain root is known
169
167
  puts "Host found from the Internet reverse DNS lookup for #{ip}: #{host1}" if @verbose
170
168
  host=host1
171
169
  site.sub!(/\d+\.\d+\.\d+\.\d+/,host)
172
170
  end
173
- host_tracker=nil
174
171
  end
175
172
  end
176
173
  # Adding site for Case #1
@@ -187,17 +184,17 @@ class Wmap::SiteTracker
187
184
  # Add logic to update the hosts table for case #1 variance
188
185
  # - case that reverse DNS lookup successful
189
186
  puts "Update local hosts table for host: #{host}"
190
- if my_tracker.host_known?(host)
191
- old_ip=my_tracker.local_host_2_ip(host)
187
+ if host_tracker.host_known?(host)
188
+ old_ip=host_tracker.local_host_2_ip(host)
192
189
  if old_ip != ip
193
- my_tracker.refresh(host)
194
- my_tracker.save!
190
+ host_tracker.refresh(host)
191
+ host_tracker.save!
195
192
  else
196
193
  puts "Host resolve to the same IP #{ip} - no need to update the local host table." if @verbose
197
194
  end
198
195
  else
199
- my_tracker.add(host)
200
- my_tracker.save!
196
+ host_tracker.add(host)
197
+ host_tracker.save!
201
198
  end
202
199
  end
203
200
  else
@@ -212,27 +209,25 @@ class Wmap::SiteTracker
212
209
  puts "Site entry loaded: #{checker}"
213
210
  # Add logic to update the hosts table for case #2
214
211
  puts "Update local hosts table for host: #{host}"
215
- if my_tracker.host_known?(host)
216
- old_ip=my_tracker.local_host_2_ip(host)
212
+ if host_tracker.host_known?(host)
213
+ old_ip=host_tracker.local_host_2_ip(host)
217
214
  if old_ip != ip
218
- my_tracker.refresh(host)
219
- my_tracker.save!
215
+ host_tracker.refresh(host)
216
+ host_tracker.save!
220
217
  else
221
218
  # Skip - no need to update the local hosts table
222
219
  end
223
220
  else
224
- my_tracker.add(host)
225
- my_tracker.save!
221
+ host_tracker.add(host)
222
+ host_tracker.save!
226
223
  end
227
224
  end
228
225
  deact=nil
229
- my_tracker=nil
230
226
  host_tracker=nil
231
- return site
227
+ return checker
232
228
  else
233
229
  puts "Problem found: untrusted Internet domain or IP. Skip #{site}"
234
230
  deact=nil
235
- my_tracker=nil
236
231
  host_tracker=nil
237
232
  return nil
238
233
  end
@@ -556,15 +551,15 @@ class Wmap::SiteTracker
556
551
  #primary_host_tracker=Wmap::HostTracker::PrimaryHost.instance
557
552
  sites=Hash.new
558
553
  #uniqueness=Hash.new
559
- my_tracker=Wmap::HostTracker.instance
560
- my_tracker.hosts_file=@data_dir + 'hosts'
561
- my_tracker.load_known_hosts_from_file
554
+ host_tracker=Wmap::HostTracker.instance
555
+ host_tracker.hosts_file=@data_dir + 'hosts'
556
+ host_tracker.load_known_hosts_from_file
562
557
  @known_sites.keys.map do |key|
563
558
  port=url_2_port(key).to_s
564
559
  host=url_2_host(key)
565
560
  md5=@known_sites[key]['md5']
566
561
  code=@known_sites[key]['code']
567
- ip=my_tracker.local_host_2_ip(host)
562
+ ip=host_tracker.local_host_2_ip(host)
568
563
  ip=host_2_ip(host) if ip.nil?
569
564
  # filtering out 'un-reachable' sites
570
565
  next if (code == 10000 or code == 20000)
@@ -591,7 +586,7 @@ class Wmap::SiteTracker
591
586
  end
592
587
  end
593
588
  #primary_host_tracker=nil
594
- my_tracker=nil
589
+ host_tracker=nil
595
590
  return sites.values
596
591
  rescue Exception => ee
597
592
  puts "Exception on method #{__method__}: #{ee}" if @verbose
@@ -650,12 +645,12 @@ class Wmap::SiteTracker
650
645
  puts "Resolve sites that contain an IP address. Update the site cache table once a hostname is found in the local host table." if @verbose
651
646
  updates=Array.new
652
647
  sites=get_ip_sites
653
- my_tracker=Wmap::HostTracker.instance
654
- my_tracker.data_dir=@data_dir
648
+ host_tracker=Wmap::HostTracker.instance
649
+ host_tracker.data_dir=@data_dir
655
650
  sites.map do |site|
656
651
  puts "Work on resolve the IP site: #{site}" if @verbose
657
652
  ip=url_2_host(site)
658
- hostname=my_tracker.local_ip_2_host(ip)
653
+ hostname=host_tracker.local_ip_2_host(ip)
659
654
  if hostname.nil?
660
655
  puts "Can't resolve #{ip} from the local host store. Skip #{site}" if @verbose
661
656
  else
@@ -666,7 +661,7 @@ class Wmap::SiteTracker
666
661
  end
667
662
  updates.sort!
668
663
  puts "The following sites are now refreshed: #{updates}" if @verbose
669
- my_tracker=nil
664
+ host_tracker=nil
670
665
  return updates
671
666
  rescue Exception => ee
672
667
  puts "Exception on method #{__method__}: #{ee}" if @verbose
data/version.txt CHANGED
@@ -3,7 +3,7 @@
3
3
  ###############################################################################
4
4
  package = wmap
5
5
  # wmap version 2.0 == web_discovery version 1.5.3
6
- version = 2.5.9
6
+ version = 2.6.0
7
7
  date = 2019-09-22
8
8
 
9
9
  author = Sam (Yang) Li
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.9
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam (Yang) Li