1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00
Commit Graph

94 Commits

Author SHA1 Message Date
fyodor
86e59a8c4e Update copyright statements from 2010 to 2011 2011-01-21 00:04:16 +00:00
david
7653cf7d4a Move COPYING.OpenSSL to OpenSSL.txt, update copyright notices to match. 2010-10-30 03:01:50 +00:00
batrick
0f8dcc1766 typo 2010-09-10 21:45:44 +00:00
david
7cf99e1e4e Use a std::vector<bool> instead of std::bitset in traceroute.cc. bitset isn't
available on Android.
2010-08-15 03:40:54 +00:00
luis
da126c8b78 Merged nmap-dedup branch from nmap-exp/luis/nmap-dedup. This completes the Nmap/Nping code de-duplication phase. 2010-06-22 17:24:34 +00:00
fyodor
1aecac420f Update copyright year from 2009 to 2010 2010-05-03 21:20:25 +00:00
david
2684b78ce5 In traceroute, separate the directly connected targets from the rest
before starting. There is a special function that does a trace of
directly connected targets without sending any packets, just by filling
in one hop directly to the target. The traceroute code was only checking
whether the first target in the group was directly connected, and if it
was, it assumed all of them were. Now it filters the list into two and
calls traceroute_direct on one and traceroute_remote on the other.
Fyodor discovered this problem today.
2010-03-23 23:30:36 +00:00
david
f21a07cfde Revert r16464. 2010-01-15 03:55:23 +00:00
david
c73b250615 Factor out a function that reports the failure to open an Ethernet
device and exits. On Windows, print a hint about "net start npf" to
start the NPF service.
2010-01-15 00:37:39 +00:00
david
9b468484c2 o Fixed a bug in traceroute that could lead to a crash:
terminate called after throwing an instance of 'std::out_of_range'
      what():  bitset::test
  It happened when the preliminary distance guess for a target was
  greater than 30, the size of an internal data structure. David and
  Brandon tracked down the problem.
2010-01-14 01:07:49 +00:00
david
5c2eb72454 Allow traceroute to affect host timing stats. 2009-11-16 08:46:11 +00:00
david
31d2c497fa Give Probe a virtual destructor because it is deleted through pointers
that point to instances of subclasses (TCPProbe etc.).
2009-09-27 18:29:20 +00:00
david
67ab4c0208 Fix the initialization of sockaddr_in structures in traceroute name
resolution. The initialization
    struct sockaddr_in sin = { AF_INET };
didn't set sin.sin_family correctly, leading to a later assertion
failure:
Failed to convert target address to presentation format!?! Error: Address family not supported by protocol family
2009-09-27 18:08:42 +00:00
david
8fd7a0a46b Always begin with a TTL of at least 1 in traceroute, even if OS
detection calculated 0 (erroneous if not localhost). This caused an
assertion failure reported by Chris Clements in
http://seclists.org/nmap-dev/2009/q3/1054.html.
2009-09-27 18:05:16 +00:00
david
275a346804 Add a BPF filter to traceroute so we only get packets sent to our own
source address; i.e., not the packets we send.
2009-09-17 22:50:09 +00:00
david
06cc9ad4d1 Add a special-case no-probe traceroute for directly connected targets. 2009-09-17 15:03:13 +00:00
david
875dcddd2c Merge r15496:15502 from /nmap-exp/david/nmap-traceroute. These are some
minor traceroute performance optimizations.
2009-09-17 02:22:15 +00:00
david
577a1be0e7 Merge from svn://svn.insecure.org/nmap-exp/david/nmap-traceroute. This
brings in a new, faster, parallel version of traceroute.
2009-09-17 00:03:46 +00:00
david
45533e5972 Don't dereference a null pointer when printing out a traceroute error
message. The dereferencing could not actually happen because it would
only happen with a trace of zero hops with no probes sent, and in that
case we skip the traceroute entirely. Patch by Ankur Nandwani.
2009-09-07 22:04:10 +00:00
david
d254c85b42 Fix XML traceroute output. I accidentally left in one part of the old
stateful TraceProbes design, which was otherwise removed in r15197.
2009-08-26 23:49:20 +00:00
david
4c6bafb3fa o There is a new OS detection pseudo-test, SCAN.DC, which records how
the network distance in SCAN.DS was calculated. Its value can be "L"
  for localhost, "D" for a direct connection, "I" for an ICMP TTL
  calculation, and "T" for a traceroute hop count. This is mainly for
  the benefit of OS integration, when it is sometimes important to
  distinguish between DS=1%DC=I (probably the result of forged TTLs)
  and DS=1%DC=D (a true one-hop connection.) [David]
