Module: Wafoo::Helper

Included in:
Run
Defined in:
lib/wafoo/helper.rb

Instance Method Summary collapse

Instance Method Details

#added_print(message) ⇒ Object



15
16
17
# File 'lib/wafoo/helper.rb', line 15

def added_print(message)
  "\e[32m" + message + "\e[0m"
end

#info_print(message) ⇒ Object



19
20
21
# File 'lib/wafoo/helper.rb', line 19

def info_print(message)
  "\e[36m" + message + "\e[0m"
end

#output_table(ipsets_list, full) ⇒ Object



3
4
5
6
7
8
# File 'lib/wafoo/helper.rb', line 3

def output_table(ipsets_list, full)
  header = ['Type', 'IPSet ID', 'IPSet Name']
  header.concat(['WebACL ID', 'WebACL Name']) if full
  table = Terminal::Table.new(:headings => header, :rows => ipsets_list)
  puts table
end

#removed_print(message) ⇒ Object Also known as: error_print



23
24
25
# File 'lib/wafoo/helper.rb', line 23

def removed_print(message)
  "\e[31m" + message + "\e[0m"
end

#split_cidr(ipset) ⇒ Object



10
11
12
13
# File 'lib/wafoo/helper.rb', line 10

def split_cidr(ipset)
  addr = NetAddr::CIDR.create(ipset)
  addr.enumerate
end