wafoo 0.0.4 → 0.0.5
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/.gitignore +1 -0
- data/lib/wafoo/helper.rb +1 -1
- data/lib/wafoo/run.rb +5 -3
- data/lib/wafoo/version.rb +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: cf968d2be7a9d1632c60d8cb49a0e8751a3d49f8d30685b9c3bc8414a84a5618
|
4
|
+
data.tar.gz: 6249335ba736504e93dd82f8effd9f4d9cd03b6aab9fbc58a4c97589ddc5034c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a720d8b8b0e4bb647ff85a8c2dff26e92a6699239a8077b312186f8621608b586b7b1496570045216ad1ff93b3c16e68e49ed8b57bbe36cd27d18728f536bd1e
|
7
|
+
data.tar.gz: 596aba582b45439a3820aa0b01ad595102d6dbb568f42f349efe1acd0c4a476bea89881c4ee4a47e6144512e4d6f3e5ac00a837639a94931c44ef290ba449001
|
data/.gitignore
CHANGED
data/lib/wafoo/helper.rb
CHANGED
data/lib/wafoo/run.rb
CHANGED
@@ -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)
|
data/lib/wafoo/version.rb
CHANGED