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'
|
2005-11-28 16:36:06 +00:00
|
|
|
require 'rex/ui/text/input/socket'
|
2005-07-14 22:45:10 +00:00
|
|
|
|
|
|
|
def initialize
|
|
|
|
self.eof = false
|
|
|
|
end
|
|
|
|
|
2005-11-28 16:36:06 +00:00
|
|
|
#
|
|
|
|
# Whether or not the input medium supports readline.
|
|
|
|
#
|
|
|
|
def supports_readline
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2005-12-07 03:40:09 +00:00
|
|
|
#
|
|
|
|
# Calls the underlying system read.
|
|
|
|
#
|
|
|
|
def sysread(len)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2005-07-14 22:45:10 +00:00
|
|
|
#
|
|
|
|
# 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
|