dronebl.rb 0.0.11.1 → 0.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf8a0d7704e1908415dd35dfc0713feebf0b0475
4
- data.tar.gz: e05dc36f8bf92d7319dafd2164ceb1192d817609
3
+ metadata.gz: 9df0f525994636f1b45d2dd737b8fe62ce1c9b0e
4
+ data.tar.gz: 637e9371e932d23e2a18a316d9f7f76de61cd21d
5
5
  SHA512:
6
- metadata.gz: 921e9c85a97531b28bbec719851bf2367f05b5d0ac7537ab9f097f4f806603f7e8be7b9621e639c8bb605f9a8a884e35399b219e42592f1ea1eb3c0e2b102ae4
7
- data.tar.gz: 6ce277531dbe259bdf81ed21a8d21ccbd7588ea17cee1673aa84ad2e762a6cdbe85e30de6380520cebd5063aa60945199c0edb45a068ab2c3437c99441ca44fa
6
+ metadata.gz: 2479574cbfd3ce92244d67dc96354d59d512e8243ff0597bde6c41347b5961980202fa525b35d701577843916381c63a572bc2901c319c2abeefc44bcd27e505
7
+ data.tar.gz: b1a754a58fb875646c50a147aebf9d5a29bef6eef3043bcd3ac9aa540f770e3e1a81ebd518e87e8b399576db428f2771b47efa100598b11e205e670fe18091e1
@@ -99,7 +99,8 @@ opts.ips.uniq!
99
99
 
100
100
  prevalid, ipv6 = opts.ips.partition { |ip| (ip.match(Resolv::IPv6::Regex).nil?) }
101
101
  valid, invalid = prevalid.partition { |ip| !(ip.match(Resolv::IPv4::Regex).nil?) }
102
- invalid += ipv6
102
+ valid += ipv6
103
+ valid.flatten!
103
104
  if opts.dry_run
104
105
  valid.each_slice(opts.max_ips_per_chunk) { |submit| puts DroneBL::gen_add_query(submit, opts.type, opts.comment) }
105
106
  puts "#{valid.count} IPs will be added as type #{opts.type}#{" with comment '#{opts.comment if opts.comment}'"}."
@@ -114,6 +114,8 @@ end
114
114
  opts.ips.uniq!
115
115
 
116
116
  query, ipv6 = opts.ips.partition { |ip| (ip.match(Resolv::IPv6::Regex).nil?) }
117
+ query += ipv6
118
+ query.flatten!
117
119
  if @dry_run
118
120
  puts DroneBL::gen_lookup_query query, opts.get_archived
119
121
  puts "#{query.count} IPs will be looked up."
@@ -122,7 +124,3 @@ else
122
124
  print_table response, opts.long_types
123
125
  puts "#{query.count} IPs looked up. #{response.map { |r| r['ip'] }.uniq.length} unique IPs found in response."
124
126
  end
125
- unless ipv6.empty?
126
- puts "IPs not query for lookup: "
127
- ipv6.each { |ip| puts ip }
128
- end
@@ -44,12 +44,12 @@ module DroneBL
44
44
 
45
45
  def gen_lookup_query ips, archived=false
46
46
  archived ||= false
47
- <<EOF
48
- <?xml version='1.0'?>
49
- <request key='#{key}'>
50
- #{ips.map { |ip| "<lookup ip='#{ip}' listed='#{archived ? 2 : 1}'>"}.join("\n")}
51
- </request>
52
- EOF
47
+ [
48
+ "<?xml version='1.0'?>",
49
+ "<request key='#{key}'>",
50
+ " #{ips.map { |ip| "<lookup ip='#{ip}' listed='#{archived ? 2 : 1}'>"}.join("\n")}",
51
+ '</request>'
52
+ ].join("\n")
53
53
  end
54
54
  def gen_add_query ips, type, comment=''
55
55
  comment ||= ''
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dronebl.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11.1
4
+ version: 0.1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rylee Fowler
@@ -77,4 +77,3 @@ summary: 'This is an interface to the DroneBL.org RPC2 administrative interface.
77
77
  the server. NOTE: You should create a ~/.droneblkey file with your key inside of
78
78
  it for the best experience with this.'
79
79
  test_files: []
80
- has_rdoc: