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

97 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
david
ca5254f990 Fix a memory leak in OS detection. When detection ran for more than one
round, fingerprint test results were being leaked in between rounds.
2010-09-23 06:00:40 +00:00
david
235dab9f24 Fix an array allocation; we were allocating a multiple of the size of a
struct, not the size of a pointer to it. Over-allocating did no harm
beyond wasting some memory.
2010-09-23 05:58:39 +00:00
david
45468ba2a0 Fix compiler warnings seen on OpenBSD. 2010-08-02 20:30:29 +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
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
7db7da0007 Merge again from /nmap-exp/david/nmap-mem; this fixes a couple of bugs. 2009-12-20 03:22:19 +00:00
david
1c6030709b Revert r16307:16309, the merge from nmap-mem. I just found a
segmentation fault which I am investigating.
2009-12-19 22:49:16 +00:00
david
b838242e01 Merge from /nmap-exp/david/nmap-mem. This brings in two memory-reducing
changes. The first is that Port objects don't allocate memory for
service and RPC results unless that information is set. This reduces the
size of a bare Port from 92 to 40 bytes on my machine. The second change
is that PortList now has the notion of a "default port state," which is
the state of any ports that didn't receive a response. These ports don't
need an allocated Port object, which saves a lot of memory in scans
where most ports didn't get a response.
2009-12-19 21:26:14 +00:00
fyodor
543c5408b6 add a missing newline to a warning message 2009-11-23 23:30:36 +00:00
david
a06b900f00 Merge from /nmap-exp/david/nmap-mem. This reduces the memory usage of OS
scan by about 95%. (66832396 bytes to 2815061 bytes according to
Massif.)
2009-11-23 21:22:07 +00:00
david
ddc1b9b2d1 Fix a little memory leak in the handling of OPS and WIN responses.
FingerTest structures are supposed to have an array of AVals that are
allocated as a block and linked internally. But for OPS and WIN, each
AVal was allocated individually and linked together. When the FingerTest
was later freed, it freed only the first link in the chain.
2009-11-23 16:51:42 +00:00
david
b40356ed3f Fixed an integer overflow that could occur when a target with a low
TCP timestamp clock frequency uses large timestamp values, such that
a naive uptime calculation shows a boot time before the epoch. Also
fixed a printf format specifier mismatch that was revealed by the
overflow. Toby Simmons reported the problem and helped with the fix.
2009-09-10 18:03:18 +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
eac15cb919 Apply a patch by Dmitry Levin that uses a network interface's full name,
including alias extension, in several places to avoid this error message
when an alias has an IP address but the primary interface doesn't:
Failed to lookup subnet/netmask for device (venet0): venet0: no IPv4 address assigned
The patch also considers an interface alias if the primary interface
does not appear in the list of interfaces (perhaps because it does not
have an IP address assigned) when building the table of routes.
2009-07-27 19:01:58 +00:00
david
a4c92f83e7 Use the preprocessor defines IP_DF and IP_OFFMASK instead of literal
0x4000 and 8191.
2009-07-03 18:11:15 +00:00
daniel
da6cb1d19e o [Nbase] The checksum functions now have an nbase_ prefix. This
should prevent name collisions with internal but exported functions
  in shared libraries Nmap links against (e.g. adler32() in zlib).
  Such collisions seem to confuse the runtime linker on some platforms.
  [Daniel Roethlisberger]
2009-04-16 09:38:13 +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
24fbedd748 Changed two OS scan error() calls to LOG_STDOUT instead. They aren't
errors and having them go to STDERR could be confusing.
2009-04-08 01:14:48 +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
e9d7cab6ef The following OS detection tests are no longer included in OS
fingerprints: U1.RUL, U1.TOS, IE.DLI, IE.SI, and IE.TOSI. URL, DLI,
and SI were found not be helpful in distinguishing operating systems
because they didn't vary. TOS and TOSI were disabled in 4.85BETA1
but now they are not included in prints at all.
2009-03-27 23:07:08 +00:00
david
4d73305a5a Add a fix in the calculation of the SEQ.CI test submitted by Guillaume
Prigent. The CI samples could sometimes be written into the TI array.
This would happen if there were any holes in the original CI array.
2009-03-26 14:28:53 +00:00
david
3af559b852 Only print the "insufficient responses for TCP sequencing" if at least one
response was received, not zero. Because four responses are sufficient, the
message will be printed if one, two, or three reponses were received. The
message started being printed with zero responses in r12285, with an unrelated
change.

