wmap 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +141 -0
  3. data/LICENSE.txt +15 -0
  4. data/README.rdoc +98 -0
  5. data/TODO +13 -0
  6. data/bin/deprime +21 -0
  7. data/bin/distrust +38 -0
  8. data/bin/googleBot +23 -0
  9. data/bin/prime +21 -0
  10. data/bin/refresh +26 -0
  11. data/bin/run_tests +16 -0
  12. data/bin/spiderBot +26 -0
  13. data/bin/trust +38 -0
  14. data/bin/updateAll +57 -0
  15. data/bin/wadd +25 -0
  16. data/bin/wadds +26 -0
  17. data/bin/wcheck +28 -0
  18. data/bin/wdel +25 -0
  19. data/bin/wdump +21 -0
  20. data/bin/wmap +151 -0
  21. data/bin/wscan +32 -0
  22. data/data/cidrs +2 -0
  23. data/data/deactivated_sites +1 -0
  24. data/data/domains +2 -0
  25. data/data/hosts +1 -0
  26. data/data/prime_hosts +1 -0
  27. data/data/sites +2 -0
  28. data/data/sub_domains +2 -0
  29. data/demos/bruter.rb +27 -0
  30. data/demos/dns_brutes.rb +28 -0
  31. data/demos/filter_cidr.rb +18 -0
  32. data/demos/filter_crawls.rb +5 -0
  33. data/demos/filter_domain.rb +25 -0
  34. data/demos/filter_geoip.rb +26 -0
  35. data/demos/filter_known_services.rb +59 -0
  36. data/demos/filter_netinfo.rb +23 -0
  37. data/demos/filter_prime.rb +25 -0
  38. data/demos/filter_profiler.rb +3 -0
  39. data/demos/filter_redirection.rb +19 -0
  40. data/demos/filter_site.rb +40 -0
  41. data/demos/filter_siteip.rb +31 -0
  42. data/demos/filter_status.rb +17 -0
  43. data/demos/filter_timestamp.rb +23 -0
  44. data/demos/filter_url.rb +19 -0
  45. data/demos/new_fnd.rb +66 -0
  46. data/demos/nmap_parser.pl +138 -0
  47. data/demos/site_format.rb +18 -0
  48. data/demos/whois_domain.rb +78 -0
  49. data/dicts/GeoIP.dat +0 -0
  50. data/dicts/GeoIPASNum.dat +0 -0
  51. data/dicts/GeoLiteCity.dat +0 -0
  52. data/dicts/ccsld.txt +2646 -0
  53. data/dicts/cctld.txt +243 -0
  54. data/dicts/gtld.txt +25 -0
  55. data/dicts/hostnames-dict.big +1402 -0
  56. data/dicts/hostnames-dict.txt +101 -0
  57. data/lib/wmap/cidr_tracker.rb +327 -0
  58. data/lib/wmap/dns_bruter.rb +308 -0
  59. data/lib/wmap/domain_tracker/sub_domain.rb +142 -0
  60. data/lib/wmap/domain_tracker.rb +342 -0
  61. data/lib/wmap/geoip_tracker.rb +72 -0
  62. data/lib/wmap/google_search_scraper.rb +177 -0
  63. data/lib/wmap/host_tracker/primary_host.rb +130 -0
  64. data/lib/wmap/host_tracker.rb +550 -0
  65. data/lib/wmap/network_profiler.rb +144 -0
  66. data/lib/wmap/port_scanner.rb +208 -0
  67. data/lib/wmap/site_tracker/deactivated_site.rb +85 -0
  68. data/lib/wmap/site_tracker.rb +937 -0
  69. data/lib/wmap/url_checker.rb +314 -0
  70. data/lib/wmap/url_crawler.rb +381 -0
  71. data/lib/wmap/utils/domain_root.rb +184 -0
  72. data/lib/wmap/utils/logger.rb +53 -0
  73. data/lib/wmap/utils/url_magic.rb +343 -0
  74. data/lib/wmap/utils/utils.rb +333 -0
  75. data/lib/wmap/whois.rb +76 -0
  76. data/lib/wmap.rb +227 -0
  77. data/logs/wmap.log +17 -0
  78. data/ruby_whois_patches/base_cocca2.rb +149 -0
  79. data/ruby_whois_patches/kero.yachay.pe.rb +120 -0
  80. data/ruby_whois_patches/whois.PublicDomainRegistry.com.rb +124 -0
  81. data/ruby_whois_patches/whois.above.com.rb +61 -0
  82. data/ruby_whois_patches/whois.adamsnames.tc.rb +107 -0
  83. data/ruby_whois_patches/whois.aeda.net.ae.rb +105 -0
  84. data/ruby_whois_patches/whois.ai.rb +112 -0
  85. data/ruby_whois_patches/whois.arnes.si.rb +121 -0
  86. data/ruby_whois_patches/whois.ascio.com.rb +91 -0
  87. data/ruby_whois_patches/whois.cnnic.cn.rb +123 -0
  88. data/ruby_whois_patches/whois.corporatedomains.com.rb +67 -0
  89. data/ruby_whois_patches/whois.crsnic.net.rb +108 -0
  90. data/ruby_whois_patches/whois.denic.de.rb +174 -0
  91. data/ruby_whois_patches/whois.dk-hostmaster.dk.rb +120 -0
  92. data/ruby_whois_patches/whois.dns.be.rb +134 -0
  93. data/ruby_whois_patches/whois.dns.lu.rb +129 -0
  94. data/ruby_whois_patches/whois.dns.pl.rb +150 -0
  95. data/ruby_whois_patches/whois.dns.pt.rb +119 -0
  96. data/ruby_whois_patches/whois.domain.kg.rb +126 -0
  97. data/ruby_whois_patches/whois.domainregistry.my.rb +123 -0
  98. data/ruby_whois_patches/whois.domreg.lt.rb +110 -0
  99. data/ruby_whois_patches/whois.dot.tk.rb +140 -0
  100. data/ruby_whois_patches/whois.hkirc.hk.rb +121 -0
  101. data/ruby_whois_patches/whois.isnic.is.rb +130 -0
  102. data/ruby_whois_patches/whois.je.rb +119 -0
  103. data/ruby_whois_patches/whois.jprs.jp.rb +137 -0
  104. data/ruby_whois_patches/whois.kenic.or.ke.rb +140 -0
  105. data/ruby_whois_patches/whois.markmonitor.com.rb +118 -0
  106. data/ruby_whois_patches/whois.melbourneit.com.rb +58 -0
  107. data/ruby_whois_patches/whois.nic.as.rb +96 -0
  108. data/ruby_whois_patches/whois.nic.at.rb +109 -0
  109. data/ruby_whois_patches/whois.nic.ch.rb +141 -0
  110. data/ruby_whois_patches/whois.nic.cl.rb +117 -0
  111. data/ruby_whois_patches/whois.nic.ec.rb +157 -0
  112. data/ruby_whois_patches/whois.nic.im.rb +120 -0
  113. data/ruby_whois_patches/whois.nic.it.rb +170 -0
  114. data/ruby_whois_patches/whois.nic.lv.rb +116 -0
  115. data/ruby_whois_patches/whois.nic.ly.rb +127 -0
  116. data/ruby_whois_patches/whois.nic.mu.rb +27 -0
  117. data/ruby_whois_patches/whois.nic.mx.rb +123 -0
  118. data/ruby_whois_patches/whois.nic.net.sa.rb +111 -0
  119. data/ruby_whois_patches/whois.nic.or.kr.rb +101 -0
  120. data/ruby_whois_patches/whois.nic.tel.rb +129 -0
  121. data/ruby_whois_patches/whois.nic.tr.rb +133 -0
  122. data/ruby_whois_patches/whois.nic.us.rb +129 -0
  123. data/ruby_whois_patches/whois.nic.ve.rb +135 -0
  124. data/ruby_whois_patches/whois.norid.no.rb +127 -0
  125. data/ruby_whois_patches/whois.pandi.or.id.rb +118 -0
  126. data/ruby_whois_patches/whois.psi-usa.info.rb +63 -0
  127. data/ruby_whois_patches/whois.registro.br.rb +109 -0
  128. data/ruby_whois_patches/whois.registrygate.com.rb +55 -0
  129. data/ruby_whois_patches/whois.rrpproxy.net.rb +61 -0
  130. data/ruby_whois_patches/whois.sgnic.sg.rb +130 -0
  131. data/ruby_whois_patches/whois.srs.net.nz.rb +166 -0
  132. data/ruby_whois_patches/whois.tucows.com.rb +70 -0
  133. data/ruby_whois_patches/whois.twnic.net.tw.rb +133 -0
  134. data/settings/discovery_ports +24 -0
  135. data/settings/google_keywords.txt +9 -0
  136. data/settings/google_locator.txt +23 -0
  137. data/test/domain_tracker_test.rb +31 -0
  138. data/test/utils_test.rb +168 -0
  139. data/version.txt +13 -0
  140. data/wmap.gemspec +49 -0
  141. metadata +202 -0
