2005-07-14 22:45:10 +00:00
|
|
|
require 'rex/ui'
|
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Ui
|
|
|
|
module Text
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class Input
|
|
|
|
|
|
|
|
require 'rex/ui/text/input/stdio'
|
|
|
|
require 'rex/ui/text/input/readline'
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
self.eof = false
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Gets a line of input
|
|
|
|
#
|
|
|
|
def gets
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Has the input medium reached end-of-file?
|
|
|
|
#
|
|
|
|
def eof?
|
|
|
|
return eof
|
|
|
|
end
|
|
|
|
|
2005-07-16 07:32:11 +00:00
|
|
|
#
|
|
|
|
# Returns a pollable file descriptor that is associated with this
|
|
|
|
# input medium.
|
|
|
|
#
|
|
|
|
def fd
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2005-07-14 22:45:10 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
def intrinsic_shell?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
attr_accessor :eof
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|