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

55 Commits

Author SHA1 Message Date
djalal
4ea062b1e3 Check if the added target is too long. Currently we are using std::string objects to store new targets but we want to make sure that the script is not adding long strings. 2011-04-03 14:38:34 +00:00
david
bf99fb231b Check that the argument to freeaddrinfo is not NULL. The behavior may be
unspecified and causes a segmentation fault on Android Bionic libc.
Vlatko fixed the bug in his Android binaries and it was first reported
by @alexismm2.
2011-02-15 08:19:58 +00:00
fyodor
86e59a8c4e Update copyright statements from 2010 to 2011 2011-01-21 00:04:16 +00:00
david
26636d3cf7 Remember the forward DNS name and non-scanned addresses for IPv6, just
as for IPv4. This makes the output more uniform and gives NSE access to
host.targetname for IPv6 hosts.

This is what IPv4 output looks like:

$ nmap -sL www.kame.net
Nmap scan report for www.kame.net (203.178.141.194)
rDNS record for 203.178.141.194: orange.kame.net
Nmap done: 1 IP address (0 hosts up) scanned in 0.16 seconds

$ nmap -sL www.debian.org
Nmap scan report for www.debian.org (128.31.0.51)
Other addresses for www.debian.org (not scanned): 206.12.19.7
rDNS record for 128.31.0.51: senfl.debian.org
Nmap done: 1 IP address (0 hosts up) scanned in 0.17 seconds

Here is the output before this change. Notice that the target name is
missing and there is no separate "rDNS" line.

$ nmap -6 -sL www.kame.net
Nmap scan report for 2001:200:dff:fff1:216:3eff:feb1:44d7
Nmap done: 1 IP address (0 hosts up) scanned in 0.04 seconds

$ nmap -6 -sL www.debian.org
Nmap scan report for bellini.debian.org (2607:f8f0:610:4000:211:25ff:fec4:5b28)
Nmap done: 1 IP address (0 hosts up) scanned in 0.11 seconds

Here is the output after this change:

$ ./nmap -6 -sL www.kame.net
Nmap scan report for www.kame.net (2001:200:dff:fff1:216:3eff:feb1:44d7)
Nmap done: 1 IP address (0 hosts up) scanned in 1.04 seconds

$ ./nmap -6 -sL www.debian.org
Nmap scan report for www.debian.org (2607:f8f0:610:4000:211:25ff:fec4:5b28)
rDNS record for 2607:f8f0:610:4000:211:25ff:fec4:5b28: bellini.debian.org
Nmap done: 1 IP address (0 hosts up) scanned in 0.07 seconds
2010-11-26 04:06:25 +00:00
david
7653cf7d4a Move COPYING.OpenSSL to OpenSSL.txt, update copyright notices to match. 2010-10-30 03:01:50 +00:00
djalal
73ca070916 Small change on code documentation. 2010-09-09 12:59:35 +00:00
djalal
d2773a09a7 Make NewTargets::push() return 1 if the target is already in the queue to avoid returning 0 (error code). 2010-09-09 12:56:43 +00:00
david
430a1287a6 Remove NOLUA guards around NewTargets code. This code compiles fine
--without-liblua.
2010-09-07 19:23:56 +00:00
djalal
4bec98f23f Small debug message improvements, to show if a new target was successfully added. 2010-09-06 21:02:38 +00:00
djalal
c9a756bc12 Clean debug messages and make debug level 3 the default debug level for the 'adding new targets' code. 2010-09-03 17:53:34 +00:00
djalal
c7c502b227 Merge r19520:r20039 from nmap-exp/djalal/nmap-add-targets. This will let NSE scripts to add new discovered targets to future Nmap scans. 2010-09-01 01:50:34 +00:00
luis
c7be757035 Fixed small format specifier error that caused a compiler warning 2010-06-22 17:47:32 +00:00
david
d90b7b15a7 Make a new function called resolve_all in tcpip.cc, which is like
resolve except that it returns all resolved addresses. Use this new
function to resolve IPv4 addresses instead of gethostbyname in
TargetGroup.cc. The gethostbyname code assumed that only IPv4 addresses
would be returned. If the resolver returned IPv6 addresses, TargetGroup
would blindly copy the first four bytes of the IPv6 address into the
IPv4 struct. This was first reported by Mats Erik Andersson at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584301; he also
suggested the fix.
2010-06-19 00:13:44 +00:00
david
57238b7df5 Print the addresses that were resolved but not scanned in each scan
report. It looks like this.

