1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 20:51:30 +00:00
Commit Graph

426 Commits

Author SHA1 Message Date
d33tah
e35d0a0c23 Add a comment to explain numIncompleteHostsLessThan. 2014-01-27 00:44:16 +00:00
d33tah
4816358475 Replace all tab characters at the beginnings of lines with 8 spaces.
Mixed indentation annoyed my vim.
2014-01-05 19:14:26 +00:00
d33tah
36fc84ab31 Fix coding style - only run begin_sniffer in case of a raw scan. 2013-12-30 18:56:43 +00:00
dmiller
228f0bec77 Fix ICMPv6 assertion failure: http://seclists.org/nmap-dev/2013/q4/290 2013-12-17 14:10:49 +00:00
dmiller
26665465c6 Refactor ftp bounce scan into nmap_ftp.{h,cc}
By factoring this code out, we make it easier to convert to NSE.
http://seclists.org/nmap-dev/2013/q4/255
2013-12-11 02:23:58 +00:00
jah
d0a95fe03e determineScanGroupSize could cause a higher number of randomly generated hosts
to be scanned than was requested with -iR N (for 0 < N < 16) because it didn't
account for max_ips_to_scan.
2013-11-26 00:11:09 +00:00
dmiller
ff7a0ea10d Avoid runtime undefinedness due to integer overflow
Using TIMEVAL_MSEC_SUBTRACT can lead to integer overflow when the times
are far apart (such as epoch (0) or uninitialized timeval and "now").
Instead, calculate the "deadline" and use TIMEVAL_AFTER to test.
2013-11-25 18:35:48 +00:00
dmiller
c1c659568e Fix divide-by-zero in scan_engine.cc 2013-11-21 23:30:03 +00:00
david
5df0e13ee2 Use 32-bit values, not 16, for IP ID values.
IP ID fields are overloaded to include the flow label of IPv6 packets.
In particular, abstract_ip_hdr is no longer limited to 16 bits.
2013-10-27 06:33:45 +00:00
d33tah
ccd0c02a4c Add a lacking space in the license comment. The command I used to do this is:
for file in `grep "* including the terms and conditions of this license text as well.       \*" * -r --files-with-match `; do sed "s/\* including the terms and conditions of this license text as well.       \*/* including the terms and conditions of this license text as well.        */g" -i $file; done
2013-09-11 19:06:20 +00:00
david
262c147308 Match icmpid in icmp_probe_match.
Remainder of Chris Johnson's patch from
http://seclists.org/nmap-dev/2013/q3/296.

Previously, Nmap could match replies that came in response to an
original probe, with one of the retransmissions of the probe. One effect
was that latency would be measured to be smaller than it should. Chris
Johnson summarized the problem and showed how to reproduce it at
http://seclists.org/nmap-dev/2013/q3/113.
2013-08-17 02:18:09 +00:00
david
4b47eae996 Store ICMP ID in ICMP probes.
Part of Chris Johnson's patch from
http://seclists.org/nmap-dev/2013/q3/296.
2013-08-17 02:18:07 +00:00
david
f49e3435f8 Factor out icmp_probe_match.
Part of Chris Johnson's patch from
http://seclists.org/nmap-dev/2013/q3/296.
2013-08-17 02:18:05 +00:00
fyodor
6e01ecd452 Update an email address, fix a typo, and slightly reword a sentence. 2013-07-30 00:02:00 +00:00
fyodor
83fb10ec56 Update the Nmap copyright/license files. This isn't the new Nmap Public Source License we've been discussing on the list, but rather just a 'quick patch' to hopefully prevent some of the abuse we've been seeing from companies lately. More details on the changes will be posted to the dev list. Also, the copyright year was updated to 2013 (which is the only change to Nsock license statements). 2013-07-28 22:05:05 +00:00
david
5ab1b23bf0 Fix address matching in -PY ping.
Patch by Marin Maržić.
http://seclists.org/nmap-dev/2013/q2/297
2013-05-17 07:56:51 +00:00
dmiller
43f5db6ce4 Handle ICMP Time Exceeded messages in scan engine
DiabloHorn on #nmap noticed that Nmap was ignoring ICMP Time Exceeded
messages while trying to map firewall rules using --ttl.
get_pcap_result() was handling ICMP type 3 (Destination Unreachable),
but not type 11 (Time Exceeded). Now ports that elicit this response
will be marked filtered (to be consistent with existing Connect scan
behavior) and will report time-exceeded from (IP) for the reason.

