lib/wmap/site_tracker/wp_tracker.rb
# 'setter' to load the known wordpress sites into an instance variable
'setter' to load the known wordpress sites into an instance variable
' setter ' to load the known wordpress sites into an instance variable
def load_from_file (file=@sites_wp, lc=true)
		puts "Loading trusted file: #{file}"	if @verbose
		@known_wp_sites=Hash.new
		f_wp_sites=File.open(file, 'r')
		f_wp_sites.each_line do |line|
			puts "Processing line: #{line}" if @verbose
			line=line.chomp.strip
			next if line.nil?
			next if line.empty?
			next if line =~ /^\s*#/
			line=line.downcase if lc==true
			entry=line.split(',')
			site = entry[0].strip()
			next if site.nil?
			if @known_wp_sites.key?(site)
				next
			else
				@known_wp_sites[site] = Hash.new
				@known_wp_sites[site]['site'] = site
				@known_wp_sites[site]['version'] = entry[1].strip()
				@known_wp_sites[site]['redirection'] = entry[2].strip()
			end
		end
		f_wp_sites.close
		return @known_wp_sites
	rescue => ee
		puts "Exception on method #{__method__}: #{ee}" if @verbose
		return Hash.new
	end
def load_from_file ( file = @sites_wp , lc = true ) puts "Loading trusted file: #{file}" if @verbose @known_wp_sites = Hash . new f_wp_sites = File . open ( file , 'r' ) f_wp_sites . each_line do | line | puts "Processing line: #{line}" if @verbose line = line . chomp . strip next if line . nil? next if line . empty? next if line =~ / ^ \s *# / line = line . downcase if lc == true entry = line . split ( ',' ) site = entry [ 0 ] . strip ( ) next if site . nil? if @known_wp_sites . key? ( site ) next else @known_wp_sites [ site ] = Hash . new @known_wp_sites [ site ] [ 'site' ] = site @known_wp_sites [ site ] [ 'version' ] = entry [ 1 ] . strip ( ) @known_wp_sites [ site ] [ 'redirection' ] = entry [ 2 ] . strip ( ) end end f_wp_sites . close return @known_wp_sites rescue => ee puts "Exception on method #{__method__}: #{ee}" if @verbose return Hash . new end
'setter' to load the known wordpress sites into an instance variable
' setter ' to load the known wordpress sites into an instance variable
file
<not_specific>
lc
<not_specific>