lib/wmap/site_tracker.rb
# Save the current site store hash table into a file
Save the current site store hash table into a file
Save the current site store hash table into a file
def save_sites_to_file!(file_sites=@sites_file)
		puts "Saving the current site store table from memory to file: #{file_sites}"
		timestamp=Time.now
		f=File.open(file_sites, 'w')
		f.write "# Local site store created by class #{self.class} method #{__method__} at: #{timestamp}\n"
		f.write "# Website,Primary IP,Port,Hosting Status,Server,Response Code,MD5 Finger-print,Redirection,Timestamp\n"
		@known_sites.keys.sort.map do |key|
			if is_trusted?(key)
				f.write "#{key},#{@known_sites[key]['ip']},#{@known_sites[key]['port']},#{@known_sites[key]['status']},#{@known_sites[key]['server']},#{@known_sites[key]['code']},#{@known_sites[key]['md5']},#{@known_sites[key]['redirection']},#{@known_sites[key]['timestamp']}\n"
			end
		end
		f.close
		puts "site store table is successfully saved: #{file_sites}"
	rescue => ee
		puts "Exception on method #{__method__}: #{ee}"
	end
def save_sites_to_file! ( file_sites = @sites_file ) puts "Saving the current site store table from memory to file: #{file_sites}" timestamp = Time . now f = File . open ( file_sites , 'w' ) f . write "# Local site store created by class #{self.class} method #{__method__} at: #{timestamp}\n" f . write "# Website,Primary IP,Port,Hosting Status,Server,Response Code,MD5 Finger-print,Redirection,Timestamp\n" @known_sites . keys . sort . map do | key | if is_trusted? ( key ) f . write "#{key},#{@known_sites[key]['ip']},#{@known_sites[key]['port']},#{@known_sites[key]['status']},#{@known_sites[key]['server']},#{@known_sites[key]['code']},#{@known_sites[key]['md5']},#{@known_sites[key]['redirection']},#{@known_sites[key]['timestamp']}\n" end end f . close puts "site store table is successfully saved: #{file_sites}" rescue => ee puts "Exception on method #{__method__}: #{ee}" end
Save the current site store hash table into a file
Save the current site store hash table into a file
file_sites
<not_specific>