1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 23:49:03 +00:00
Commit Graph

4571 Commits

Author SHA1 Message Date
david
90ba6b97d0 Merge from /nmap-exp/david/nmap-perf. A summary of changes:
Don't make a host the global ping host until it moves to the completed
hosts list, and only change the global ping probe if the new probe is no
worse than the old (according to pingprobe_is_better).

Restore the ping magnifier for host congestion window updates.

Ignore the timing of certain ICMP errors that are likely to be rate
limited and don't change the port or host state. Avoid making timing
pings out of probes that elicit such errors. This used to be done only
for port scans and only at -T4 and above (and didn't prohibit the
creation of timing pings). Now it is done for host discovery too, and at
all timing levels.

Gracefully handle updates from the recent past in RateMeter. Doesn't
affect performance, but avoids a rare assertion failure.
2009-01-08 22:54:07 +00:00
david
4deb33e3ce Add the results of 140 OS submissions. 2009-01-08 20:38:53 +00:00
david
58eaf1aed3 Fix a typo in nmap-service-probes: Max OS X -> Mac OS X. 2009-01-08 20:13:29 +00:00
kris
34518abf1d Reversing r11550 (nsi_set_debug() changelog entry) 2009-01-08 02:13:28 +00:00
david
8ede562551 Broaden the scope of a comment in scan_engine.cc: We don't adjust timing on
timeout of any non-ping probe, not just those with tryno == 0.
2009-01-07 23:57:40 +00:00
david
3c4f855e6d Print NSE event messages with --script-trace also. 2009-01-07 19:50:25 +00:00
kris
5738b65f57 Update two @copyright lines to standard man-legal.html links 2009-01-07 16:15:05 +00:00
david
37601e7f0d Add to CHANGELOG:
o NSE prints messages in debugging mode whenever a script starts or
  finishes [Patrick, David].
2009-01-07 04:28:46 +00:00
david
37913d1986 Add times to the NSE event messages. 2009-01-07 04:12:00 +00:00
david
13b7a324e8 Include the script file name, target, and port in the debug messages for each
script event: start, finish, timeout, and error. The file name is now stored as
a std::string in struct thread_record so we have it when we don't have access
to the thread's environment.
2009-01-07 00:10:10 +00:00
david
57efc72d8d Reformat script event debugging output slightly. Handle the formatting of the
script target in a dedicated function. Print the thread address only at -d2 and
above.
2009-01-06 22:14:10 +00:00
david
5a745de5c7 Put the "SCRIPT ENGINE:" prefix before NSE script start/stop messages. 2009-01-06 21:57:51 +00:00
david
1c936c60cd Break out NSE event reporting into separate functions. Include the script file
name when a script fails without error. In that case we can grab the file name
directly from the thread.
2009-01-06 21:54:59 +00:00
david
a1631b4d6b Commit Patrick's NSE patch from http://seclists.org/nmap-dev/2008/q4/0750.html. This provides a -d1 message whenever a script begins or ends. 2009-01-06 21:19:32 +00:00
kris
20ec1c416e o An "elapsed" attribute has been added to the XML output, representing
the total scan time in seconds (floating point).
2009-01-05 05:57:35 +00:00
david
3ed62451bb Put the test for HOST_DOWN or HOST_UP once again after the test for
num_probes_active == 0 in HostScanStats::completed. The reason for this is
fairly subtle and I didn't realize it at first: We have to make sure there are
no active probes because once in the completed list, probes don't time out.
Probes that are active stay active in the count. If the congestion window ever
falls below the number of these active probes, the program will hang waiting
for them to time out.