@@ -0,0 +1,144 @@
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
+ require "net/ping"
9
+
10
+
11
+ # Network profiler to optimize the port scanner performance for a specific network / IP. The ultimate goal is to set a reasonable socket time-out parameter for the scanners.
12
+ class Wmap::NetworkProfiler
13
+ include Wmap::Utils
14
+
15
+ attr_accessor :socket_timeout, :search_path, :max_parallel, :verbose
16
+ attr_reader :latency # Discovered network latency
17
+ File_discovery_ports=File.dirname(__FILE__)+'/../../settings/discovery_ports'
18
+
19
+ # Set default instance variables
20
+ def initialize (params = {})
21
+ @verbose=params.fetch(:verbose, false)
22
+ @socket_timeout=params.fetch(:socket_timeout, 1500)
23
+ #@http_timeout=params.fetch(:http_timeout, 3000)
24
+ @search_path=["/sbin/","/usr/sbin/","/usr/local/bin/","/usr/bin/","/opt/bin/","/opt/sbin/"]
25
+ # Initialize the instance variables
26
+ @discovery_tcp_ports=params.fetch(:discovery_tcp_ports, file_2_list(File_discovery_ports).map!{|x| x.to_i} )
27
+ end
28
+
29
+ # Main worker method that determine the right profiling methods
30
+ def profile(host)
31
+ puts "Perform web service discovery on host: #{host}" if @verbose
32
+ @latency = @socket_timeout
33
+ begin
34
+ if Process.euid == 0 && socket_icmp_pingable?(host)
35
+ puts "Network profiling by using raw socket ..." if @verbose
36
+ elsif shell_ping_exist? && shell_pingable?(host)
37
+ puts "Network profiling by using external shell ping program ..." if @verbose
38
+ elsif open_tcp_port?(host)
39
+ puts "Network profiling by using TCP ping ..." if @verbose
40
+ else
41
+ puts "No appropriate profiling method for #{host}" if @verbose
42
+ # Do nothing
43
+ end
44
+ puts "Found network latency for #{host}: #{@latency} ms" if @verbose
45
+ return @latency
46
+ rescue Exception => ee
47
+ puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose
48
+ return nil
49
+ end
50
+ end
51
+
52
+ # Perform raw socket ICMP echo detection on the host. Note that socket ICMP packet manipulation
53
+ # need the root privilege access(for example, ICMP 'echo' need to snoop on the interface to detect any replies such as 'ECONNREFUSED').
54
+ # That's why we also use external ping program for the normal users in case they do not has the access.
55
+ def socket_icmp_pingable? (target)
56
+ puts "Perform socket ICMP ping on the target: #{target}" if @verbose
57
+ begin
58
+ timeo = @socket_timeout/1000.0 # change time-out unit from sec to ms
59
+ p=Net::Ping::ICMP.new(target,nil,timeo)
60
+ if p.ping
61
+ @latency=p.duration * 1000
62
+ puts "Socket ICMP echo test successful on #{target}." if @verbose
63
+ return true
64
+ else
65
+ puts "Socket ICMP echo test fail on #{target}." if @verbose
66
+ return false
67
+ end
68
+ rescue Exception => ee
69
+ puts "Error on method #{__method__} on target #{target}: #{ee}" if @verbose
70
+ return false
71
+ end
72
+ end
73
+
74
+ # Wrapper for local ping executable. This is needed if the process do not have the root privilege to operate
75
+ # on the raw ICMP socket
76
+ def shell_pingable? (target)
77
+ puts "Perform ping test from the shell on: #{target}" if @verbose
78
+ begin
79
+ sum=0
80
+ test_ping= `#{@which_ping} -c 3 #{target}`
81
+ test_ping.scan(/^(.+?)\stime=(.+)\s(.+?)\n/).map do |entry|
82
+ puts "entry: #{entry}" if @verbose
83
+ sum=sum+entry[1].to_f
84
+ end
85
+ if sum > 0
86
+ @latency = sum / 3
87
+ puts "Ping test from the shell environment successful on #{target}." if @verbose
88
+ return true
89
+ else
90
+ puts "Ping test from the shell environment fail on #{target}." if @verbose
91
+ return false
92
+ end
93
+ rescue Exception => ee
94
+ puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose
95
+ return false
96
+ end
97
+ end
98
+
99
+ # Search for local ping executable program. This is helpful for the normal users who has no direct access to generate socket ICMP packets.
100
+ def shell_ping_exist?
101
+ begin
102
+ puts "Search local shell environment for the ping program ..." if @verbose
103
+ @search_path.map do |path|
104
+ ping_exe=path+"ping"
105
+ if File.exist?(ping_exe) && File.executable?(ping_exe)
106
+ @which_ping=ping_exe
107
+ puts "Local ping program found: #{ping_exe}" if @verbose
108
+ return true
109
+ end
110
+ end
111
+ return false
112
+ rescue Exception => ee
113
+ puts "Exception on method #{__method__}: #{ee}" if @verbose
114
+ return false
115
+ end
116
+ end
117
+
118
+ # Perform TCP Ping as a last resort of the network profiling effort, in case of ICMP tests fail.
119
+ def open_tcp_port? (target)
120
+ puts "Check if any TCP port in the list #{@discovery_tcp_ports} is open on the remote host: #{target}" if @verbose
121
+ begin
122
+ timeo = @socket_timeout/1000.0 # change time-out unit from sec to ms
123
+ p=Net::Ping::TCP.new(target,nil,timeo)
124
+ @discovery_tcp_ports.map do |port|
125
+ p.port=port
126
+ if p.ping
127
+ @which_port=port
128
+ # Bug in the current Net::Ping.ping module, where the 'duration' is 100 order off. We make it up here without fixing their code
129
+ @latency = p.duration * 1000 * 100
130
+ puts "TCP port detection successful on port: #{@which_port}" if @verbose
131
+ return true
132
+ end
133
+ end
134
+ puts "TCP port detection on remote host #{target} fail. " if @verbose
135
+ return false
136
+ rescue Exception => ee
137
+ puts "Error on method #{__method__} on target #{target}: #{ee}" if @verbose
138
+ return false
139
+ end
140
+ end
141
+
142
+ private
143
+
144
+ end
@@ -0,0 +1,208 @@
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
+ require "net/ping"
9
+ require "parallel"
10
+
11
+ # Port scanner class for the web application discovery and tracking
12
+ class Wmap::PortScanner
13
+ include Wmap::Utils
14
+
15
+ attr_accessor :socket_timeout, :http_timeout, :discovery_tcp_ports, :max_parallel, :verbose
16
+ attr_reader :discovered_urls
17
+
18
+ # Use default common web service port list for the discovery
19
+ File_discovery_ports=File.dirname(__FILE__)+'/../../settings/discovery_ports'
20
+ # set hard limit of socket time-out to 3 seconds to avoid performance penalty
21
+ Max_socket_timeout=3000
22
+
23
+ # Set default instance variables
24
+ def initialize (params = {})
25
+ @verbose=params.fetch(:verbose, false)
26
+ @socket_timeout=params.fetch(:socket_timeout, 1500)
27
+ @http_timeout=params.fetch(:http_timeout, 5000)
28
+ @max_parallel=params.fetch(:max_parallel, 40)
29
+ # Initialize the instance variables
30
+ @discovery_tcp_ports=params.fetch(:discovery_tcp_ports, file_2_list(File_discovery_ports).map!{|x| x.to_i} )
31
+ @discovered_urls=Hash.new
32
+ end
33
+
34
+ # Pre-scan worker, to be used for network profiling to maximum the scan performance, for instance.
35
+ def pre_scan(host)
36
+ puts "Perform pre-scan works on host: #{host}" if @verbose
37
+ begin
38
+ # Use the following formula to 'guess' the right network time-out threshold for the scanner
39
+ nwk_to=Wmap::NetworkProfiler.new.profile(host)
40
+ if (100 + nwk_to*2).to_i > Max_socket_timeout
41
+ @socket_timeout=Max_socket_timeout
42
+ else
43
+ @socket_timeout=(100 + nwk_to*2).to_i
44
+ end
45
+ puts "Done with the pre-scan works: reset @socket_timeout to: #{@socket_timeout}" if @verbose
46
+ rescue Exception => ee
47
+ puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose
48
+ return nil
49
+ end
50
+ end
51
+
52
+ # Main worker method that run through the discovery ports list, check if any response to the HTTP request on the open ports, and finally return the findings in the URL format as an array
53
+ def scan (host)
54
+ puts "Perform web service discovery on host: #{host}"
55
+ begin
56
+ pre_scan(host)
57
+ urls=Array.new
58
+ @discovery_tcp_ports.map do |port|
59
+ if tcp_port_open?(host,port)
60
+ url=host_2_url(host,port)
61
+ urls.push(url) unless url.nil?
62
+ end
63
+ end
64
+ if urls.empty?
65
+ puts "No web service detected. "
66
+ else
67
+ urls.map do |url|
68
+ unless @discovered_urls.key?(url)
69
+ @discovered_urls[url]=true
70
+ end
71
+ end
72
+ puts "Detected web service on host #{host}: #{urls}"
73
+ end
74
+ return urls
75
+ rescue Exception => ee
76
+ puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose
77
+ return nil
78
+ end
79
+ end
80
+ alias_method :query, :scan
81
+
82
+ # Parallel scanner - by utilizing fork manager 'parallel' to spawn numbers of child processes on multiple hosts/IPs simultaneously
83
+ def scans (targets,num=@max_parallel)
84
+ begin
85
+ urls=Array.new
86
+ # 10/5/2013 add additional logic to eliminate invalid /duplicate target(s)
87
+ targets -= ["", nil]
88
+ uniq_hosts=Hash.new
89
+ targets.dup.map do |target|
90
+ if is_fqdn?(target) or is_ip?(target)
91
+ ip=host_2_ip(target).to_s
92
+ if uniq_hosts.key?(ip)
93
+ targets.delete(target)
94
+ else
95
+ uniq_hosts[ip]=true
96
+ end
97
+ end
98
+ end
99
+ if targets.size > 0
100
+ puts "Start the parallel port scan on the target list:\n #{targets}"
101
+ Parallel.map(targets.shuffle, :in_processes => num) { |target|
102
+ scan(target)
103
+ }.each do |process|
104
+ if process.nil?
105
+ next
106
+ elsif process.empty?
107
+ #do nothing
108
+ else
109
+ process.map do |url|
110
+ unless @discovered_urls.key?(url)
111
+ @discovered_urls[url]=true
112
+ end
113
+ end
114
+ urls+=process
115
+ end
116
+ end
117
+ end
118
+ puts "Port scanning done successfully with the found web services: #{urls}"
119
+ return urls
120
+ rescue Exception => ee
121
+ puts "Exception on method #{__method__}: #{ee}" if @verbose
122
+ return nil
123
+ end
124
+ end
125
+
126
+ # Parallel scans on a list of CIDRs from the input file, return the findings as the website construct within an array
127
+ def scan_file(file,num=@max_parallel)
128
+ puts "Start the parallel scans on the target file: #{file}"
129
+ begin
130
+ list=load_target_file(file)
131
+ urls=scans(list,num)
132
+ rescue Exception => ee
133
+ puts "Error on method #{__method__}: #{ee}" if @verbose
134
+ return nil
135
+ end
136
+ return urls
137
+ end
138
+ alias_method :file_scan, :scan_file
139
+
140
+ # Prepare and load the target list from a target file
141
+ def load_target_file (file)
142
+ puts "Preparing the discovery target file: #{file}" if @verbose
143
+ begin
144
+ targets=Array.new
145
+ f=File.open(file,'r')
146
+ f.each do |line|
147
+ line=line.chomp.strip
148
+ next if line.nil?
149
+ next if line.empty?
150
+ next if line =~ /^\s*#/
151
+ line=line.split(',')[0]
152
+ if is_cidr?(line)
153
+ ips=cidr_2_ips(line)
154
+ targets+=ips
155
+ elsif is_ip?(line) or is_fqdn?(line)
156
+ targets.push(line)
157
+ elsif is_url?(line)
158
+ host=url_2_host(line)
159
+ targets.push(host)
160
+ else
161
+ puts "Unknown entry in the seed file: #{line}"
162
+ end
163
+ end
164
+ f.close
165
+ return targets
166
+ rescue Exception => ee
167
+ puts "Error on method #{__method__} on file #{file} exception: #{ee}" if @verbose
168
+ return nil
169
+ end
170
+ end
171
+ alias_method :load, :load_target_file
172
+
173
+ # A simple TCP port scanner. This is the basic element of the port scanner. Notice the default time-out is set by the default instance variable @socket_timeout
174
+ def tcp_port_open? (host,port)
175
+ puts "Perform open port detection on: #{host}:#{port}, time-out: #{@socket_timeout} ms" if @verbose
176
+ #@socket_timeout = socket_timeout
177
+ timeo = @socket_timeout/1000.0 # change time-out unit from sec to ms
178
+ begin
179
+ if Net::Ping::TCP.new(host,port,timeo).ping
180
+ puts "Port open!" if @verbose
181
+ return true
182
+ else
183
+ puts "Port down." if @verbose
184
+ return false
185
+ end
186
+ rescue Exception => ee
187
+ puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose
188
+ return false
189
+ end
190
+ end
191
+
192
+ # Print out the summary report of discovered sites
193
+ def print_discovered_urls
194
+ puts "Print out port discovery results." if @verbose
195
+ puts "Summary of Discovered Sites:"
196
+ @discovered_urls.keys.sort.map { |x| puts x }
197
+ puts "End of Summary."
198
+ end
199
+ alias_method :print, :print_discovered_urls
200
+
201
+ # Count number of new found sites
202
+ def count
203
+ return @discovered_urls.size
204
+ end
205
+
206
+ private :load_target_file
207
+
208
+ end
@@ -0,0 +1,85 @@
1
+ #--
2
+ # Wmap
3
+ #
4
+ # A pure Ruby library for Internet web application discovery and tracking.
5
+ #
6
+ # Copyright (c) 2012-2015 Yang Li <yang.li@owasp.org>
7
+ #++
8
+ #require "singleton"
9
+
10
+
11
+ # Class to trace de-activated site. This is need for basic state tracking for our sites.
12
+
13
+ module Wmap
14
+ class SiteTracker
15
+
16
+ class DeactivatedSite < Wmap::SiteTracker
17
+ include Wmap::Utils
18
+ #include Singleton
19
+
20
+ attr_accessor :sites_file, :known_sites, :verbose, :data_dir
21
+
22
+ # Set default instance variables
23
+ def initialize (params = {})
24
+ # Initialize the instance variables
25
+ @data_dir=params.fetch(:data_dir, File.dirname(__FILE__)+'/../../../data/')
26
+ @f_sites=@data_dir + 'deactivated_sites'
27
+ @file_stores=params.fetch(:sites_file, @f_sites)
28
+ @verbose=params.fetch(:verbose, false)
29
+ # Hash table to hold the site store
30
+ File.write(@file_stores, "") unless File.exist?(@file_stores)
31
+ @known_sites=load_site_stores_from_file(@file_stores)
32
+ end
33
+
34
+ # Deactivate obsolete entrance from the live site store. Note this method is used by the parent class only
35
+ def add (site,entry)
36
+ begin
37
+ puts "Deactivate site: #{site}" if @verbose
38
+ @known_sites[site]=Hash.new unless @known_sites.key?(site)
39
+ @known_sites[site]['ip']=entry['ip']
40
+ @known_sites[site]['port']=entry['port']
41
+ @known_sites[site]['status']=entry['status']
42
+ @known_sites[site]['server']=entry['server']
43
+ @known_sites[site]['md5']=entry['md5']
44
+ @known_sites[site]['redirection']=entry['redirection']
45
+ @known_sites[site]['timestamp']=entry['timestamp']
46
+ @known_sites[site]['code']=entry['code']
47
+ puts "Deactivate site entry loaded: #{entry}"
48
+ rescue Exception => ee
49
+ puts "Exception on method #{__method__}: #{ee}" if @verbose
50
+ return nil
51
+ end
52
+
53
+ end
54
+
55
+ # Refresh re-activated entrance in the store. Note this method is used by the parent class only
56
+ def delete (site)
57
+ begin
58
+ puts "Reactivate site: #{site}" if @verbose
59
+ site=site.strip.downcase unless site.nil?
60
+ @known_sites.delete(site)
61
+ puts "Site removed from the de-activated list."
62
+ rescue Exception => ee
63
+ puts "Exception on method #{__method__}: #{ee}" if @verbose
64
+ return nil
65
+ end
66
+
67
+ end
68
+
69
+ # Procedures to discover deactivated sites from the live site store to here in one shot (TBD).
70
+ def update_from_site_store!
71
+ puts "Invoke internal procedures to update the site store."
72
+ begin
73
+ # To be further developed
74
+ rescue Exception => ee
75
+ puts "Exception on method #{__method__}: #{ee}" if @verbose
76
+ return nil
77
+ end
78
+ end
79
+ alias_method :update!, :update_from_site_store!
80
+
81
+
82
+ end
83
+
84
+ end
85
+ end