2009-08-23 23:58:28 +00:00
david
b64134be14 Make the TraceGroup::consolidateHops method const. 2009-08-21 01:06:49 +00:00
david
a4ea6d2f7c The previous method of calculating the true hop distance from traceroute
was incorrect; the hopDistance member can be much higher than the actual
number of hops recorded. It was 33 when the real distance was 17.
Instead, enumerate and count all the probes that got a response.
2009-08-21 01:05:41 +00:00
david
5d29abaf05 Change a confusing design in traceroute. The TraceProbes map is a
mapping from source port number to probes. Upon output, the map was
transformed in place to a map of TTL values to probes. Operations that
worked before output wouldn't work after output and vice versa. Now the
TTL-to-probe map is kept separate in a local variable.
2009-08-21 01:01:34 +00:00
david
5c1168c024 After a successful traceroute, set the distance to the host in question
so it appears in OS fingerprints.
2009-08-20 20:57:35 +00:00
david
0ffa072a6b Fix an off-by-one error in traceroute consolidation. In debugging mode,
the list of consolidated hops (the ones that match the reference trace)
was printed out one hop further than it should have been. So if a trace
diverged from the reference trace at the sixth hop, it would print out
the first six hops of the reference trace when it should have done only
five. This extra row, as well as being incorrect, could cause an
assertion failure by making the output table one row bigger than its
preallocated capacity.
2009-08-20 19:52:17 +00:00
david
c3b5c08941 Temporarily increase the size of the traceroute output table by 1 until
I can find the bug that causes too many rows to be printed in debugging
mode in some cases. I get an assertion failure when running
	nmap scanme.nmap.org/26 --top-ports 10 --traceroute -n -d
With this change, the bug manifests itself as some peculiar output:

4   --        66.54.149.185
5   --        63.211.250.17
5   39.17 ms  63.211.250.17
6   47.12 ms  4.68.107.190
7   39.72 ms  4.69.132.37

(Note the doubled 5 with the same IP address.)

10  --        207.88.13.122
11  --        207.88.12.46
12  --        207.88.12.61
13  --        65.106.1.57
13  100.77 ms 65.106.1.65
14  91.75 ms  65.106.5.162

(Note the doubled 13 with a different IP address.)

4   --       66.54.149.185
5   --       63.211.250.17
5   ...
6   39.32 ms 4.68.107.190

(Note the doubled 5 with a timeout.)
2009-08-20 18:22:31 +00:00
david
9cff9beb20 Remove the G_ALIVE_TTL traceroute probe state. It was mostly synonymous
with G_DEAD_TTL. I couldn't figure out that the difference was supposed
to be.
2009-08-19 23:07:43 +00:00
david
86b0100dc3 Fix a bug I just introduced in tracerotue.cc: I moved a loop
initialization into the loop header but messed it up so the loop
variable wasn't initialized.
2009-08-19 21:57:58 +00:00
david
c6be484bdf Some more whitespace fixes in traceroute.cc. 2009-08-19 21:37:43 +00:00
david
295b4142e9 Use the dnet.h defiens for ICMP types and codes instead of having ad-hoc
defines in traceroute.h.
2009-08-19 21:26:53 +00:00
david
5371550a75 Move some functions from traceroute.h into traceroute.cc so they can be
easily referenced while looking at the code that uses them.
2009-08-19 21:04:40 +00:00
david
43acb0eab8 Normalize whitespace in traceroute.cc. 2009-08-19 20:14:54 +00:00
david
1a3b7c1360 Bail out of traceroute if the initial TTL guess probe is not responded
to. Currently continuing from there leads to pathological behavior where
every hop up to 50 is tried, taking a very long time.
2009-08-06 18:47:10 +00:00
david
960e60c89a Use sizeof to get buffer sizes for Snprintf in traceroute.cc instead of
using magic constants.
2009-08-06 18:02:25 +00:00
david
fc061a79ba Add " ms" to the times in the RTT column in traceroute output. 2009-08-06 17:58:55 +00:00
david
8c9b905682 Fix o.current_scantype management for traceroute. If you were scanning
only one host it used to be unset, so the ScanProgressMeter would say
"Host Discovery" or something rather than "Traceroute".
2009-07-29 16:20:07 +00:00
david
47bbcc165f Use ICMP echo for traceroute if no other responsive probe is known. This
can happen with -PN against a filtered host or with -PN -sP against any
host.

This works as expected when the remote host actually responds to the
ping probes, but takes a long time when the remote host ignores it. Take
this for example:

nmap -PN -sP --traceroute www.microsoft.com -n
TRACEROUTE (using proto 1/icmp)
HOP RTT   ADDRESS
1   0.77  192.168.0.1
2   38.76 206.81.73.81
3   38.65 206.81.73.82
4   39.28 66.54.149.185
5   39.73 63.211.250.17
6   39.15 4.68.107.190
7   40.05 4.69.132.37
8   59.33 4.69.132.106
9   54.55 4.69.145.208
10  ...
11  ...
    [Lots more lines]
