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.

Constant Summary

Constants included from Color

Color::AnsiAttributes

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, #enable_color, #initialize, #intrinsic_shell?, #reset_color, #reset_tab_completion, #supports_readline, #update_prompt

Methods included from Color

#ansi, #colorize, #do_colorize, #reset_color, #substitute_colors

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)


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

def eof?
  $stdin.closed?
end

#fdObject

Returns the file descriptor associated with standard input.



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

def fd
  return $stdin
end

#getsObject

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



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

def gets
  return $stdin.gets
end

#sysread(len = 1) ⇒ Object

Reads text from standard input.



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

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