dronebl.rb 0.0.1 → 0.0.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/dronebl-add +9 -9
- data/bin/dronebl-query +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f37b2955dc619fdf8bd836a76147e8b32a52de9
|
4
|
+
data.tar.gz: 5c467fa4f41e38f587261fdeb2f89811cfe052d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9657a44c6692e019e5c2a34e7f2cbb3475a0ea2c6e723f08cfbbe364dd2142e97e6e708660664cf73e8a540b2bf81d94cb2df055c81550fc63e6f3ad6d05d182
|
7
|
+
data.tar.gz: 7bf45c7052d0051524e198532b951f33563fa5fb76bf740fd0e3c8ae3848d8347a989718a77ac6078cfb0362e24919b66f5c5a9fb6b33c5259bd7061c9dd631f
|
data/bin/dronebl-add
CHANGED
@@ -24,7 +24,7 @@ class Options
|
|
24
24
|
opts.on('-k', '--key KEY', String, 'Use KEY as your DroneBL RPC2 key') do |key|
|
25
25
|
@key_str = key
|
26
26
|
end
|
27
|
-
opts.on('-f', '--keyfile
|
27
|
+
opts.on('-f', '--keyfile FILE_PATH', 'Read the file at FILE_PATH and use it as the RPC key') do |path|
|
28
28
|
@use_key_file = true
|
29
29
|
@key_file = path
|
30
30
|
end
|
@@ -35,7 +35,7 @@ class Options
|
|
35
35
|
puts DroneBL::TYPES.map { |k, v| "#{k} : #{v}"}.join("\n")
|
36
36
|
exit
|
37
37
|
end
|
38
|
-
opts.on('-c', '--comment
|
38
|
+
opts.on('-c', '--comment COMMENT', String, 'Attach the given comment to the listings.') do |comment|
|
39
39
|
@comment = comment
|
40
40
|
opts.on('-u', '--use-key-file', 'Use the default key file located at ~/.droneblkey') do
|
41
41
|
@use_key_file = true
|
@@ -93,14 +93,14 @@ prevalid, ipv6 = opts.ips.partition { |ip| (ip.match(Resolv::IPv6::Regex).nil?)
|
|
93
93
|
valid, invalid = prevalid.partition { |ip| !(ip.match(Resolv::IPv4::Regex).nil?) }
|
94
94
|
invalid += ipv6
|
95
95
|
if @dry_run
|
96
|
-
puts DroneBL::gen_add_query valid
|
97
|
-
puts "#{valid.count} IPs will be added as type #{opts.type}#{" with comment 'opts.comment if opts.comment}'"}."
|
96
|
+
puts DroneBL::gen_add_query valid
|
97
|
+
puts "#{valid.count} IPs will be added as type #{opts.type}#{" with comment 'opts.comment if opts.comment}'"}."
|
98
98
|
else
|
99
|
-
response = DroneBL::add(valid, type, comment)
|
100
|
-
print_table response, opts.long_types
|
101
|
-
puts "#{valid.count} IPs looked up. #{response.map { |r| r['ip'] }.uniq.length} unique IPs found in response."
|
99
|
+
response = DroneBL::add(valid, type, comment)
|
100
|
+
print_table response, opts.long_types
|
101
|
+
puts "#{valid.count} IPs looked up. #{response.map { |r| r['ip'] }.uniq.length} unique IPs found in response."
|
102
102
|
end
|
103
103
|
unless invalid.empty?
|
104
|
-
puts "IPs not valid for lookup: "
|
105
|
-
invalid.each { |ip| puts ip }
|
104
|
+
puts "IPs not valid for lookup: "
|
105
|
+
invalid.each { |ip| puts ip }
|
106
106
|
end
|
data/bin/dronebl-query
CHANGED
@@ -15,7 +15,7 @@ class Options
|
|
15
15
|
opts.banner = "Usage: #{$0} [options]"
|
16
16
|
opts.separator ""
|
17
17
|
opts.separator "Options available:"
|
18
|
-
opts.on('-I', '--ips
|
18
|
+
opts.on('-I', '--ips ip1,ip2,ip3,...', Array, 'Read in IPs.') do |list|
|
19
19
|
@ips += list
|
20
20
|
end
|
21
21
|
opts.on('-s', '--stdin', 'Read a newline-delimited list of IPs from STDIN') do
|
@@ -24,16 +24,16 @@ class Options
|
|
24
24
|
opts.on('-k', '--key KEY', String, 'Use KEY as your DroneBL RPC2 key') do |key|
|
25
25
|
@key_str = key
|
26
26
|
end
|
27
|
-
opts.on('-f', '--keyfile
|
27
|
+
opts.on('-f', '--keyfile FILE_PATH', 'Read the file at FILE_PATH and use it as the RPC key') do |path|
|
28
28
|
@use_key_file = true
|
29
29
|
@key_file = path
|
30
30
|
end
|
31
31
|
opts.on('-a', '--get-archived', 'Get *all* DroneBL listings of the given IP, not just active ones.') do
|
32
32
|
@get_archived = true
|
33
33
|
end
|
34
|
-
opts.on('-T', '--time-format
|
35
|
-
@time_format = fmt
|
36
|
-
end
|
34
|
+
# opts.on('-T', '--time-format FORMAT', String, 'Interpolate the time format string with FORMAT instead of the default. See `man 3 strftime` for format specifiers.') do |fmt|
|
35
|
+
# @time_format = fmt
|
36
|
+
# end
|
37
37
|
opts.on('-u', '--use-key-file', 'Use the default key file located at ~/.droneblkey') do
|
38
38
|
@use_key_file = true
|
39
39
|
end
|