$ ./nmap google.com -sn

Starting Nmap 5.30BETA1 ( http://nmap.org ) at 2010-05-10 23:57 MDT
Nmap scan report for google.com (66.102.7.99)
Host is up (0.073s latency).
Other addresses for google.com (not scanned): 66.102.7.104
rDNS record for 66.102.7.99: lax04s01-in-f99.1e100.net

This replaces the line

Hostname google.com resolves to 2 IPs. Only scanned 66.102.7.99
2010-05-11 05:59:09 +00:00
david
fea2ad0a33 o Moved the parse_long function from ncat to nbase for better reuse,
and used it to simplify netmask parsing code. This patch was
  contributed by William Pursell.
2010-05-08 21:08:55 +00:00
fyodor
1aecac420f Update copyright year from 2009 to 2010 2010-05-03 21:20:25 +00:00
david
a4fc71afb6 Return the last host before skipping an octet in an IPv4 range exclude
group. Not doing this was the cause of off-by-one errors that led to
assertion failures and, potentially, excluded hosts being scanned. Here
is the comment I added:

  /* The decision to skip a range was based on the address that came immediately
     before what our current array contains now. For example, if we have just
     handed out 0.0.0.0 from the the range 0-5.0.0.0, and we're asked to skip
     the first octet, we want to advance to 1.0.0.0. But 1.0.0.0 is what is in
     the current array right now, because TargetGroup::get_next_host advances
     the array after returning an address. If we didn't step back we would
     erroneously skip ahead to 2.0.0.0. */
2009-11-18 01:17:59 +00:00
david
bf29b139bd Only print the first warning that a name resolves to multiple addresses
(the one that happens right after then name is resolved) with -vv. That
information is also printed out above the ports table later.
2009-10-27 06:16:22 +00:00
david
398e53b3de Keep trace of the list of addresses a name resolved to, and print out
how many there were if there were more than one.
2009-10-27 06:08:04 +00:00
david
cb9222bd20 Fix TargetGroup::is_resolved_address. It was actually checking against
the address that was the start of a netmask range.
2009-10-27 05:08:05 +00:00
david
c9fb13b4bb Add methods to TargetGroup to record the name or address that was the
"base address" from which a group of addresses were derived, for example
in "scanme.nmap.org/24", "scanme.nmap.org" would be the base address.
Use these methods to set the target name of that one host even when
addresses come from a netmask.
2009-10-26 23:15:43 +00:00
josh
df71e36084 Updated uses of the ctype function to support explict casting of the arguments
to (int)(unsigned char).
2009-08-06 15:10:00 +00:00
jah
89dc4fca57 Improved the parsing of host expressions to handle a few cases where supplying invalid targets would cause Nmap to scan unintended hosts.
See http://seclists.org/nmap-dev/2009/q2/0319.html for more detail.
2009-05-13 09:09:55 +00:00
jah
e8f696571e Improved a couple of indents which I messed-up in the last commit. 2009-05-12 23:36:40 +00:00
jah
66fc9a039e Fixed some whitespace anomalies. 2009-05-12 22:59:33 +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
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
bmenrigh
03c139ff89 Fixed (removed) the use of strtok in TargetGroup::parse_expr by using
strchr() per David's suggestion.  strtok uses static (global) state to
track the string it is parsing.  In this case, load_exclude was also
using strtok and calling parse_expr which was wiping out the previous
strtok state.  This introduce two bugs, first, only the first exclude
on a line would be loaded from the exclude file, and second, there was
an invalid access into free()'d memory in load_exclude (found with
Valgrind).  The use of strtok should be highly discouraged because
these types of bugs are so easy to introduce.
2009-03-16 21:31:57 +00:00
david
73356bf715 Interpret '-' by itself as an IPv4 octet as being short for "0-255". So
192.168.-.0 is the same as 192.168.0-255.0. It looks like this was intended all
along, but a coding error kept it from working.
2009-02-21 04:00:21 +00:00
david
24042b3362 Check for the linked list returned by getaddrinfo being NULL as well as a
non-zero return code in TargetGroup.cc. Apparently on Windows XP SP3 at least
getaddrinfo can return success but give you an empty list.
2008-09-04 14:27:55 +00:00
kris
5436c891fc o Fixed an integer overflow which prevented a target specification
of "*.*.*.*" from working.  Support for the CIDR /0 is now also
  available. [Kris]


