metasploit-framework/lib/rex
Brent Cook 65d71a5e18 Fix #4625 Reenable channel receive packet requeueing logic
In #4475, I incorrectly interpreted the role of the 'incomplete' array
in monitor_socket, and that change should be reverted.

What appears to happen is, we play a kind of 3-card monty with the list
of received packets that are waiting for a handler to use them.
monitor_socket continually loops between putting the packets on @pqueue,
then into backlog[] to sort them, then into incomplete[] to list all of
the packets that did not have handlers, finally back into @pqueue again.
If packets don't continually get shuffled back into incomplete, they are
not copied back into @pqueue to get rescanned again.

The only reason anything should really get into incomplete[] is if we
receive a packet, but there is nothing to handle it. This scenario
sounds like a bug, but it is exactly what happens with the Tcp Client
channel - one can open a new channel, and receive a response packet back
from the channel before the subsequent read_once code runs to register a
handler to actually process it. This would be akin to your OS
speculatively accepting data on a TCP socket with no listener, then when
you open the socket for the first time, its already there.

While it would be nice if the handlers were setup before the data was
sent back, rather than relying on a handler being registered some time
between connect and PacketTimeout, this needs to get in now to stop the
bleeding. The original meterpreter crash issue from #4475 appears to be
gone as well.
2015-01-23 08:50:37 -06:00
..
arch Land #3770, resolve random stager bugs 2014-11-03 14:15:14 -06:00
assembly removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
constants Remove duplicate defines 2014-05-25 09:40:33 +01:00
elfparsey BUGFIX: wrong imagebase used 2014-09-11 12:33:09 +02:00
elfscan Add disasm option to msfelfscan 2013-12-26 16:26:45 -02:00
encoder Land #3767, @jvazquez-r7's specs for Rex::Encoder::XDR 2014-10-22 09:22:53 -07:00
encoders removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
encoding No need for that kind of language 2014-03-04 14:34:50 -06:00
exploitation Delete heaponly option 2015-01-16 19:35:57 -06:00
image_source Add specs for #read_asciiz and fix bugs there 2014-09-22 12:14:21 -05:00
io removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
java Prefix coding 2014-12-10 09:52:23 -06:00
logging
machparsey removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
machscan removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
mime touch up lib/rex/mime/message.rb 2014-11-06 22:48:34 -06:00
nop
ole Fix recursive call to find_by_sid 2014-11-03 14:25:29 -06:00
parser Changing code to catch everything extraneous 2015-01-17 15:46:26 +00:00
payloads Resolve #4507 - respond_to? + send = evil 2015-01-02 13:29:17 -06:00
peparsey removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
pescan
platforms
poly Add 'coding: binary' to all msf/rex library files 2014-08-17 17:31:53 -05:00
post Fix #4625 Reenable channel receive packet requeueing logic 2015-01-23 08:50:37 -06:00
proto Remove errant pry 2015-01-13 10:35:05 -08:00
registry Fix improper use of host-endian or signed pack/unpack 2014-06-30 02:50:10 -05:00
ropbuilder
script
services
socket Auto-generated SSL certs now match "snakeoil" defaults 2014-11-21 18:25:04 -06:00
sslscan Add 'coding: binary' to all msf/rex library files 2014-08-17 17:31:53 -05:00
struct2 removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
sync Get rid of callcc 2013-09-23 19:36:26 -05:00
ui Resolve #4507 - respond_to? + send = evil 2015-01-02 13:29:17 -06:00
zip Add support for spoofed zip Central Dir names at Entry level 2014-04-07 09:21:26 -05:00
LICENSE Rapid7 Comma Inc 2014-03-13 09:46:20 -05:00
arch.rb Get a shell from a loose gdbserver session. 2014-08-24 01:10:30 -05:00
codepage.map
compat.rb That's funny I changed the wrong method 2014-02-13 16:41:18 -06:00
constants.rb Refactors 2014-05-21 20:15:32 +01:00
elfparsey.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
elfscan.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
exceptions.rb Differentiate failed binds from connects, closes #4169 2014-11-11 14:59:41 -06:00
file.rb
image_source.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
java.rb Prefix coding 2014-12-10 09:52:23 -06:00
job_container.rb
logging.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
mac_oui.rb Add 'coding: binary' to all msf/rex library files 2014-08-17 17:31:53 -05:00
machparsey.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
machscan.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
mime.rb
ole.rb
payloads.rb Provides methods to patch metsrv stagers with options. 2014-08-25 00:55:07 -04:00
peparsey.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
pescan.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
platforms.rb
poly.rb
post.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
proto.rb Add initial design draft 2014-12-09 15:53:29 -06:00
random_identifier_generator.rb Add 'coding: binary' to all msf/rex library files 2014-08-17 17:31:53 -05:00
registry.rb
ropbuilder.rb
script.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
service.rb
service_manager.rb
socket.rb reverting port 0 behaviour in portspec 2014-06-25 13:07:22 -05:00
struct2.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
sync.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00
text.rb Merge remote-tracking branch 'upstream/master' into pr2075 2014-07-16 20:34:34 +01:00
thread_factory.rb
time.rb
transformer.rb
ui.rb
zip.rb removed shebangs from files within rex 2013-11-07 18:51:59 -05:00