wafoo 0.0.4 → 0.0.5

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
  SHA256:
3
- metadata.gz: 04bbceda52de1c7aa38f36b757a193a844b9802b8191ad22b415db138a67ca16
4
- data.tar.gz: df50354e02a1255441f08d332294d1e34c4d53f2b8a50cfe8ce1e6e6a0073ea7
3
+ metadata.gz: cf968d2be7a9d1632c60d8cb49a0e8751a3d49f8d30685b9c3bc8414a84a5618
4
+ data.tar.gz: 6249335ba736504e93dd82f8effd9f4d9cd03b6aab9fbc58a4c97589ddc5034c
5
5
  SHA512:
6
- metadata.gz: 2d2de679881fbd0702c776c5d9f37ce9c8eb4dbe08251a8a6be7643fee70ccaad19817f0c3612f8d5fc893f6eac2ec9385b30d0bd755b4d48cb681473303a843
7
- data.tar.gz: e35f3262542c095e87f8b7d4899f96e2ea92d8a7479e2e0dccf8c8bc60b13d87268ce3434402c148a6c0ebaec4366bd4ef5e44d7039106a7a9d5feb0041e1002
6
+ metadata.gz: a720d8b8b0e4bb647ff85a8c2dff26e92a6699239a8077b312186f8621608b586b7b1496570045216ad1ff93b3c16e68e49ed8b57bbe36cd27d18728f536bd1e
7
+ data.tar.gz: 596aba582b45439a3820aa0b01ad595102d6dbb568f42f349efe1acd0c4a476bea89881c4ee4a47e6144512e4d6f3e5ac00a837639a94931c44ef290ba449001
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  vendor/bundle/
11
11
  .envrc
12
+ ipsets/
@@ -1,7 +1,7 @@
1
1
  module Wafoo
2
2
  module Helper
3
3
  def output_table(ipsets_list)
4
- table = Terminal::Table.new(:headings => ['Type', 'IPSets ID', 'Name'],
4
+ table = Terminal::Table.new(:headings => ['Type', 'IPSet IDs', 'Name'],
5
5
  :rows => ipsets_list)
6
6
  puts table
7
7
  end
@@ -2,12 +2,14 @@ require 'wafoo'
2
2
 
3
3
  module Wafoo
4
4
  class Run
5
+ IP_SETS_DIR = 'ipsets'
5
6
  include Wafoo::Helper
6
7
 
7
8
  def initialize(options = nil)
8
9
  @waf_regional = Aws::WAFRegional::Client.new
9
10
  @waf = Aws::WAF::Client.new
10
11
  @regional = options[:regional] unless options.nil?
12
+ FileUtils.mkdir_p(IP_SETS_DIR) unless FileTest.exist?(IP_SETS_DIR)
11
13
  end
12
14
 
13
15
  def read_ipset_from_api(ip_set_id)
@@ -26,7 +28,7 @@ module Wafoo
26
28
 
27
29
  def read_ipset_from_file(ip_set_id)
28
30
  ipsets = []
29
- File.open(ip_set_id, 'r') do |file|
31
+ File.open(IP_SETS_DIR + '/' + ip_set_id, 'r') do |file|
30
32
  file.read.split("\n").each do |ipset|
31
33
  ipsets << ipset
32
34
  end
@@ -64,10 +66,10 @@ module Wafoo
64
66
  exit 1
65
67
  end
66
68
  ipsets.sort.each { |ipset| puts info_print(ipset) }
67
- File.open(ip_set_id, 'w') do |f|
69
+ File.open(IP_SETS_DIR + '/' + ip_set_id, 'w') do |f|
68
70
  ipsets.sort.each { |ipset| f.puts(ipset) }
69
71
  end
70
- puts 'Exported to ' + added_print(ip_set_id)
72
+ puts 'Exported to ' + added_print(IP_SETS_DIR + '/' + ip_set_id)
71
73
  end
72
74
 
73
75
  def apply_ipset(ipsets, ip_set_id)
@@ -1,3 +1,3 @@
1
1
  module Wafoo
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wafoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - inokappa