We could get away with this in the case of up hosts, because we call
HostScanStats::destroyAllOutstandingProbes in that case. We could do that in
the down case too, but that would prohibit a down host from being found up
later on. That's currently a matter of some luck; we don't keep sending probes
after a host is down but will accept replies to any other probes that have
already been sent.
2009-01-04 16:45:17 +00:00
david
af1ccf0cfe Patch from jah: Move the definition of struct dnet_collector_route_nfo earlier
in tcpip.cc for the WIN32 functions that need it.
2009-01-04 15:08:12 +00:00
david
b3b06477c3 Pull out the stuff that ignored timing for ICMP destination unreachables if the
source address didn't match the target address. Fyodor correctly pointed out
that this is wrong for UDP scans, when we need to slow down for a firewall
sending unreachables to know which probes don't elicit one. I'm going to try
something a little different in nmap-perf.
2009-01-04 01:20:05 +00:00
fyodor
856b5cbe2d fix spelling error 2009-01-04 00:50:57 +00:00
david
d32794e2b6 Fix indentation in a line. 2009-01-03 23:35:30 +00:00
david
3b1f4fb755 Remove the unused HostScanStats::probes_outstanding_empty method. 2009-01-03 22:17:21 +00:00
david
da0b2c98c8 When a global ping times out, don't just destroy it, update timing too. Without
this, global pings never gave negative feedback, only positive feedback.
2009-01-03 22:15:06 +00:00
david
6998d72ccc Short-circuit HostScanStats::completed in host discovery: once we know the host
is up or down, we can move it to the completed list, regardless of any active
probes. However I can imagine changing this so that we move it when it is found
up, or when it is found down and there are no probes left to send. That would
give a down host a chance to become up with a different probe later on.
2009-01-03 22:04:43 +00:00
david
b0b0c0926a Just as during port scans, during host discovery don't adjust timing and don't
set a ping probe when an ICMP destination unreachable doesn't come directly
from the target.
2009-01-03 21:53:38 +00:00
david
76b7a7383f Use pingprobe.type != PS_NONE rather than pingprobe_state != PORT_UNKNOWN when
checking if a pingprobe has been set. We always use PORT_UNKNOWN during host
discovery (rather than HOST_UP or HOST_DOWN) to avoid conflicts with other
PORT_* constants. See the log for r8784.
2009-01-03 21:29:17 +00:00
david
e039a96715 Send global pings when num_probes_active == 0, not when
num_probes_outstanding() == 0. The active probes are probes that haven't timed
out; the outstanding probes includes those and some timed-out probes. When a
host makes it to the completed list with outstanding probes, it is unlikely
they will ever be removed, so we weren't sending any global pings in some
cases. A host only moves to the completed list with it has no active probes,
and any active probes it has after that are global pings.

Also remove only timed-out ping probes from the ping host. All other probes are
timed out but waiting for a response.
2009-01-03 20:43:37 +00:00
kris
5725a169bf Make robots.txt.nse be silent instead of printing reports for a file with no
disallowed entries
2009-01-03 16:54:47 +00:00
david
7b68aaa455 Restore the setting of the global ping host. This was mistakenly removed (by
me) in r8784 when I made the change to retain ping probes between ping scanning
and port scanning.

It only gets set during host discovery scans, because that's how it was before,
but it might be advantageous to set it during port scans as well.
2009-01-03 07:06:13 +00:00
david
dde1d7aac3 Remove a declaration of the function cleanup_threads, which doesn't exist. 2009-01-02 19:32:05 +00:00
david
db9e8e751c Add some more documentation to process_preparethread to note what's on the
thread's stack when it is initialized.
2009-01-02 19:21:27 +00:00
david
d24ccae322 Don't adjust timing when we get an ICMP response that is not directly from the
target. In my testing, TCP scanning certain hosts, other hosts send back ICMP
destination unreachables (admin prohibited) for some ports (the Microsoft
ports). If that's the only response we got from a host, we would make it the
timing ping probe. But the admin-prohibiteds come back at some very slow rate,
much slower than the 1.25/s ping interval. So most of them are dropped, keeping
the congestion window perpetually at 1 and slowly increasing the scan delay. In
a -F scan these hosts could take over twice as long as any other host.

I also put in some missing adjust_timing arguments to the host and ping update
functions whenever adjust_timing could be false (the default is true). I think
those were just oversights. I also made it so that we don't select a new ping
probe when adjust_timing is false; there's no point sending ping probes whose
responses we're going to ignore.
2009-01-02 01:45:04 +00:00
david
02412b7cd9 Add to CHANGELOG:
o When a system route can't be matched up directly with an interface
  by comparing addresses, Nmap now tries to match the route through
  another route. This helps for instance with a PPP connection where
  the default route's gateway address is routed through a different
  route, the one associated with the address of the PPP device. The
  problem would show itself as an inability to scan through the
  default route and the error message
    WARNING: Unable to find appropriate interface for system route to ...
2009-01-01 19:53:50 +00:00
david
46378a0dfd Rearrange the dnet route functions so they are all together, add a function
comment.
2009-01-01 19:33:19 +00:00
david
adab33deb9 Split out the assignment of interfaces to routes into a postprocessing step. We
need to have all the routes available before assigning interfaces to handle a
situation like the following:

# nmap --iflist
************************INTERFACES************************
DEV  (SHORT) IP/MASK        TYPE        UP MAC
lo0  (lo0)   127.0.0.1/8    loopback    up
ppp0 (ppp0)  YY.YY.YY.YY/16 point2point up

