Sha256: 77ecfceaca2d86cc52fe5b953f9e6eeb1287b7eb64532ab7cfd13b950bfa7b79

Contents?: true

Size: 1.34 KB

Versions: 10

Compression:

Stored size: 1.34 KB

Contents

# -*- coding: binary -*-
require 'rex/ui'

module Rex
module Ui
module Text

###
#
# This class implements text-based output but is not
# tied to an output medium.
#
###
class Output < Rex::Ui::Output

  require 'rex/ui/text/output/stdio'
  require 'rex/ui/text/output/socket'
  require 'rex/ui/text/output/buffer'
  require 'rex/ui/text/output/file'
  require 'rex/ui/text/output/tee'
  require 'rex/ui/text/color'

  include Rex::Ui::Text::Color

  def initialize
    @config = {
      :color => :auto, # true, false, :auto
    }
    super
  end
  attr_reader :config

  def disable_color
    @config[:color] = false
  end

  def enable_color
    @config[:color] = true
  end

  def auto_color
    @config[:color] = :auto
  end

  def update_prompt(prompt = nil)
    return if prompt.nil?
    substitute_colors(prompt, true)
  end

  def print_error(msg = '')
    print_line("%bld%red[-]%clr #{msg}")
  end

  def print_good(msg = '')
    print_line("%bld%grn[+]%clr #{msg}")
  end

  def print_debug(msg = '')
    print_line("%bld%cya[!]%clr #{msg}")
  end

  def print_status(msg = '')
    print_line("%bld%blu[*]%clr #{msg}")
  end

  def print_line(msg = '')
    print(msg + "\n")
  end

  def print_warning(msg = '')
    print_line("%bld%yel[!]%clr #{msg}")
  end

  def print(msg = '')
    print_raw(substitute_colors(msg))
  end

  def reset
  end

end

end
end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
rex-2.0.8 lib/rex/ui/text/output.rb
rex-2.0.7 lib/rex/ui/text/output.rb
rex-2.0.5 lib/rex/ui/text/output.rb
rex-2.0.4 lib/rex/ui/text/output.rb
dstruct-0.0.1 lib/rex/ui/text/output.rb
rex-2.0.3 lib/rex/ui/text/output.rb
librex-0.0.999 lib/rex/ui/text/output.rb
rex-2.0.2 lib/rex/ui/text/output.rb
librex-0.0.71 lib/rex/ui/text/output.rb
librex-0.0.70 lib/rex/ui/text/output.rb