This was not a common issue, since host discovery already accounted for
it. Port scans would only be affected when skipping host discovery.
2013-03-28 21:11:45 +00:00
david
785855e3ac Limit maxSocketsAllowed to FD_SETSIZE.
At high scan rates, there was nothing to prevent trying to set or clear
socket descriptors above FD_SETSIZE, which is usually around 1024. I got
a reliable assertion failures with the command
	nmap -sT -p- --min-rate 100000 scanme.nmap.org
The problem only affected -sT scans. A similar protection was added to
Nsock in r15808.
2013-02-22 01:14:32 +00:00
david
630a6db051 Break up the maxSocketsAllowed assignment. 2013-02-22 01:14:32 +00:00
david
719017b003 Use CHECKED_FD_SET and CHECKED_FD_CLR in ultra_scan. 2013-02-22 00:45:58 +00:00
david
fd7cabf7db Remove some old Linux compatibility code from connect scan.
This code was quite old (dating from r854 in 2000) and may not serve a
purpose anymore. Let's try removing it.

Apart from being obsolete, the code had a race condition where the
connection could be closed with a RST before getpeername was called,
leading to a fatal error message.
2013-02-05 04:55:29 +00:00
david
51c7dc5b7f Increase the number of slack file descriptors in connect scan. 2013-01-21 04:36:03 +00:00
david
2a1abf7b84 Make some return values less confusing. 2013-01-20 12:12:29 +00:00
david
b1c4f7f012 Localize struct pingtech in scan_engine.cc. 2013-01-18 00:33:03 +00:00
fyodor
6a42ef47c0 Update the Nmap and Nsock source code headers to note new Nmap dev mailing list email address and a better URL for Nmap license. 2012-12-06 01:21:42 +00:00
david
7b18ea1bc0 Move win32_fatal_raw_sockets out of nmap_raw_socket.
For the same reason and with the same exception (nse_dnet.cc) as in
r30159.
2012-10-31 17:00:55 +00:00
david
03946ba2f5 Return -1 instead of calling pfatal in nmap_raw_socket.
There was one case where we previously didn't fatal, in nse_dnet.cc.
Move the fatal calls out of nmap_raw_socket and into the calling scope,
with the exception of the one in nse_dnet.cc.

The problem was reported by Rob Nicholls.
http://seclists.org/nmap-dev/2012/q4/186
2012-10-31 16:09:47 +00:00
david
03d4b03d2c Get rid of "using namespace std".
Importing the whole std namespace caused a problem with Clang and the
punning of bind and std::bind.

http://seclists.org/nmap-dev/2012/q4/58

The Web's opinion of "using namespace std" also seems to be more against
than for.
2012-10-11 04:45:50 +00:00
david
c5faae4b26 Call socket_bindtodevice for -sT scan. 2012-10-03 15:43:24 +00:00
david
a53e00afa1 Factor out an nmap_raw_socket function.
This does the common setup of a raw socket that we use everywhere.
2012-10-03 15:43:21 +00:00
david
832f815d33 Use smartly chosen destination ports instead of o.magic_port in -sO.
Using o.magic_port, which is usually used for our source address, or
otherwise is somewhat randomly generated, doesn't make sense here.
Instead, use the same destination ports that we use for host discovery:
80 for TCP and SCTP, and 40125 for UDP.

