Class: Rex::Ui::Text::Output
- Inherits:
-
Output
- Object
- Output
- Rex::Ui::Text::Output
show all
- Includes:
- Text::Color
- Defined in:
- lib/rex/ui/text/output.rb,
lib/rex/ui/text/output/buffer/stdout.rb
Overview
This class implements text-based output but is not tied to an output medium.
Defined Under Namespace
Classes: Buffer, File, Socket, Stdio, Tee
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Output
#flush, #prompting, #prompting?
Constructor Details
#initialize ⇒ Output
Returns a new instance of Output.
19
20
21
22
23
24
|
# File 'lib/rex/ui/text/output.rb', line 19
def initialize
@config = {
:color => :auto, }
super
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
25
26
27
|
# File 'lib/rex/ui/text/output.rb', line 25
def config
@config
end
|
Returns the value of attribute input.
26
27
28
|
# File 'lib/rex/ui/text/output.rb', line 26
def input
@input
end
|
Instance Method Details
#auto_color ⇒ Object
36
37
38
|
# File 'lib/rex/ui/text/output.rb', line 36
def auto_color
@config[:color] = :auto
end
|
#disable_color ⇒ Object
28
29
30
|
# File 'lib/rex/ui/text/output.rb', line 28
def disable_color
@config[:color] = false
end
|
#enable_color ⇒ Object
32
33
34
|
# File 'lib/rex/ui/text/output.rb', line 32
def enable_color
@config[:color] = true
end
|
#print(msg = '') ⇒ Object
67
68
69
|
# File 'lib/rex/ui/text/output.rb', line 67
def print(msg = '')
print_raw(substitute_colors(msg))
end
|
#print_error(msg = '') ⇒ Object
Also known as:
print_bad
45
46
47
|
# File 'lib/rex/ui/text/output.rb', line 45
def print_error(msg = '')
print_line("%bld%red[-]%clr #{msg}")
end
|
#print_good(msg = '') ⇒ Object
51
52
53
|
# File 'lib/rex/ui/text/output.rb', line 51
def print_good(msg = '')
print_line("%bld%grn[+]%clr #{msg}")
end
|
#print_line(msg = '') ⇒ Object
59
60
61
|
# File 'lib/rex/ui/text/output.rb', line 59
def print_line(msg = '')
print(msg + "\n")
end
|
#print_status(msg = '') ⇒ Object
55
56
57
|
# File 'lib/rex/ui/text/output.rb', line 55
def print_status(msg = '')
print_line("%bld%blu[*]%clr #{msg}")
end
|
#print_warning(msg = '') ⇒ Object
63
64
65
|
# File 'lib/rex/ui/text/output.rb', line 63
def print_warning(msg = '')
print_line("%bld%yel[!]%clr #{msg}")
end
|
#puts(*args) ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/rex/ui/text/output.rb', line 74
def puts(*args)
args.each do |argument|
line = argument.to_s
print_raw(line)
unless line.ends_with? "\n"
print_raw($INPUT_RECORD_SEPARATOR)
end
end
nil
end
|
#reset ⇒ Object
71
72
|
# File 'lib/rex/ui/text/output.rb', line 71
def reset
end
|
#update_prompt(prompt = nil) ⇒ Object
40
41
42
43
|
# File 'lib/rex/ui/text/output.rb', line 40
def update_prompt(prompt = nil)
return if prompt.nil?
substitute_colors(prompt, true)
end
|