The message also now includes the IP address of the relevant host and requires
debugging to be enabled.
2009-03-24 21:04:37 +00:00
david
aa97b79e4c Fix a little error in a comment: We decided to call the closed-port TCP IP ID
test CI, not CTI.
2009-02-25 00:40:47 +00:00
david
b230f7168c Merge from /nmap-exp/david/nmap-closed-ipid.
This adds a new SEQ.CI OS detection test. It is based on the IP IDs of the
responses to the three probes sent to a closed port: T5, T6, and T7. This has
been reported to differ from TI and was observed to do so in Internet scans
using the nmap-closed-ipid branch.
2009-02-25 00:30:40 +00:00
david
588d629a6a Copy the Subversion properties from osscan.cc to osscan2.cc. None were set on
osscan2.cc. I think osscan2.cc wasn't updating its $Id$ because it didn't have
the svn:keywords property set.
2009-02-24 22:04:54 +00:00
david
f5fb0fd691 Try fixing the $Id: $ line in osscan2.cc. It's not updating itself, perhaps
because it had the file name osscan.cc inside it.
2009-02-24 21:58:34 +00:00
david
ade608c766 Factor out a couple of essentially identical switch statements that filled in
the TCP/ICMP IP ID sequence generation class.
2009-02-24 21:53:40 +00:00
david
f9f928e9ce OS fingerprints now include the SEQ.II test (ICMP IP ID sequence
generation) even if there are no other SEQ test results. Try it with
"nmap -O -d -p 113 scanme.nmap.org". Now you get SEQ(II=I) instead of no
SEQ line at all.
2009-02-24 21:08:38 +00:00
fyodor
9ede137210 rename crc16 function in nbase to crc32, as that seems to be what it actually is. Also change osscan2.cc to call it by the new name. Thsi fix was suggested by Marc Bevand 2009-02-24 02:01:03 +00:00
david
dbb6464deb Fill in the destination MAC address before each probe sent in OS scan.
This fixes the following bug: When scanning with an Ethernet handle (as
opposed to raw sockets), only the first host in an OS scan group would
get a result. All others would be blank fingerprints with R=N for every
probe. This was first noticed on Windows because Ethernet is the default
sending method, but it affects other platforms with --send-eth.

OS scan initialized an Ethernet handle once for each group, and recorded
the first-hop MAC address of the first target at that time. That
first-hop address was used for all targets. This failed on a switched
LAN, when the first-hop address for every host is different (it's the
MAC address of each target).

All the various high-level probe sending functions now do their work
through three low-level sending functions: one each for TCP, UDP, and
ICMP. Those low-level functions take care of setting the MAC addresses
before each send.

I checked and the other places where Ethernet sends are used do not have
this problem. ultra_scan, idle scan, and traceroute all set the
addresses before every send.
2008-12-19 19:54:06 +00:00
david
b4dbc10f0c Rename the function send_closedudp_probe_2 to send_closedudp_probe (lose the _2
suffix). It was named this was to avoid a name conflict with first-gen OS
detection, which isn't a problem now.
2008-12-19 18:39:29 +00:00
david
fc9290d734 Remove the unused seq_info array from HostOsScanInfo. That information is kept
in a variable in HostOsScanStats and reinitialized for each scan round. The two
variables had the same name (si) and it was confusing.
2008-12-19 17:59:01 +00:00
david
eb7fda541e Fix global congestion control in OS scan.
Like ultra_scan, OS scan has global and host-based congestion control
mechanisms like those in TCP. Part of global congestion control is
keeping track of how many probes are outstanding in the network; OS scan
keeps the number in a member variable called num_probes_active.

num_probes_active is meant to be the sum of the sizes of each host's
list of outstanding probes. It was correctly being decremented whenever
a probe was removed from an active list, but it was never incremented.
num_probes_active was always zero or negative, and therefore never
exceeded the global congestion window. This almost completely disabled
global congestion control.

With this fix OS scan will send a maximum of ten probes immediately at
the beginning of the scan. Previously it was limited only by the number
of hosts being scanned (20 or 30).
2008-12-18 04:49:49 +00:00
david
9a37ef907f Remove some unused OS scan performance variables. 2008-12-18 04:27:28 +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
a4f6dc6b6e Merge from /nmap-exp/david/nmap-os.
This brings in four discrete changes:

1. The widening of ranges for T test expressions in nmap-os-db. Any expressions
   that were not already ranges were expanded to cover plus and minus five of
   their original values.
2. The normalization of TG expressions in nmap-os-db. Nmap is only capable of
   outputting 0x20, 0x40, 0x80, and 0xFF for a TG value, but many fingerprints
   had values other than these. They have all been rounded to their nearest
   likely value.
3. The elimination of the U1.TOS and IE.TOSI tests (both having to do with type
   of service). This was effected by setting their MatchPoints to 0.
4. A cleanup and refactoring of OS fingerprint output code. This should not
   have any impact on output, except in one case: when debugging is non-zero or
   verbosity is greater than one, and at least one perfect match was found,
   Nmap used to print "OS Fingerprint:" before the fingerprint. Now it prints
   "TCP/IP fingerprint:" in this case like in all the others.
2008-10-31 22:46:07 +00:00
fyodor
2c650269ec o Fixed a bug which caused Nmap to infer an improper distance against
some hosts when performaing OS detection against a group whose
  distance varies between members. [David, Fyodor]
2008-10-17 21:20:52 +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
47bc9d4c4f Fixing more bugs reported by Ilja, mostly bounds checking 2008-06-14 06:59:11 +00:00
michael
6692822a34 The information pretaining to the U1.RID probe for OS scans wasnt being properly converted to/from network byte order. This has resulted in several erronious entries in nmap-os-db and the failure of OS scan to perfectly detect some hosts (most of them are printers). 2008-05-31 01:41:13 +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
d5f3f3610e improve the tcp options comment even more to ensure is inline with tcp options actually used 2008-03-13 05:34:17 +00:00
fyodor
a71b4d2528 update a comment which lists tcp options used in os scan 2008-03-13 05:25:54 +00:00
fyodor
1accc12fb2 fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00