1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 05:01:29 +00:00
Commit Graph

305 Commits

Author SHA1 Message Date
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
david
637ba35a28 Count an ACK right after counting a drop for a retransmitted reply.
We count a drop for congestion control purposes if we receive a response
to a retransmitted probe, because that means that the reply to the
original probe was dropped. However, we weren't taking into account that
we are at the same time receiving a positive response, and should
increase the window accordingly. There are now three things that can
happen:

Response to first probe:	ACK
Response to retransmission:	DROP, then ACK
Probe timeout:			DROP
2011-12-31 21:59:58 +00:00
david
8ba1cf6b15 Factor out timing ack and drop code. 2011-12-31 21:59:57 +00:00
david
e962f1c5fe Centralize initialization of scan_performance_vars. 2011-12-31 21:59:52 +00:00
david
b04380207a Move most of ultra_scan_performance_vars to global_structures.h. 2011-12-31 21:59:50 +00:00
david
8e63481a5d Move ultra_timing_vals to global_structures.h. 2011-12-31 21:59:48 +00:00
david
2caebcda8e Add a missing factor of USI->perf.ca_incr to host cwnd updates.
USI->perf.ca_incr is either 1 or 2 (2 with -T4 or greater).
2011-12-31 21:59:46 +00:00
david
cfa3e3e8c2 Typo. 2011-12-31 21:59:45 +00:00
david
fee764a5d8 Use a special struct_ip.h to include <netinet/ip.h> and accoutrements.
The comment in struct_ip.h explains the reasoning for this. The AIX C library
uses #defines that change the names of members of struct ip, and conflict with
some existing code. (Notably struct ip_hdr in libdnet and IPv4Header::h in
libnetutil.) We can still use the AIX files if we include <netinet/ip.h> after
this other code has been preprocessed. That's hard to enforce when
<netinet/ip.h> is included from another header file; this new file allows
including it always late, and only where needed.
2011-09-21 07:31:38 +00:00
david
f41753c4e9 Add a sockaddr dst argument to send_ip function that use raw sockets.
Heretofore we have always extracted teh destination address directly
from the packet contents. But the raw packet bytes do not contain enough
information in one case: IPv6 link-local addresses. For those we really
need the scope ID, and for that we must pass this information all the
way down.

Before this, I got "no route to host" on OS link-local addresses. I
think that it was working on Linux only on accident, by the OS picking a
default interface or something.
2011-09-19 16:13:35 +00:00
david
77d3994bc8 Count ND probes in UltraScan::numProbesPerHost.
Now it shows
	Scanning 2 hosts [1 port/host]
instead of
	Scanning 2 hosts [0 ports/host]
2011-08-30 23:55:12 +00:00
david
3b500dc8df Remove these condition on probe matching:
A RST/ACK can only be matched to a SYN or FIN. A bare RST cannot
	be matched to a SYN or FIN.

Matthew Stickney and Joe McEachern found cases where this caused replies
to be missed (specifically, RST/ACK in reponse to a NULL probe) and also
found standards justification for hosts returning RST/ACK in such a
situation.
2011-08-25 05:35:03 +00:00
david
6cf428d8c6 Fix some "and" -> "&&". 2011-07-19 23:42:33 +00:00
weilin
1dcf652410 Added ND ping for local IPv6 nets, merging from /nmap-exp/weilin/nmap-nd. 2011-07-19 02:31:54 +00:00
david
092772e1b5 Use ipv6_get_data_any and ip_get_data_any when parsing -sO packets.
Restore error checking.
2011-06-17 05:47:34 +00:00
david
332c93ea07 Correctly update datalen when getting IP data.
We were instead updating the value of an unused temporary variable. This
caused encapsulated data to appear longer than it was.
2011-06-17 05:47:32 +00:00
david
08faad4ca5 Remove [-Wunused-but-set-variable] warnings from scan_engine.cc. 2011-06-17 03:21:54 +00:00
david
2c3bf07b60 Whitespace and formatting in build_protoscan_packet. 2011-06-17 02:47:07 +00:00
david
1f58263afa Factor out build_protoscan_packet.
This removes some inline complexity from sendIPScanProbe.
2011-06-17 02:47:07 +00:00
david
a31a41e770 Interpret ICMPv6 Parameter Problem responses. 2011-06-14 19:46:53 +00:00
david
223d45c435 Isolate the test for valid encapsulated ICMPv6 data to those protocols
that need it.

We need to accept invalid encapsulated data for protocol scan responses.
2011-06-14 19:46:51 +00:00
david
a67eca0555 Allow sending -6 -sO probes. 2011-06-14 19:46:48 +00:00