CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/post/meterpreter/extensions/stdapi/fs/io.rb
Views: 11795
1
# -*- coding: binary -*-
2
3
require 'rex/post/io'
4
5
module Rex
6
module Post
7
module Meterpreter
8
module Extensions
9
module Stdapi
10
module Fs
11
12
##
13
#
14
# The IO class acts as a base class for things that would normally implement
15
# the IO interface. The methods it implements are for general operations that
16
# are common to all channels, such as read, write, and close.
17
#
18
##
19
class IO < Rex::Post::IO
20
21
#
22
# Read the specified number of bytes from the channel.
23
#
24
def sysread(length = nil)
25
self.filed.read(length)
26
end
27
28
alias read sysread
29
30
#
31
# Writes the supplied buffer to the channel.
32
#
33
def syswrite(buf)
34
self.filed.write(buf)
35
end
36
37
alias write syswrite
38
39
#
40
# Closes the channel.
41
#
42
def close
43
self.filed.close
44
end
45
46
end
47
48
end; end; end; end; end; end
49
50