1# -*- coding: binary -*- 2 3module Rex 4module Ui 5module Text 6 7### 8# 9# This class implements input against standard in. 10# 11### 12class Input::Stdio < Rex::Ui::Text::Input 13 14 # 15 # Reads text from standard input. 16 # 17 def sysread(len = 1) 18 $stdin.sysread(len) 19 end 20 21 # 22 # Wait for a line of input to be read from standard input. 23 # 24 def gets 25 return $stdin.gets 26 end 27 28 # 29 # Returns whether or not EOF has been reached on stdin. 30 # 31 def eof? 32 $stdin.closed? 33 end 34 35 # 36 # Returns the file descriptor associated with standard input. 37 # 38 def fd 39 return $stdin 40 end 41end 42 43end 44end 45end 46 47