class Wpxf::Cli::Banner

A helper class for printing banners in the terminal.

Attributes

raw_content[RW]

Public Class Methods

new() click to toggle source
# File lib/wpxf/cli/banner.rb, line 9
def initialize
  file = Wpxf::DataFile.new('banners', 'default.txt')
  self.raw_content = file.content
end

Public Instance Methods

auxiliary_count() click to toggle source
# File lib/wpxf/cli/banner.rb, line 22
def auxiliary_count
  Wpxf::Models::Module.where(type: 'auxiliary').count
end
display() click to toggle source
# File lib/wpxf/cli/banner.rb, line 37
def display
  formatted = format_colour(raw_content)
  formatted = format_data(formatted)
  puts formatted
  puts
end
exploit_count() click to toggle source
# File lib/wpxf/cli/banner.rb, line 26
def exploit_count
  Wpxf::Models::Module.where(type: 'exploit').count
end
format_colour(value) click to toggle source
# File lib/wpxf/cli/banner.rb, line 14
def format_colour(value)
  value.gsub('{WB}', "\e[0m\e[97m\e[1m")
       .gsub('{WN}', "\e[0m\e[97m")
       .gsub('{GN}', "\e[0m\e[32m")
       .gsub('{LGN}', "\e[0m\e[37m")
       .gsub('{YB}', "\e[0m\e[33m\e[1m")
end
format_data(value) click to toggle source
# File lib/wpxf/cli/banner.rb, line 30
def format_data(value)
  value.gsub('{VERSION}', Wpxf.version)
       .gsub('{AUXILIARY_COUNT}', auxiliary_count.to_s)
       .gsub('{EXPLOIT_COUNT}', exploit_count.to_s)
       .gsub('{PAYLOAD_COUNT}', Wpxf::Payloads.payload_count.to_s)
end