Method: Rex::Proto::DCERPC::Client#write
- Defined in:
- lib/rex/proto/dcerpc/client.rb
#write(data) ⇒ Object
Write data to the underlying socket, limiting the sizes of the writes based on the pipe_write_min / pipe_write_max options.
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/rex/proto/dcerpc/client.rb', line 213 def write(data) max_write = self.['pipe_write_max_size'] || data.length min_write = self.['pipe_write_min_size'] || max_write if(min_write > max_write) max_write = min_write end idx = 0 if (self.socket.class == Rex::Proto::SMB::SimpleClient::OpenPipe) while(idx < data.length) bsize = (rand(max_write-min_write)+min_write).to_i len = self.socket.write(data[idx, bsize], rand(1024)+1) idx += bsize end else self.socket.write(data) end data.length end |