Sendto has logic to automatically sleep and retry a send if it fails.
Fyodor tells me that it was once necessary because of some transient
buffer shortage, though we can't remember the exact error it was in
response to.
The retry looks as though it has been slowly growing a list of
exceptional error codes for which sleeping is not done:
EPERM EACCES EMSGSIZE EADDRNOTAVAIL EINVAL
The latest was EMSGSIZE in r19378.
I changed this to only sleep on specific errors. Not knowing what the
original error was, I have guessed
ENOBUFS ENOMEM
Apache JServer Protocol requests. [Patrik Karlsson]
o [NSE] Added the script ajp-brute, which enables password brute force auditing
against the Apache JServ Protocol service. [Patrik Karlsson]
GetAdaptersAddresses is supposed to return ERROR_BUFFER_OVERFLOW and set
len to the required size when len is too small. So normally we would
call the function once with a small len, and then again with the longer
len. But, on Windows 2003, apparently you only get ERROR_BUFFER_OVERFLOW
the *first* time you call the function with a too-small len--the next
time you get ERROR_INVALID_PARAMETER. So this function would fail the
second and later times it is called.
So, make the first call using a large len. On Windows 2003, this will
work the first time as long as there are not too many adapters. (It will
still fail with ERROR_INVALID_PARAMETER if there are too many adapters,
but this will happen infrequently because of the large buffer.) Other
systems that always return ERROR_BUFFER_OVERFLOW when appropriate will
enlarge the buffer if the initial len is too short.
Windows resets the connection if we try to reconect too fast to the same port after doing a SYN scan and not completing the handshake. In my tests, sleep values above 0.1s prevent the connection reset so it's set to 0.2 .
An IPMP interface is a special kind of interface made up of other
interfaces. The other interfaces are hidden by default unless this flag
is passed to ioctl(SIOCGLIFCONF). This allows me to scan over an IPMP
interface in a simple setup.