class Rex::Ui::Text::Input
This class acts as a base for all input mediums. It defines the interface that will be used by anything that wants to interact with a derived class.
Attributes
config[RW]
eof[RW]
prompt[RW]
prompt_char[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/rex/ui/text/input.rb, line 24 def initialize self.eof = false @config = { :color => :auto, # true, false, :auto } super end
Public Instance Methods
auto_color()
click to toggle source
# File lib/rex/ui/text/input.rb, line 99 def auto_color return if not @config @config[:color] = :auto end
disable_color()
click to toggle source
# File lib/rex/ui/text/input.rb, line 89 def disable_color return if not @config @config[:color] = false end
enable_color()
click to toggle source
# File lib/rex/ui/text/input.rb, line 94 def enable_color return if not @config @config[:color] = true end
eof?()
click to toggle source
Has the input medium reached end-of-file?
# File lib/rex/ui/text/input.rb, line 62 def eof? return eof end
fd()
click to toggle source
Returns a pollable file descriptor that is associated with this input medium.
# File lib/rex/ui/text/input.rb, line 70 def fd raise NotImplementedError end
gets()
click to toggle source
Gets a line of input
# File lib/rex/ui/text/input.rb, line 55 def gets raise NotImplementedError end
intrinsic_shell?()
click to toggle source
Indicates whether or not this input medium is intrinsicly a shell provider. This would indicate whether or not it already expects to have a prompt.
# File lib/rex/ui/text/input.rb, line 79 def intrinsic_shell? false end
reset_color()
click to toggle source
# File lib/rex/ui/text/input.rb, line 108 def reset_color end
reset_tab_completion()
click to toggle source
Stub for tab completion reset
# File lib/rex/ui/text/input.rb, line 42 def reset_tab_completion end
supports_readline()
click to toggle source
Whether or not the input medium supports readline.
# File lib/rex/ui/text/input.rb, line 35 def supports_readline true end
sysread(len)
click to toggle source
Calls the underlying system read.
# File lib/rex/ui/text/input.rb, line 48 def sysread(len) raise NotImplementedError end
update_prompt(new_prompt = '', new_prompt_char = '')
click to toggle source
# File lib/rex/ui/text/input.rb, line 83 def update_prompt(new_prompt = '', new_prompt_char = '') self.prompt = new_prompt + new_prompt_char end