# netstat -rn
Destination  Gateway      Flags  Refs  Use  Netif Expire
default      XX.XX.XX.XX  UGSc      7   16   ppp0
XX.XX.XX.XX  YY.YY.YY.YY  UH        8    0   ppp0

Here the second route can be matched up immediately with the ppp0 device,
because the YY.YY.YY.YY gateway address matches the YY.YY.YY.YY/16 IP and mask
of ppp0. But the first route (default) needs to go through the second route in
order to find its interface. So we don't reject the default route immediately,
but save it an try to match it with an interface after all routes have been
found. See http://seclists.org/nmap-dev/2008/q4/0576.html for more information.
2009-01-01 19:29:44 +00:00
david
9f7cffc025 Refactor getsysroutes. It had two ways to get routes: by reading
/proc/net/route and with libdnet. I split those into two separate functions.
2009-01-01 16:45:55 +00:00
fyodor
516a8ddd0c proofreading from Raul Siles 2008-12-31 22:22:12 +00:00
david
3414659676 Give TCP probes that result in a filtered state a lower rank. When a TCP gets a
positive response that results in being marked filtered, the reply was an ICMP
error. Such probes are now ranked a 2 along with UDP, IP proto, and other
probes that get ICMP replies that are likely to be rate limited. Previously
they got the highest rank, 6, because they were TCP probes other than SYN to an
open port. SYN to an open port retains its rank of 3.
2008-12-30 23:45:28 +00:00
david
7261608125 Update the German Zenmap translation by Chris Leick. Debian bug #510158. 2008-12-30 19:46:17 +00:00
batrick
1a22089dd0 Changed nil or none to be acceptable for the first value of the try function. 2008-12-30 06:56:44 +00:00
kris
5e28ad96d4 Adding nsi_set_debug() to Nsock to enable socket debugging (SO_DEBUG) 2008-12-30 01:23:49 +00:00
batrick
3016193c11 Improvements to the nmap library. See [1] for discussion and a full listing of
the changes.

[1] http://seclists.org/nmap-dev/2008/q4/0663.html
2008-12-29 21:59:08 +00:00
jah
3fb2b96f78 Fix a couple of typos in openssl.luadoc:
Descrypt -> Decrypt
encrypt  -> decrypt
2008-12-29 18:28:45 +00:00
david
9b82189c39 Make the documentation for nmap.new_try more clear on a suggestion by Patrick. 2008-12-29 04:08:43 +00:00
david
bc32baff98 Destroy connect scan probes that aren't otherwise handled (thereby closing the
socket). It's possible to get an EHOSTUNREACH or EHOSTDOWN (and possibly other
errors) against a nonexistent LAN host and formerly the socket wasn't closed.
This allowed Nmap's internal count of sockets to be less that the true count of
open sockets. It would eventually try to open too many sockets and quit with
the message

Socket creation in sendConnectScanProbe: Too many open files (24)

Be aware that in this message 24 is the errno, not the number of open files.
2008-12-26 22:26:17 +00:00
ron
67f9577de9 No longer erroring if a server leaves out the 'domain' section of packets (some configurations of Samba seem to do this) 2008-12-24 20:36:30 +00:00
batrick
38394e9f24 Corrected an output line that Ron left in from a patch I gave him.
The script's filename cannot be acessed when a thread's target times out
because we do not have access to the thread's environment when it is yielded.
All we can do is print out which target timed out. This output can
unfortunately be printed out many times for each thread (it is currently
difficult to track).
2008-12-24 08:40:03 +00:00
ron
1c08d02689 Updated the output section for smb-enum-processes.nse 2008-12-24 00:58:52 +00:00
ron
773000b65a Merging changes from my experimental branch; the new versions of this scripts, which have significant changes to their core functionality, managed to hold their own against Brandon's network. More testing would be very helpful, though, especially with credentials (most of Brandon's scans were anonymous). 2008-12-24 00:53:01 +00:00
david
a246aaf469 Only increase max_successful_tryno when we have a positive response to a probe;
i.e., the probe didn't just time out. This was the case before r11253 when I
mistakenly removed it. I meant only to allow ultrascan_adjust_timing to be
called when rcvdtime == NULL, but as a side effect I also allowed
max_successful_tryno to increase in that case too. I was able to get that bit
of code to run with rcvdtime == NULL in a normal scan, but I don't think it
happens often.

I also improved the comments in that block of code.
2008-12-23 02:29:04 +00:00
kris
8eb6313aa2 updating ip_is_reserved(): 108/8 and 184/8 allocated 2008-12-22 18:17:34 +00:00