1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-13 19:29:04 +00:00
Commit Graph

118 Commits

Author SHA1 Message Date
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
kris
44f6087b94 Merging changes from my vc2008-testing branch. This moves Windows development
to VC++2008.
2008-06-13 05:58:11 +00:00
michael
9f1c28ad9c This patch reorganizes the way ping probes are handled internally.
Previously the ping probe data structures were stored in NmapOps,
now they will be stored in the scan_lists struct. All other changes
auxiliary to this reorganization.
2008-05-29 07:49:37 +00:00
fyodor
779b96a197 trivial copyright text tweak: filename nmap-os-fingerprints has changed to nmap-os-db 2008-05-22 20:45:32 +00:00
fyodor
10b54b773b minor license template updates from Kris--fix gnu.org link to GPLv2 (moved) and openssl license filename (COPYING.OpenSSL) 2008-05-05 04:10:00 +00:00
fyodor
5551c5a311 o Fixed a bunch of code to avoid compilation warning messages (at
least on some Linux machines) [Andrew J. Bennieston]
2008-04-09 02:11:20 +00:00
fyodor
1accc12fb2 fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
kris
a02bf67a70 reordering UDP port selection for Traceroute: a closed port is now chosen before an open one. 2008-02-15 19:45:34 +00:00
fyodor
29c912f394 URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00
ejlbell
188442662d Traceroute bugfix for when the first hop of the first host in a tracegroup (reference trace) times out. The previous patch did not completely solve the issue due to an erronous check on the ttl, now we use a dedicated boolean flag. Thanks to Sebastián García for the bug report and testing. 2008-01-07 14:39:40 +00:00
fyodor
8220c8a42f update copyright line at the top of files from 1996-2006 to 1996-2008 2007-12-22 06:32:03 +00:00
kris
477214a779 Fixing another possible NULL dereference, in getTracePort() in traceroute.cc. Found with Coverity, CID 29 2007-11-16 03:45:03 +00:00
kris
ad7b6e416b This isn't fixing a bug; Coverity (CID 27) flagged this so I looked, and it doesn't make sense. Coverity saw that 'received' was tested again NULL, but was dereferenced afterwards with no check. So it should either be checked later, or not checked at all. Following timing.cc, and the fact that it isn't passed NULL anywhere, and because it doesn't make sense to pass 'adjustTimeouts' nothing to work with, I've just removed the check. Yeah, this log message is way longer than the patch is :). 2007-11-16 03:27:30 +00:00
kris
66064ad778 Fixing another possible NULL dereference, this time in readTraceResponses() in traceroute.cc. Any replies at all are apparently counted below this section of code, and there is no else case to go with this if and else if, so I figure I'll just let it go false so it goes along with any other abnormal responses. Found with Coverity, CID 28. 2007-11-16 03:14:59 +00:00
kris
01571cee00 fixing a bug in setState() in traceroute.cc. A || was used instead of && which caused it to always evaluate true -- Coverity CID 23 2007-11-15 22:25:00 +00:00
kris
1ba4d72254 fixing misspellings of "EXCEEDED" in comments and in the enum reason_codes (portreasons.h) 2007-11-05 13:04:23 +00:00
ejlbell
40e206a134 Assertion was triggered when the first hop of the reference trace timed out. The textual consolidation messages used the
hops ip address and if it timed out there was no address to use. Now the message uses the groups ip address instead as it will always be present no matter how many hops timeout.
2007-09-15 13:24:45 +00:00
ejlbell
817f8d9e52 Traceroute: remove empty timed out XML hop elements 2007-08-23 10:07:01 +00:00
kris
0b50c16b38 Adding Snprintf() and Vsnprintf() to nbase/nbase_str.c. This is because of Windows' stupid implementation where it doesn't write a NULL byte at the end of the buffer if the result is truncated. I would've just #defined snprintf and vsnprintf to some wrapper function for Windows, but this doesn't work as libdnet and libpcap (and libpcap includes under mswin32) define snprintf to _snprintf and vsnprintf to _vsnprintf like we do, and through the many defines they end up being available in the Nmap sources. Vsnprintf() uses vsnprintf() (and writes a NULL byte at the end if truncated), and Snprintf uses Vsnprintf(). 2007-08-14 06:46:54 +00:00
fyodor
010c733f50 merge soc07 r5083 - remove old traceroute consolidation examples from docs. The messages are now textual and self explanatory 2007-08-11 05:12:15 +00:00
fyodor
8a3b378695 merge soc07 r4947:4953 - os fingerprinting system improvements, trivial traceroute.cc grammar tweak 2007-08-11 04:29:03 +00:00
fyodor
ea68216d71 merge soc07 r4943:4947 - added textual information to traceroute's timeout consolidation elements; Reference trace consolidation is now displayed textually instead of symbolically. 2007-08-11 04:27:37 +00:00
fyodor
935b0b78e1 merge soc07 r4914 - dynamic rowed table improvements 2007-08-11 04:19:29 +00:00
fyodor
0b33c98ebb merge soc07 r4896 - Patch to make sure traceroute always displays the last hop, even if consolidation is total 2007-08-11 04:13:07 +00:00
fyodor
8d74bbcd8a merge soc07 r4871:4884 and r4888 - renaming __FUNCTION__ to __func__ and changing hardcoded func names to __func__ 2007-08-11 04:06:09 +00:00
fyodor
1540fe57c4 merge soc07 r4868:4871 - nmapoutputtable dynamic tables and traceroute fixes 2007-08-11 04:02:49 +00:00
fyodor
58522c59f6 merge soc07 r4822 - Reduce the number of build dependencies. 2007-08-11 03:35:46 +00:00