class Rex::Proto::SMB::SimpleClient::OpenPipe
Attributes
mode[RW]
Valid modes are: ‘trans’ and ‘rw’
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
Rex::Proto::SMB::SimpleClient::OpenFile::new
# File lib/rex/proto/smb/simpleclient/open_pipe.rb, line 12 def initialize(*args) super(*args) self.mode = 'rw' @buff = '' end
Public Instance Methods
read(length = nil, offset = 0)
click to toggle source
Calls superclass method
Rex::Proto::SMB::SimpleClient::OpenFile#read
# File lib/rex/proto/smb/simpleclient/open_pipe.rb, line 23 def read(length = nil, offset = 0) case self.mode when 'trans' read_buffer(length, offset) when 'rw' super(length, offset) else raise ArgumentError end end
read_buffer(length, offset=0)
click to toggle source
# File lib/rex/proto/smb/simpleclient/open_pipe.rb, line 18 def read_buffer(length, offset=0) length ||= @buff.length @buff.slice!(0, length) end
write(data, offset = 0)
click to toggle source
Calls superclass method
Rex::Proto::SMB::SimpleClient::OpenFile#write
# File lib/rex/proto/smb/simpleclient/open_pipe.rb, line 34 def write(data, offset = 0) case self.mode when 'trans' write_trans(data, offset) when 'rw' super(data, offset) else raise ArgumentError end end
write_trans(data, offset=0)
click to toggle source
# File lib/rex/proto/smb/simpleclient/open_pipe.rb, line 46 def write_trans(data, offset=0) ack = self.client.trans_named_pipe(self.file_id, data) doff = ack['Payload'].v['DataOffset'] dlen = ack['Payload'].v['DataCount'] @buff << ack.to_s[4+doff, dlen] end