Sha256: 08eae94bed8fb33200d8abd7cb91c0c42c68e99b499e024f958fab109d09fbec

Contents?: true

Size: 968 Bytes

Versions: 2

Compression:

Stored size: 968 Bytes

Contents

#!/usr/bin/env ruby
require "wmap"
# Executable to add seed entry into ring of the trust. I.E. the trusted domain or CIDR

def print_usage
	puts "Program to add trust authority entry. Usage: trust [domain|CIDR]"
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.new
ct=Wmap::CidrTracker.new(:verbose=>true)
abort "Incorrect program argument! Proper usage: trust [domain | netblock]" unless ARGV.length==1 && (dt.is_fqdn?(ARGV[0]) || ct.is_cidr?(ARGV[0]))

puts "Start the baptizing process ..."

# Add entry into the local repository

if dt.is_domain?(ARGV[0])
	result=dt.add(ARGV[0])
	unless result.nil?
		dt.save!
		abort "Domain #{ARGV[0]} is successfully baptized!"
	end
end
dt=nil

if ct.is_cidr?(ARGV[0])
	result=ct.add(ARGV[0])
	unless result.nil?
		ct.save!
		abort "Net block #{ARGV[0]} is successfully baptized!"
	end
end
ct=nil

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wmap-2.4.6 bin/trust
wmap-2.4.5 bin/trust