On Thu, 2002-10-24 at 02:49, Michel Arboi wrote:
> This behaves as expected, although this is a real problem.
> I talked about that two months ago:
> http://archives.neohapsis.com/archives/apps/nessus/2002-q3/0125.html
I still like the algorithm I had posted in response thereto:
You have as optional parameters to recv() "min", "max" and "expr".
If specified, "expr" is either a substring to search for in the input,
or (bonus points to the coder) a regex. The algorithm, then:
1. Set timeout to 10 seconds (or even 1 minute or the plugin timeout).
2. Read the next packet worth of data with the current timeout.
3. If timeout exceeded or EOF, exit.
4. If "expr" is specified and input does not contain "expr", go to 2.
5. If "min" is specified and input bytes < min, go to 2; count "min"
relative to the bytes following "expr" if "expr" is specified,
else relative to start of data.
6. Set timeout to 1 second (or even a fractional second).
7. If "max" specified and input bytes >= max, exit.
8. Read the next packet worth of data with the current timeout.
9. If not timeout and not EOF, go to 7.
Thus for the problem at hand, we set "expr" to "\r\n\r\n" and "min" to
1. Thus, we wait some long timeout until we have at least one byte of
payload beyond the header (which returns instantly on EOF if only a
header is returned).
Kris
-
[EMAIL PROTECTED]: general discussions about Nessus.
* To unsubscribe, send a mail to [EMAIL PROTECTED] with
"unsubscribe nessus" in the body.