1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-01 04:19:02 +00:00
Commit Graph

283 Commits

Author SHA1 Message Date
david
81c777abfd Simplify connect-mode stdin EOF handling. 2013-02-09 08:29:37 +00:00
david
9a10429474 Round out EOF and shutdown tests.
The existing tests here didn't make much sense, and didn't cover all the
situations we care about. The 8 tests now check each of

client !--send-only EOF on stdin
client  --send-only EOF on stdin
server !--send-only EOF on stdin
server  --send-only EOF on stdin

client !--recv-only EOF on socket
client  --recv-only EOF on socket
server !--recv-only EOF on socket
server  --recv-only EOF on socket

The other thing we care about is whether the client/server keeps running
after the EOF. That is now checked in each of the tests too.
2013-02-09 08:29:36 +00:00
david
61255ee01e Retab ncat-test.pl. 2013-02-09 08:29:35 +00:00
david
a6dd675fd3 Don't do operations with side effects inside asserts.
ncat_assert is safe because it cannot be disabled. <assert.h> assert is
also safe because we make sure that NDEBUG remains defined. Doing this
helps avoid potential bad effects of something changing in the future.
2013-01-04 18:59:56 +00:00
david
63d9e8b5d5 Use ncat_assert in place of assert everywhere. 2013-01-04 18:59:47 +00:00
david
4519c2ec74 Assert that get_fdinfo doesn't return NULL.
Resolves these Parfait reports
(http://seclists.org/nmap-dev/2012/q4/412).

Error: Null pointer dereference (CWE 476)
    Read from null pointer 'fdn'
         at line 328 of components/nmap/build/amd64/ncat/ncat_core.c in function 'blocking_fdinfo_send'.
           Function 'get_fdinfo' may return constant 'NULL' at line 615, called at line 366 in function 'ncat_broadcast'.
           Constant 'NULL' passed into function 'blocking_fdinfo_send', argument 'fdn', from call at line 367.
           Null pointer introduced at line 615 of components/nmap/build/amd64/ncat/util.c in function 'get_fdinfo'.
         at line 330 of components/nmap/build/amd64/ncat/ncat_core.c in function 'blocking_fdinfo_send'.
           Function 'get_fdinfo' may return constant 'NULL' at line 615, called at line 366 in function 'ncat_broadcast'.
           Constant 'NULL' passed into function 'blocking_fdinfo_send', argument 'fdn', from call at line 367.
           Null pointer introduced at line 615 of components/nmap/build/amd64/ncat/util.c in function 'get_fdinfo'.
Error: Null pointer dereference (CWE 476)
    Read from null pointer 'fdn'
         at line 946 of components/nmap/build/amd64/ncat/ncat_listen.c in function 'shutdown_sockets'.
           Function 'get_fdinfo' may return constant 'NULL' at line 615, called at line 945.
           Null pointer introduced at line 615 of components/nmap/build/amd64/ncat/util.c in function 'get_fdinfo'.
2012-12-22 06:02:30 +00:00
david
d98bbcc8ab Add an ncat_assert macro.
This is an assert that will remain even if NDEBUG is defined.
2012-12-22 06:02:25 +00:00
david
93b978fba8 Merge 30432:30436 from /nmap-exp/david/ipv6-ranges.
This is simple IPv6 unicast ranges. For example,
nmap -6 en.wikipedia.org/120 -sn

The other, more complicated part of this overall change is automatic
multicast scanning of large local subnets. That part isn't done yet.
2012-12-19 01:10:39 +00:00
henri
809f1eda68 Merged nsock-logging from nmap-exp/henri/nsock-logging/
Reworked the logging infrastructure to make it more flexible
and consistent.

Updated nmap, nping and ncat accordingly.  Nsock log level can
now be adjusted at runtime by pressing d/D in nmap.
2012-12-15 10:59:30 +00:00
fyodor
a90d961f51 auto-generated files (nroff versions of man pages) 2012-12-10 01:17:51 +00:00
fyodor
8f585c7882 Update my email address: fyodor@insecure.org => fyodor@nmap.org 2012-12-10 01:14:42 +00:00
dmiller
9e6d7b2384 Change test-addrset.sh to be POSIX sh compliant 2012-12-06 18:46:29 +00:00
david
ec53dc049a Update with new mailing list addresses. 2012-12-06 02:23:34 +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
0cd8c9d6e5 Make test-addrset.sh exit with nonzero status if any tests fail.
Patch by Andreas Stieger.
http://seclists.org/nmap-dev/2012/q4/385
2012-12-05 06:48:15 +00:00
fyodor
e09125e010 Update CHANGELOG to note 6.25 release and also bumped up Nmap SVN version number to avoid confusion and rebuilt files accordingly 2012-11-29 23:40:26 +00:00
david
2ffd03dfc3 Add define for SHUT_WR on Windows.
The same as was applied for a similar change in r29743.
2012-11-29 19:35:27 +00:00
david
48e94596af Add a forward declaration for shutdown_sockets. 2012-11-29 19:35:26 +00:00
david
dc5d51f335 Fix copy-paste error in Ncat timeout warning messages.
Patch by Michal Hlavinka.
http://seclists.org/nmap-dev/2012/q4/351
2012-11-29 18:36:31 +00:00
david
297e0a1dfd shutdown write socket on stdin EOF in listen mode.
http://seclists.org/nmap-dev/2012/q4/337
2012-11-29 03:51:06 +00:00
david
9f3fa403ef Automatically create and delete a source Unix domain DGRAM socket.
Patch based on one by Tomas Hozza.
http://seclists.org/nmap-dev/2012/q4/334
2012-11-27 21:47:26 +00:00
fyodor
89d84932de Regenerated the man pages with today's date 2012-11-16 19:09:59 +00:00
fyodor
ea05ae2586 Latest auto-generated files in prep for upcoming 6.20BETA1 release 2012-11-16 00:54:16 +00:00
henri
9d7c017cf7 Use the fallback nsock engine by default in order to maximize
compatibility between systems and use cases. [Henri Doreau]

There were known issues with the following cases:
  * epoll and regular files
  * kqueue and regular files
  * WSAPoll and stdin

The --nsock-engine=<ENGINE> can still be used to bypass this
default choice.

See: http://seclists.org/nmap-dev/2012/q4/173
2012-11-13 08:40:49 +00:00
david
cc4eb9f381 Disable automatic generation of datagram Unix domain source socket.
This code was not always properly cleaning up automatically generated
sockets; for example in the case of "Connection refused". It would
delete sockets even if you gave one manually with --source; it's not
clear that's the right behavior.
2012-11-12 20:44:45 +00:00
david
e017de82bb Short section on -U in ncat man page. 2012-11-12 20:44:43 +00:00
david
fde17a1e40 Tests for UNIX sockets implementation in Ncat
Added tests for UNIX domain sockets to the ncat_test.pl
script. Added tests for:
1. listening on and connecting to UNIX STREAM socket.
2. listening on and connecting to (client with random
   socket) UNIX DGRAM socket.
3. connecting to UNIX DGRAM socket with given source
   socket (with "-s").
2012-11-12 20:44:41 +00:00
david
6531a19892 Implementation of UNIX-domain sockets for Ncat
Implementation of UNIX sockets for Ncat using
also UNIX-domain sockets functionality from
Nsock library. Added new argument "-U".
2012-11-12 20:44:40 +00:00
david
c5f632382f Show an error instead of silently falling back to AF_INET6. 2012-11-12 19:34:23 +00:00
david
0d3a8846b0 Set target port number based on target af, not o.af.
o.af is AF_UNSPEC at this point in the common case that neither -4 nor
-6 was given. The code was falling through to the "else" IPv6 case. I
think we were getting luck with this because the port number happens to
be in the same place in sockaddr_in and sockaddr_in6.
2012-11-12 19:34:22 +00:00
david
665e6b9e70 Whitespace. 2012-11-12 19:01:01 +00:00
david
c92d25dfcb Fix ncat man page typo. 2012-11-12 18:11:58 +00:00
henri
71963537cb Proper indentation. 2012-11-08 13:11:23 +00:00
henri
eec3669ed4 Update ncat test suite to take new ncat behavior into account.
Since r29743, ncat closes connection after reading EOF. This patch first
introduces a new test to verify it, and also updates two existing tests
to prevent them from closing STDIN too early.
2012-11-08 08:04:16 +00:00
henri
58418396a8 Make nping and ncat fail (the way nmap does) when invalid nsock engines are supplied. 2012-10-29 10:22:32 +00:00
henri
84c80a7b34 Make ncat unconditionally use the select engine on windows. WSAPoll()
can't handle read events on stdin. This is a workaround intended to
mitigate the issue until we implement a fpoll function in nbase.
2012-10-26 09:40:14 +00:00
david
9cab81511c Remove claim that -x can be used to "replay" sessions.
I don't even know what that means. It sounds like there is a
complementary option taking the name of a file containing a hex log,
which there isn't.
2012-10-25 04:40:21 +00:00
david
2f2e826487 Remove OpenSSL directory, moved to /nmap-mswin32-aux. 2012-10-02 00:53:12 +00:00
david
7e5c9a8914 Regen with Autoconf 2.68 and aclocal 1.11.6.
for DIR in . nbase ncat nsock/src nping;
	do (echo $DIR; cd $DIR && aclocal --force && autoconf --force);
done
2012-09-19 16:41:35 +00:00
david
ddc37e6e39 AM_CONFIG_HEADER → AC_CONFIG_HEADER(config.h).
aclocal.m4 said that AM_CONFIG_HEADER was obsolete; with
AC_CONFIG_HEADER aclocal.m4 is not even needed.
2012-09-19 16:41:27 +00:00
david
0bf004cf6b Move acinclude.m4 inclusion from aclocal.m4 to configure.ac.
aclocal.m4 is autogenerated, so running aclocal would remove the
m4_include of acinclude.m4.

The exceptions are at the top of the source tree and in nsock/src, where
an acinclude.m4 lives; aclocal notices it there and automatically adds
an inclusion to the end of aclocal.m4, so no inclusion is needed in
configure.ac.
2012-09-19 16:41:25 +00:00
fyodor
57973b0c60 Added a new legal notices section to the Ncat man page which is basically the same as that section in the Nmap man page (in fact it links to that section to avoid copy and pasting a bunch of text. As part of this, I had to make an enclosure file (ncatmanhtml.xml) for the ncat.xml. Otherwise I can't use things like &ndash;. And this is consistent with how we deal with the nping man page, though I'm fine with getting rid of the enclosure in both cases if there is a good way to do so 2012-09-18 08:58:41 +00:00
david
d319f8bf56 Uniformity and style in resolve functions. 2012-09-15 17:56:16 +00:00
david
40eb708922 Show gai_strerror in some error messages. 2012-09-15 17:56:14 +00:00
david
113e0b975f Break out resolve and resolve_numeric.
Besides the confusingness of the nodns argument being negatively
phrased, it had the value 0 in every existing call. Split out the nodns
special case into a separate function resolve_numeric.

This also has the side effect of changing the number of parameters to
the resolve function, which will cause a compile error for any calls I
might have missed changing when I changed the return code meaning in the
previous commit.

Ncat has its own copy of resolve, which obeys the global o.nodns rather
than a parameter. I'm leaving that alone for now. But give it the same
resolve_internal function, and make resolve call it with different flags
depending on the value of o.nodns.
2012-09-15 17:56:11 +00:00
david
0e738370ee Make resolve return a getaddrinfo error code.
The only error we can have apart from a getaddrinfo error is a list of
zero addresses; return EAI_NONAME in that case.

This unfortunately inverts the truth value of the return code of
resolve; 0 now means success.
2012-09-15 17:56:08 +00:00
david
739aca56d4 Whitespace. 2012-09-12 04:54:19 +00:00
henri
7dc93e0935 Close connection endpoint when receiving EOF on stdin. Patch by Michal Hlavinka. 2012-09-10 20:41:46 +00:00
david
cb68c85409 Don't use exit in PCAP_IS_SUITABLE.
John Spencer reported that musl libc doesn't automatically include
<stdlib.h>, as Glibc does, so the configure check was wrongly failing.

conftest.c: In function 'main':
conftest.c:35:5: error: implicit declaration of function 'exit'
2012-09-08 19:44:24 +00:00
david
3ae9ba63be Make sockets temporarily blocking in ncat_send and ncat_broadcast.
It is possible to send so quickly that we start getting EAGAIN on sends.
In listen mode, this means that some sends can get lost. This patch,
adapted from one by Alex Weber, makes sockets blocking for the duration
of the send. This is not as nice as retrying the send through an event
mechanism, but should at least be correct.

http://seclists.org/nmap-dev/2012/q3/670

Compare a similar patch in r13552, which applied to --exec mode.
2012-09-06 18:17:27 +00:00