49  ...
50  ...
! maximum TTL reached (50)
Nmap done: 1 IP address (1 host up) scanned in 2201.79 seconds

The traceroute can't stop, as it normally does, when it gets a response
from the target because no such response is forthcoming. So it keeps
going until it hits its own limit. The same trace against www.google.com
takes only about 30 seconds.
2009-07-29 16:06:03 +00:00
david
f39df29350 Update an obsolete traceroute comment and fix some indentation. 2009-07-29 01:29:55 +00:00
david
35d74be01d Remove a constant printf string substitution. 2009-07-17 23:43:37 +00:00
daniel
50830f7488 o Added initial SCTP port scanning support to Nmap. SCTP is
a layer 4 protocol used mostly for telephony related applications.
  This brings the following new features:
  o SCTP INIT chunk port scan (-sY): open ports return an INIT-ACK
    chunk, closed ones an ABORT chunk.  This is the SCTP equivalent
    of a TCP SYN stealth scan.
  o SCTP COOKIE-ECHO chunk port scan (-sZ): open ports are silent,
    closed ports return an ABORT chunk.
  o SCTP INIT chunk ping probes (-PY): host discovery using SCTP
    INIT chunk packets.
  o SCTP-specific IP protocol scan (-sO -p sctp).
  o SCTP-specific traceroute support (--traceroute).
  o The ability to use the deprecated Adler32 algorithm as specified
    in RFC 2960 instead of CRC32C from RFC 4960 (--adler32).
  o 42 well-known SCTP ports were added to the nmap-services file.
  Part of the work on SCTP support was kindly sponsored by
  Compass Security AG, Switzerland.  [Daniel Roethlisberger]
2009-06-03 23:15:45 +00:00
fyodor
d0e21e1d03 Suggest that people send patches to nmap-dev rather than to me directly 2009-04-15 00:37:03 +00:00
bmenrigh
b38b5f6270 Changed a few error() calls to log_write(). Removed the (redundant)
"\n" from a few error() calls.  Changed a few f?printf() calls to
error() or log_write().

Most notably, I didn't change any of the --interactive printf()s or
the usage printf() call.

I think we should draw up some internal notes on when to use
LOG_STDOUT versus LOG_PLAIN versus all the other LOG_* options.
2009-04-07 23:10:51 +00:00
fyodor
eccc235d5a Increase copyright year to 2009, simplify/reword some derivative works text, and remove a confusing clause about selling proprietary front-ends to Nmap 2009-03-31 04:16:12 +00:00
david
4ff30d9b99 Show a warning whenever raw socket sending is attempted on Windows--not just
when using --send-ip.
2008-11-24 17:52:25 +00:00
david
40d78569d2 Use the cached timing ping probe as the traceroute probe in all situations. 2008-09-06 04:12:34 +00:00
kris
789906f3a8 o Added IPProto Ping (-PO) support to Traceroute, and fixed support for
IPProto Scan (-sO) and the ICMP Pings (-PE, -PP, -PM) in Traceroute
  as well.  These would cause Nmap to hang during Traceroute. [Kris]
2008-08-14 17:53:23 +00:00
kris
83ed199791 Adding packet validity checking to readip_pcap() so the caller can assume the
packet is OK from the get-go rather than running basic checks of it's own.

In a nutshell this patch checks to make sure:

1) there is enough room for an IP header in the amount of bytes read
2) the IP version number is correct
3) the IP length fields are at least as big as the standard header
4) the IP packet received isn't a fragment, or is the initial fragment
5) that next level headers seem reasonable

For TCP, this checks that there is enough room for the header in the number
of bytes read, and that any option lengths are correct.  The options checked
are MSS, WScale, SackOK, Sack, and Timestamp.

This also fixes a bug I discovered while testing.  Since the Ethernet CRC
(and other datalink-layer data) could be read and counted, it was being
returned that there was more IP packet than there really was.  This didn't
cause an overrun of the buffer or anything, just that garbage data could have
easily been read instead of real packet data.  Now, if validity is checked for
and the number of total bytes read is larger than the IP's length, the length
is set to the IP header's total length field.

This seems to work great after doing what testing I could.  It's been out on
nmap-dev for a couple of weeks without any bad reports (none at all for that
matter).  I reviewed this patch again before committing and it looks good as
well.
2008-06-30 23:55:19 +00:00
kris
3dc65c8b2c o Fixed several byte-order bugs in Traceroute. [Kris] 2008-06-14 07:06:12 +00:00
kris
47bc9d4c4f Fixing more bugs reported by Ilja, mostly bounds checking 2008-06-14 06:59:11 +00:00