http://seclists.org/nmap-dev/2012/q3/663
2012-09-02 22:47:45 +00:00
david
f45f2f394e Ignore supposed replies with nonsense pingseq/tryno.
If we get a reply that doesn't pass the simple comparison using the
current value of USI->seqmask, then ignore it. Previously we emitted the
message "Bad Sequence number from host %s.\n" and allowed the reply to
match any probe. This only matters when using -g because otherwise we
encode that information in the source port. I think we have addressed
what was mentioned in the TODO comment in r15986. Allowing promiscuous
matching, as was done before, causes the same spurious closed port issue
that was addressed in r29686.
2012-08-28 14:29:23 +00:00
david
725692b744 Use an unsigned int for --max-retries and related values. 2012-08-28 14:29:11 +00:00
david
39f42ef6d9 Increase the base source port number on each run of ultra_scan.
Per-probe tryno and pingseq are encoded as offset from a the base source
port number. Previously this was fixed for all calls of ultra_scan,
which means that unrelated probes in different calls would use the same
source port number if they had the same tryno and pingseq. This could
cause erroneous results if a reply to a probe from a previous call was
delated and was received in the current call and interpreted as a legit
response.

This has no effect when o.magic_port_set is true (i.e., when -g or
--source-port is used).

http://seclists.org/nmap-dev/2012/q1/62
http://seclists.org/nmap-dev/2012/q3/589
2012-08-28 13:07:54 +00:00
david
5d809a2476 Call it base_portno instead of magic_portno. 2012-08-28 13:07:41 +00:00
david
bc029f9631 Use a stack variable for the main UltraScanInfo. 2012-08-28 12:17:17 +00:00
kroosec
acea14865e Removed unused UP_RPC UltraProbe probe type. 2012-08-17 18:49:10 +00:00
kroosec
9247295bfb Removing pos_scan from scan engine as it is not used anymore. 2012-08-17 18:33:07 +00:00
david
3e50107f23 Use less memory for ip_addr in port_reason.
This was a sockaddr_storage, which is 128 bytes. This is a lot for a
structure that is part of Port. It is now a union of sockaddr_in and
sockaddr_in6, which is 28 bytes. A new set_ip_addr method sets the union
from a sockaddr_storage, where plain assignment was used before.

The sockaddr_storage was introduced in r23778, the first big IPv6 merge.
2012-06-26 03:23:14 +00:00
david
42f71759c2 Use one, not two, spaces after "WARNING:".
There were more cases of one space than two.
2012-06-20 20:13:51 +00:00
david
c923483956 Formatting in scan_engine.cc.
astyle -a -p -H -s2 -m2 scan_engine.cc

With some manual correction.
2012-05-31 07:14:05 +00:00
david
ca7fb873b6 Improve the "Mismatch!!!!" error message to show the expected port number. 2012-04-15 00:23:57 +00:00
david
fd9260276c Don't set max parallelism when only --min-paralellism is given.
Setting --min-parallelism without also setting --max-parallelism would
force the max parallelism to the same value. So, for example,
--min-parallelism=1 would also limit the max parallelism to 1. This
patch, based on one by Chris Woodbury, allows the max parallelism to
rise above this minimum, up to the maximum defined by each scan phase.
2012-04-07 08:07:38 +00:00
david
6666c7ceaf Add PS_ICMPV6 to probespec2ascii and pspectype2ascii. 2012-03-27 20:33:53 +00:00
david
cde81f6fb4 Disambiguate another map from std::map. 2012-03-19 16:53:44 +00:00
david
59d472b232 Give a loacl variable better locality.
This was only used in an #ifdef LINUX, and gave a "set but not used"
warning on other platforms.
2012-03-19 02:17:12 +00:00
david
089d697e98 Whitespace. 2012-03-18 16:44:39 +00:00
fyodor
684f42c4ad One more adjustment to the license text. Notes that Zenmap, Ncat, and Nping use this license. Note that contributions made directly in the src repository are treated the same as those in the mailing list. 2012-03-01 06:53:35 +00:00
fyodor
e96a7b7b24 Update the headers for each code file. This updates code copyright dates to 2012, notes the awesome NSE in the list of technology, and slightly rewords the derivative works clarification 2012-03-01 06:32:23 +00:00
david
2461746840 Allow --min-rate to trump the built-in limit of 50 sends per wait. 2012-01-01 20:26:58 +00:00