diff --git a/lib/rex/io/stream_abstraction.rb b/lib/rex/io/stream_abstraction.rb index 08ba7e0133..5129b48f07 100644 --- a/lib/rex/io/stream_abstraction.rb +++ b/lib/rex/io/stream_abstraction.rb @@ -68,19 +68,33 @@ module StreamAbstraction end # - # Writes to the local side. + # Low-level write to the local side. # def syswrite(buffer) lsock.syswrite(buffer) end # - # Reads from the local side. + # Writes to the local side. + # + def write(buffer) + lsock.write(buffer) + end + + # + # Low-level read from the local side. # def sysread(length) lsock.sysread(length) end + # + # Reads from the local side. + # + def read(length) + lsock.read(length) + end + # # Shuts down the local side of the stream abstraction. # @@ -161,8 +175,12 @@ protected while( total_sent < total_length ) begin data = buf[total_sent, buf.length] + + # Note that this must be write() NOT syswrite() or put() or anything like it. + # Using syswrite() breaks SSL streams. sent = self.write( data ) - # sf: Only remove the data off the queue is syswrite was successfull. + + # sf: Only remove the data off the queue is write was successfull. # This way we naturally perform a resend if a failure occured. # Catches an edge case with meterpreter TCP channels where remote send # failes gracefully and a resend is required.