Sha256: 85f30571b2f68e3c115077c87ed80d6c77825f60fe3df277b8c4b863d9ef6fef

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby
# Executable to add seed entries into ring of the trust. I.E. the trusted domain or CIDR
require "wmap"
include Wmap::Utils
def print_usage
	puts "Program to add trust authority entries. Usage: trust [domain|CIDR list in a file]"
end

puts Wmap.banner
print_usage
Log_dir=File.dirname(__FILE__)+'/../logs/'
Wmap.wlog("Execute the command: trust #{ARGV[0]}","trust",Log_dir+"wmap.log")

dt=Wmap::DomainTracker.instance.new
ct=Wmap::CidrTracker.new(:verbose=>true)
abort "Incorrect program argument! Proper usage: trust [domain | netblock]" unless ARGV.length==1 && (File.exist?(ARGV[0]))

puts "Start the baptizing process ..."

file_2_list(ARGV[0]).map do |target|
	# Add entry into the local repository
	if dt.is_domain?(target)
		result=dt.add(target)
		unless result.nil?
			dt.save!
			puts "Domain #{target} is successfully baptized!"
		end
	elsif ct.is_cidr?(target)
		result=ct.add(target)
		unless result.nil?
			ct.save!
			puts "Net block #{target} is successfully baptized!"
		end
	end
end

dt=nil
ct=nil

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wmap-2.5.2 bin/trusts
wmap-2.5.1 bin/trusts
wmap-2.5.0 bin/trusts
wmap-2.4.9 bin/trusts
wmap-2.4.8 bin/trusts