wmap 2.7.1 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/trust +51 -14
- data/bin/trusts +59 -23
- data/version.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede228cdbc1b9ce2e12369c1d5c61fba8549f8c8dc67c35ee009020cfc32c014
|
4
|
+
data.tar.gz: 06ea77a19cbbc5b2bc72aea90fefaff6c336ee1b75a8eba765730e660751426f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22ce85d7d400650fb8427518c9ce79568db1143178dc60dcedbaa8683f5f4f58a461ebd4065fc078e3ff05e7cb80c7a016b08638dc793dc1150dfcce101de4fb
|
7
|
+
data.tar.gz: 3b51d6bda550f065a675409334b519be76521ab3014956b8f017e07d0be4fc33ab41d2b7ddb2e6dcc552fe9d36ce68cb8a887b0895b28470c7b553b18620a1e3
|
data/bin/trust
CHANGED
@@ -1,38 +1,75 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require "wmap"
|
3
|
-
|
3
|
+
require "optparse"
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
# program command line options
|
6
|
+
options = {:data_dir => nil, :target => nil, :verbose => false}
|
7
|
+
parser = OptionParser.new do|opts|
|
8
|
+
opts.banner = Wmap.banner
|
9
|
+
opts.on('-d', '--data_dir data_dir', 'Web Mapper local cache data directory') do |data_dir|
|
10
|
+
options[:data_dir] = data_dir;
|
11
|
+
end
|
12
|
+
opts.on('-t', '--target target', 'Web Mapper target') do |target|
|
13
|
+
options[:target] = target;
|
14
|
+
end
|
15
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
16
|
+
options[:verbose] = v;
|
17
|
+
end
|
18
|
+
opts.on('-h', '--help', 'Displays Help') do
|
19
|
+
puts opts
|
20
|
+
exit 0
|
21
|
+
end
|
7
22
|
end
|
23
|
+
parser.parse!
|
8
24
|
|
25
|
+
# print program banner
|
9
26
|
puts Wmap.banner
|
10
|
-
print_usage
|
11
|
-
|
12
|
-
|
27
|
+
# print_usage unless options[:target]
|
28
|
+
|
29
|
+
# Preparing - check out the working logs directory
|
30
|
+
if options[:data_dir]
|
31
|
+
# Log to the instance running directory
|
32
|
+
Log_dir = Pathname.new(options[:data_dir]).join('logs')
|
33
|
+
else
|
34
|
+
# Log the command entry
|
35
|
+
Log_dir=Pathname.new(Gem.loaded_specs['wmap'].full_gem_path).join('logs')
|
36
|
+
end
|
37
|
+
Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
|
38
|
+
Wmap.wlog("Execute the command: trust #{options[:target]}","trust",Log_dir+"wmap.log")
|
13
39
|
|
14
40
|
dt=Wmap::DomainTracker.instance
|
15
|
-
ct=Wmap::CidrTracker.new
|
16
|
-
|
41
|
+
ct=Wmap::CidrTracker.new
|
42
|
+
if options[:data_dir]
|
43
|
+
dt.verbose=options[:verbose]
|
44
|
+
dt.data_dir = options[:data_dir]
|
45
|
+
dt.domains_file = dt.data_dir + "/" + "domains"
|
46
|
+
dt.load_domains_from_file(dt.domains_file)
|
47
|
+
ct.verbose=options[:verbose]
|
48
|
+
ct.data_dir = options[:data_dir]
|
49
|
+
ct.cidr_seeds = ct.data_dir + "/" + "cidrs"
|
50
|
+
ct.load_cidr_blks_from_file(ct.cidr_seeds)
|
51
|
+
end
|
52
|
+
|
53
|
+
abort "Incorrect program argument! Proper usage: trust [domain | netblock]" unless (dt.is_fqdn?(options[:target]) || ct.is_cidr?(options[:target]))
|
17
54
|
|
18
55
|
puts "Start the baptizing process ..."
|
19
56
|
|
20
57
|
# Add entry into the local repository
|
21
58
|
|
22
|
-
if dt.is_domain?(
|
23
|
-
result=dt.add(
|
59
|
+
if dt.is_domain?(options[:target])
|
60
|
+
result=dt.add(options[:target])
|
24
61
|
unless result.nil?
|
25
62
|
dt.save!
|
26
|
-
abort "Domain #{
|
63
|
+
abort "Domain #{options[:target]} is successfully baptized!"
|
27
64
|
end
|
28
65
|
end
|
29
66
|
dt=nil
|
30
67
|
|
31
|
-
if ct.is_cidr?(
|
32
|
-
result=ct.add(
|
68
|
+
if ct.is_cidr?(options[:target])
|
69
|
+
result=ct.add(options[:target])
|
33
70
|
unless result.nil?
|
34
71
|
ct.save!
|
35
|
-
abort "Net block #{
|
72
|
+
abort "Net block #{options[:target]} is successfully baptized!"
|
36
73
|
end
|
37
74
|
end
|
38
75
|
ct=nil
|
data/bin/trusts
CHANGED
@@ -1,35 +1,71 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Executable to add seed entries into ring of the trust. I.E. the trusted domain or CIDR
|
3
3
|
require "wmap"
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require "optparse"
|
5
|
+
|
6
|
+
# program command line options
|
7
|
+
options = {:data_dir => nil, :target => nil, :verbose => false}
|
8
|
+
parser = OptionParser.new do|opts|
|
9
|
+
opts.banner = Wmap.banner
|
10
|
+
opts.on('-d', '--data_dir data_dir', 'Web Mapper local cache data directory') do |data_dir|
|
11
|
+
options[:data_dir] = data_dir;
|
12
|
+
end
|
13
|
+
opts.on('-t', '--target file', 'Web Mapper target file') do |target|
|
14
|
+
options[:target] = target;
|
15
|
+
end
|
16
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
17
|
+
options[:verbose] = v;
|
18
|
+
end
|
19
|
+
opts.on('-h', '--help', 'Displays Help') do
|
20
|
+
puts opts
|
21
|
+
exit 0
|
22
|
+
end
|
7
23
|
end
|
24
|
+
parser.parse!
|
8
25
|
|
26
|
+
# print program banner
|
9
27
|
puts Wmap.banner
|
10
|
-
print_usage
|
11
|
-
Log_dir=File.dirname(__FILE__)+'/../logs/'
|
12
|
-
Wmap.wlog("Execute the command: trust #{ARGV[0]}","trust",Log_dir+"wmap.log")
|
13
28
|
|
14
|
-
|
15
|
-
|
16
|
-
|
29
|
+
# Preparing - check out the working logs directory
|
30
|
+
if options[:data_dir]
|
31
|
+
# Log to the instance running directory
|
32
|
+
Log_dir = Pathname.new(options[:data_dir]).join('logs')
|
33
|
+
else
|
34
|
+
# Log the command entry
|
35
|
+
Log_dir=Pathname.new(Gem.loaded_specs['wmap'].full_gem_path).join('logs')
|
36
|
+
end
|
37
|
+
Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
|
38
|
+
Wmap.wlog("Execute the command: trust #{options[:target]}","trust",Log_dir+"wmap.log")
|
17
39
|
|
18
|
-
|
40
|
+
dt=Wmap::DomainTracker.instance
|
41
|
+
ct=Wmap::CidrTracker.new
|
42
|
+
if options[:data_dir]
|
43
|
+
dt.verbose=options[:verbose]
|
44
|
+
dt.data_dir = options[:data_dir]
|
45
|
+
dt.domains_file = dt.data_dir + "/" + "domains"
|
46
|
+
dt.load_domains_from_file(dt.domains_file)
|
47
|
+
ct.verbose=options[:verbose]
|
48
|
+
ct.data_dir = options[:data_dir]
|
49
|
+
ct.cidr_seeds = ct.data_dir + "/" + "cidrs"
|
50
|
+
ct.load_cidr_blks_from_file(ct.cidr_seeds)
|
51
|
+
end
|
19
52
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
dt.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
ct.
|
32
|
-
|
53
|
+
if options[:target]
|
54
|
+
puts "Start the baptizing process ..."
|
55
|
+
dt.file_2_list(options[:target]).map do |target|
|
56
|
+
# Add entry into the local repository
|
57
|
+
if dt.is_domain?(target)
|
58
|
+
result=dt.add(target)
|
59
|
+
unless result.nil?
|
60
|
+
dt.save!
|
61
|
+
puts "Domain #{target} is successfully baptized!"
|
62
|
+
end
|
63
|
+
elsif ct.is_cidr?(target)
|
64
|
+
result=ct.add(target)
|
65
|
+
unless result.nil?
|
66
|
+
ct.save!
|
67
|
+
puts "Net block #{target} is successfully baptized!"
|
68
|
+
end
|
33
69
|
end
|
34
70
|
end
|
35
71
|
end
|
data/version.txt
CHANGED