lib/wmap/domain_tracker/sub_domain.rb in wmap-2.4.6 vs lib/wmap/domain_tracker/sub_domain.rb in wmap-2.4.8
- old
+ new
@@ -3,21 +3,21 @@
#
# A pure Ruby library for Internet web application discovery and tracking.
#
# Copyright (c) 2012-2015 Yang Li <yang.li@owasp.org>
#++
-#require "singleton"
+require "singleton"
module Wmap
class DomainTracker
# Class to differentiate the sub-domain from the top domain for the enterprise. This is needed for better managing
# of the sub-domains and the associated entities
class SubDomain < Wmap::DomainTracker
include Wmap::Utils
- #include Singleton
+ include Singleton
attr_accessor :verbose, :domains_file, :max_parallel, :data_dir
attr_reader :known_internet_sub_domains
# Set default instance variables
@@ -88,10 +88,13 @@
# Procedures to identify sub-domain from the hosts store
def update_from_host_store!
puts "Invoke internal procedures to update the sub-domain list from the host store."
begin
# Step 1 - obtain the latest sub-domains
- subs = Wmap::HostTracker.new(:data_dir=>@data_dir).dump_sub_domains - [nil,""]
+ my_tracker = Wmap::HostTracker.instance
+ my_tracker.data_dir=@data_dir
+ subs = my_tracker.dump_sub_domains - [nil,""]
+ my_tracker = nil
# Step 2 - update the sub-domain list
unless subs.empty?
#subs.map { |x| self.add(x) unless domain_known?(x) }
self.bulk_add(subs,@max_parallel)
end