Class: Wpxf::Cli::Banner
- Inherits:
-
Object
- Object
- Wpxf::Cli::Banner
- Defined in:
- lib/wpxf/cli/banner.rb
Overview
A helper class for printing banners in the terminal.
Instance Attribute Summary collapse
-
#raw_content ⇒ Object
Returns the value of attribute raw_content.
Instance Method Summary collapse
- #auxiliary_count ⇒ Object
- #display ⇒ Object
- #exploit_count ⇒ Object
- #format_colour(value) ⇒ Object
- #format_data(value) ⇒ Object
-
#initialize ⇒ Banner
constructor
A new instance of Banner.
Constructor Details
Instance Attribute Details
#raw_content ⇒ Object
Returns the value of attribute raw_content.
44 45 46 |
# File 'lib/wpxf/cli/banner.rb', line 44 def raw_content @raw_content end |
Instance Method Details
#auxiliary_count ⇒ Object
22 23 24 |
# File 'lib/wpxf/cli/banner.rb', line 22 def auxiliary_count Wpxf::Models::Module.where(type: 'auxiliary').count end |
#display ⇒ Object
37 38 39 40 41 42 |
# 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 ⇒ Object
26 27 28 |
# File 'lib/wpxf/cli/banner.rb', line 26 def exploit_count Wpxf::Models::Module.where(type: 'exploit').count end |
#format_colour(value) ⇒ Object
14 15 16 17 18 19 20 |
# 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) ⇒ Object
30 31 32 33 34 35 |
# 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 |