Class: Rex::Ui::Text::Input::Stdio

Inherits:
Rex::Ui::Text::Input show all
Defined in:
lib/rex/ui/text/input/stdio.rb

Overview

This class implements input against standard in.

Instance Attribute Summary

Attributes inherited from Rex::Ui::Text::Input

#config, #eof, #prompt, #prompt_char

Instance Method Summary collapse

Methods inherited from Rex::Ui::Text::Input

#auto_color, #disable_color, #disable_readline, #enable_color, #enable_readline, #initialize, #intrinsic_shell?, #reset_color, #reset_tab_completion, #supports_readline, #update_prompt

Constructor Details

This class inherits a constructor from Rex::Ui::Text::Input

Instance Method Details

#eof?Boolean

Returns whether or not EOF has been reached on stdin.

Returns:

  • (Boolean)


31
32
33
# File 'lib/rex/ui/text/input/stdio.rb', line 31

def eof?
  $stdin.closed?
end

#fdObject

Returns the file descriptor associated with standard input.



38
39
40
# File 'lib/rex/ui/text/input/stdio.rb', line 38

def fd
  return $stdin
end

#getsObject

Wait for a line of input to be read from standard input.



24
25
26
# File 'lib/rex/ui/text/input/stdio.rb', line 24

def gets
  return $stdin.gets
end

#sysread(len = 1) ⇒ Object

Reads text from standard input.



17
18
19
# File 'lib/rex/ui/text/input/stdio.rb', line 17

def sysread(len = 1)
  $stdin.sysread(len)
end