A sendto() or connect() to IPv4 addresses with a first octet of 0
(excluding 0.0.0.0 on some OS's) returns EINVAL.  These addresses
are reserved for "self-identification" and should never go over the
wire (and at least on Linux a connect() to 0.0.0.0 gets redirected
to 127.0.0.1).  I'm talking with Fyodor on whether or not to skip
*all* of these addresses.
2008-06-03 19:25:16 +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
kris
7d38c4dc6e o Nmap now understands the RFC 4007 percent syntax for IPv6 Zone IDs.
On Windows, this ID has to be a numeric index.  On Linux and some
  other OS's, this ID can instead be an interface name.  Some examples
  of this syntax:
    fe80::20f:b0ff:fec6:15af%2
    fe80::20f:b0ff:fec6:15af%eth0

This was a lot simpler than the method I previously implemented and posted
to nmap-dev.  Now I just extract the zone ID from the already available
getaddrinfo() data rather than parsing it out myself.
2008-05-20 05:21:29 +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
1accc12fb2 fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
fyodor
61b976a45c o Nmap now saves the target name (if any) specified on the command
line, since this can differ from the reverse DNS results.  It can be
  particularly important when doing HTTP tests against virtual hosts.
  The data can be accessed from target->HostName() from Nmap proper
  and host.targetname from NSE scripts.  The NSE HTTP library now uses
  this for the Host header.  Thanks to Sven Klemm for adding this
  useful feature.
2008-02-04 22:10:29 +00:00
fyodor
29c912f394 URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +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
2fbed3e856 Fixing a bug in TargetGroup::parse_expr(). A specification like '192.168.1.-4' would actually cause Nmap to treat it like '192.168.1.-'. Found with Coverity, CID 2. 2007-11-15 23:01:32 +00:00
kris
4cd9fa160d just fixing some spelling errors in comments 2007-11-03 03:54:11 +00:00
fyodor
d02249d459 merge soc07 r5244 - nmap config optimisations 2007-08-11 05:58:21 +00:00
fyodor
6c06f51bd7 merge soc07 r5100 - Changing fprintf(stderr, )'s to error()'s (or fatal() if followed by and exit()). Besides providing consistency, this also allows more errors to actually be logged with --log-errors. 2007-08-11 05:16:56 +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
58522c59f6 merge soc07 r4822 - Reduce the number of build dependencies. 2007-08-11 03:35:46 +00:00
fyodor
b28d51167c Minor source code header improvements 2006-08-25 01:47:49 +00:00
fyodor
a403864351 Replace file headers, mostly to update copyright to 2006 2006-08-24 04:43:50 +00:00
fyodor
0a392843a3 approaching 4.04 2006-05-27 08:57:03 +00:00
fyodor
48a6d1ce41 latest changes, including a couple doug fixes 2006-05-16 21:46:41 +00:00
fyodor
02a5e06e8b Latest Nmap warez 2006-04-29 06:18:47 +00:00
fyodor
c9dd83e327 about to apply Doug DNS fix patch 2006-02-07 07:15:32 +00:00