Class: Rex::Ui::Text::Output
Overview
This class implements text-based output but is not tied to an output medium.
Defined Under Namespace
Classes: Buffer, File, Socket, Stdio, Tee
Constant Summary
Constants included
from Color
Color::AnsiAttributes
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Color
#ansi, #colorize, #do_colorize, #reset_color, #substitute_colors
Methods inherited from Output
#flush, #prompting, #prompting?
Constructor Details
#initialize ⇒ Output
Returns a new instance of Output.
24
25
26
27
28
29
|
# File 'lib/rex/ui/text/output.rb', line 24
def initialize
@config = {
:color => :auto, }
super
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
30
31
32
|
# File 'lib/rex/ui/text/output.rb', line 30
def config
@config
end
|
Instance Method Details
#auto_color ⇒ Object
40
41
42
|
# File 'lib/rex/ui/text/output.rb', line 40
def auto_color
@config[:color] = :auto
end
|
#disable_color ⇒ Object
32
33
34
|
# File 'lib/rex/ui/text/output.rb', line 32
def disable_color
@config[:color] = false
end
|
#enable_color ⇒ Object
36
37
38
|
# File 'lib/rex/ui/text/output.rb', line 36
def enable_color
@config[:color] = true
end
|
#print(msg = '') ⇒ Object
69
70
71
|
# File 'lib/rex/ui/text/output.rb', line 69
def print(msg = '')
print_raw(substitute_colors(msg))
end
|
#print_debug(msg = '') ⇒ Object
57
58
59
|
# File 'lib/rex/ui/text/output.rb', line 57
def print_debug(msg = '')
print_line("%bld%cya[!]%clr #{msg}")
end
|
#print_error(msg = '') ⇒ Object
49
50
51
|
# File 'lib/rex/ui/text/output.rb', line 49
def print_error(msg = '')
print_line("%bld%red[-]%clr #{msg}")
end
|
#print_good(msg = '') ⇒ Object
53
54
55
|
# File 'lib/rex/ui/text/output.rb', line 53
def print_good(msg = '')
print_line("%bld%grn[+]%clr #{msg}")
end
|
#print_line(msg = '') ⇒ Object
65
66
67
|
# File 'lib/rex/ui/text/output.rb', line 65
def print_line(msg = '')
print(msg + "\n")
end
|
#print_status(msg = '') ⇒ Object
61
62
63
|
# File 'lib/rex/ui/text/output.rb', line 61
def print_status(msg = '')
print_line("%bld%blu[*]%clr #{msg}")
end
|
#reset ⇒ Object
73
74
|
# File 'lib/rex/ui/text/output.rb', line 73
def reset
end
|
#update_prompt(prompt = nil) ⇒ Object
44
45
46
47
|
# File 'lib/rex/ui/text/output.rb', line 44
def update_prompt(prompt = nil)
return if prompt.nil?
substitute_colors(prompt, true)
end
|