2005-04-11 04:56:24 +00:00
|
|
|
#!/usr/bin/ruby
|
|
|
|
|
|
|
|
require 'Rex/Post/IO'
|
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Post
|
|
|
|
module Meterpreter
|
|
|
|
module Extensions
|
|
|
|
module Stdapi
|
|
|
|
|
2005-04-12 05:53:29 +00:00
|
|
|
##
|
|
|
|
#
|
|
|
|
# IO
|
|
|
|
# --
|
|
|
|
#
|
|
|
|
# The IO class acts as a base class for things that would normally implement
|
|
|
|
# the IO interface. The methods it implements are for general operations that
|
|
|
|
# are common to all channels, such as read, write, and close.
|
|
|
|
#
|
|
|
|
##
|
2005-04-11 04:56:24 +00:00
|
|
|
class IO < Rex::Post::IO
|
|
|
|
|
2005-04-12 05:53:29 +00:00
|
|
|
# Read the specified number of bytes from the channel
|
|
|
|
def sysread(length = nil)
|
|
|
|
self.filed.read(length)
|
2005-04-11 04:56:24 +00:00
|
|
|
end
|
|
|
|
|
2005-04-12 05:53:29 +00:00
|
|
|
# Synonym for sysread
|
|
|
|
def read(length = nil)
|
|
|
|
sysread
|
2005-04-11 04:56:24 +00:00
|
|
|
end
|
|
|
|
|
2005-04-12 05:53:29 +00:00
|
|
|
# Writes the supplied buffer to the channel
|
|
|
|
def syswrite(buf)
|
|
|
|
self.filed.write(buf)
|
2005-04-11 04:56:24 +00:00
|
|
|
end
|
|
|
|
|
2005-04-12 05:53:29 +00:00
|
|
|
# Synonym for syswrite
|
|
|
|
def write(buf)
|
|
|
|
syswrite
|
2005-04-11 04:56:24 +00:00
|
|
|
end
|
|
|
|
|
2005-04-12 05:53:29 +00:00
|
|
|
# Closes the channel
|
2005-04-11 04:56:24 +00:00
|
|
|
def close
|
2005-04-12 05:53:29 +00:00
|
|
|
self.filed.close
|
2005-04-11 04:56:24 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end; end; end; end; end
|