1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00
Commit Graph

7614 Commits

Author SHA1 Message Date
david
11b76a55e2 Route tables rework to libdnet-stripped/NMAP_MODIFICATIONS. 2012-09-30 00:01:20 +00:00
david
561fd00a3e CHANGELOG for route tables rework. 2012-09-30 00:01:18 +00:00
david
049208898b Set intf_name in route-bsd.c, the parts used by OS X.
There are some other #ifdefs that are used on other platforms, in which
code intf_name might nto be set but will continue to be an empty string
as before.
2012-09-30 00:01:17 +00:00
david
0ed5d26bc3 Set intf_name in route-win32.c. 2012-09-30 00:01:16 +00:00
david
22d49bd5c9 Match against both destination and gateway in sysroutes_dnet_find_interfaces.
This commit fixes two different bugs:

(1) First in some situations Nmap will only see routes that are attached
to the device that handles the default route.

(2) On boxes without a default route, Nmap will not see any route.

These two bugs are caused by sysroutes_dnet_find_interfaces() logic
which will use only the geteway to match interface addresses.

To fix this, first check the current route and see if the gateway was set
otherwise use the destination address to match the address of an
interface.
2012-09-30 00:01:14 +00:00
david
6c8b5c7dd9 Assign sys_route interfaces immediately when iface names come from libdnet. 2012-09-30 00:01:13 +00:00
david
98aa8fbe80 Set intf_name in route-linux.c. 2012-09-30 00:01:12 +00:00
david
5bbe36af7a Add intf_name to the route_entry struct.
This is set to an empty string in all functions yielding routes,
particularly route_loop. The code to get the interface pertaining to a
route is different on different platforms, so must be added one by one.
The code setting the intf_name to an empty string is only tested on
Linux.
2012-09-30 00:01:10 +00:00
david
bfea61a51e Put the sscanf count check right after the call to sscanf. 2012-09-27 03:10:28 +00:00
david
06dcb1c138 Check ipv6 route flags and sscanf count as well. 2012-09-27 03:06:22 +00:00
david
95b634d28c We are reading 11, not 10, fields from /proc/net/route. 2012-09-27 02:58:27 +00:00
david
645e0d213f We can only read n - 1 bytes of interface name; sscanf doesn't include
the terminator.

Noticed by Djalal.
2012-09-27 02:58:26 +00:00
djalal
af495cdc49 Fixed a bug that prevented Nmap from finding any interfaces when one
of them had the type ARPHDR_INFINIBAND; this was the case for
IP-over-InfiniBand interfaces. However, This support is not complete
since IPoIB interfaces use 20 bytes for the hardware address, and
currently we only report and handle 6 bytes.
Nmap IP level scans should work without any problem, please refer to
the '--send-ip' switch and to the following thread:
http://seclists.org/nmap-dev/2012/q3/642

This bug was reported by starlight.2012q3.
2012-09-26 09:24:00 +00:00
djalal
e017b7c290 Fixed a bug that prevented Nmap from finding any interfaces when one
of them had the type ARPHDR_IEEE80211; this was the case for wireless
interfaces operating in access point mode. This bug was reported by
Sebastiaan Vileijn.

http://seclists.org/nmap-dev/2012/q3/986
2012-09-26 08:49:22 +00:00
henri
094aa2d3dc Fixed typo. 2012-09-25 12:22:09 +00:00
henri
f2bb268135 Added 404 detection checks to attempt to reduce false positives. 2012-09-25 12:07:59 +00:00
david
a0601febeb Store port numbers in host byte order in number-to-service mapping.
I don't know why these were in network byte order. Every single
interaction had a htons on entrance and ntohs on exit.
2012-09-25 05:24:16 +00:00
david
b084226813 CHANGELOG for protocol number-to-name fix. 2012-09-25 05:11:06 +00:00
david
b2a1ff8e54 Fix broken protocol lookup.
For some reason (probably by imitation of nmap_getservbyport), protocol
numbers, which are byte values 0–255, had htons called on them after
being read from nmap-protocols. On little-endian platforms, this turned
them into integers 0x0100, 0x0200, 0x0300, etc.

protocol_table is supposed to be an array of 256 linked lists, linking
all the protocol names of the same number. Because of the above htons
conversion, all protocols mapped to bucket 0 on lookup instead. Perhaps
in an attempt to work around this broken lookup, all protocols were
inserted into bucket 0 on init; all other buckets were empty. This
worked on little-endian platforms, but on big-endian platforms where
htons is a no-op, all protocol numbers but 0 mapped to an empty linked
list.

Remove all the htons stuff and just look things up by integers. Use the
same mapping on initial insertion and on lookup, so that the buckets are
acutally populated.

This was noticed by hejianet.
http://seclists.org/nmap-dev/2012/q3/1005
2012-09-25 05:08:09 +00:00
fyodor
fdac9b93bb Latest todo updates 2012-09-24 22:56:32 +00:00
david
9a21b96b49 Let -e work in ipv6-ra-flood. NSEDoc fixes.
Patch by Adam Števko.
2012-09-24 04:33:15 +00:00
batrick
4fe62b040c Better response to misuse of stdnse.base|new_thread when not executing an
action function (current == nil).
2012-09-23 21:31:02 +00:00
david
6b86535138 Use parse_timespec for ipv6-ra-flood.timeout argument. 2012-09-23 21:15:24 +00:00
david
40a2af0a84 Description and timeout argument for ipv6-ra-flood.
Patch by Adam Števko.
2012-09-23 21:15:22 +00:00
david
b19647254d Typo. 2012-09-23 21:15:20 +00:00
david
7ddb82d555 Remove nonexistent @output from ipv6-ra-flood.nse. 2012-09-22 16:54:31 +00:00
david
a41633cd85 Close an NSE socket before making a second attempt to connect.
Without this, we were leaking socket descriptors. See
http://seclists.org/nmap-dev/2012/q3/971.
2012-09-21 21:13:28 +00:00
henri
dfd3bf835d Changed "auth" to "brute" category for imap-brute.nse and citrix-brute-xml.nse for consistency. 2012-09-21 11:46:23 +00:00
henri
e60ba1b617 Use nse_errorcode() to get the actual errors. 2012-09-21 09:08:24 +00:00
henri
b4607a5071 Style fixes.
indent -nut -i2 -kr -br -brs -brf -l0 -bad -npcs -nprs -ncs <files> and manual adjustments.
2012-09-21 09:05:59 +00:00
dmiller
520651a9ed Check for timeout when trying reserved ports
rpc.Comm.Connect was trying to bind to 424 reserved ports, which is
overkill. Since nsock doesn't do an actual bind(2) call until
socket:connect for TCP, that meant up to 424 connect calls, each of
which is currently leaking a socket. This commit contains 3 fixes:

1. Add nmap.new_socket calls for non-privileged code path that were
moved inside the privileged loop to originally address the leak.

2. Check for TIMEOUT on each of the TCP connect calls and abandon the
Connect, avoiding many timeouts.

3. Try 10 random reserved ports (from 1 to 1024) instead of 400+.
Should be good odds of finding one unused, even when lots of threads are
trying (though empirical results would be helpful). Also, this should
reduce load since thread n won't need to fail n-1 bind attempts.
2012-09-21 02:39:48 +00:00
david
23625913a8 Create (and close) a new socket in rpc Connect, don't reuse one.
It appears that connecting more than one with the same nse_nsock socket
leaks socket descriptor. For example,

local s = nmap.new_socket()
s:connect(host, port) --> TIMEOUT
s:connect(host, port) --> TIMEOUT
s:close()

leaks a socket descriptor, the one used in the first connect. Nsock
should really take care of this, but let's do this workaround because
rpc-grind has been causing problems due to using the above pattern:

http://seclists.org/nmap-dev/2012/q3/864
http://seclists.org/nmap-dev/2012/q3/872
http://seclists.org/nmap-dev/2012/q3/949

The difficulty is that the rpc library will tolerate around 400 of those
timeouts per RPC connection, which leads to rapidly running out of
descriptors.
2012-09-21 01:08:14 +00:00
luis
f712477644 Fix a bug in the argparser. When users pass 'random' as an IPv6 address, the randomly generated address never gets stored. This was reported and fixed by Mark Atkinson. More info: http://seclists.org/nmap-dev/2012/q3/950 2012-09-20 20:40:38 +00:00
dmiller
7751a61e82 Fix broken service matches
Discussion: http://seclists.org/nmap-dev/2012/q3/929

Similar situation to http://seclists.org/nmap-dev/2009/q2/75

Fixed by changing .*\n.* to .* (since s modifier was in place)
2012-09-20 19:21:34 +00:00
david
cc126ea7d4 Fix removal (assignment to nil) of elements in stdnse.output_table.
There was a reverse table that was meant to map keys to their position
in the order table, to make it easy to table.remove an entry from order.
But removing something from order would shift the indices of all
following elements by 1, and those elements were not updated
correspondingly in the reverse table. Instead, do a linear lookup for
the the element to remove from order, after checking that the element
exists at all.

http://seclists.org/nmap-dev/2012/q3/905
2012-09-20 06:47:42 +00:00
david
8f39b485a0 Add cassandra scripts from Vlatko Kosturjak. 2012-09-20 06:30:48 +00:00
david
00cc96ba95 Add ipv6-ra-flood script by Adam Števko.
http://seclists.org/nmap-dev/2012/q2/250
https://bitbucket.org/xenol/nse-scripts/raw/6d3ad48e6251/ipv6-ra-flood.nse
2012-09-20 00:50:05 +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
43a920120e Rename configlocal.m4 to acinclude.m4 for uniformity. 2012-09-19 16:41:31 +00:00
david
380bb92867 Remove broken incldue of nbase/configlocal.m4. 2012-09-19 16:41:30 +00:00
david
ad61d6de85 Remove unused aclocal.m4 files.
These aren't getting regenerated even with "aclocal --force"; I think
it's because there is nothing to put in them. Running "aclocal
--verbose" shows that all the required macros are in acinclude.m4 files:

aclocal: saw macro PCAP_IS_SUITABLE
aclocal: saw macro RECVFROM_ARG6_TYPE
aclocal: saw macro PCAP_IS_SUITABLE
aclocal: saw macro CHECK_IPV6_IPPROTO_RAW
aclocal: saw macro APR_FIND_APR
aclocal: ../acinclude.m4 is already included by configure.ac
2012-09-19 16:41:28 +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
david
74a79b14f5 Correct header comment. 2012-09-19 16:41:24 +00:00
david
6270d3f7c9 Move -Wno-deprecated-declarations from Makefile.in to configure.ac.
It's a flag specific to GCC, so shouldn't be set unconditionally.
2012-09-19 15:33:56 +00:00
david
98bb6cff31 Add -Wall to CFLAGS when using GCC. 2012-09-19 15:33:50 +00:00
david
89d52c8f4f Declare the function name we actually use.
It was nmap_update_svn_cmdline_create_auth_baton, but should be
       nmap_update_svn_cmdline_setup_auth_baton.
This was missed in r27746, which otherwise was making the same change.

This was noticed by John Spencer.
http://seclists.org/nmap-dev/2012/q3/942
2012-09-19 15:16:24 +00:00
david
9f0f8e33c0 Change hbase-region-info URL to /rs-status.
http://seclists.org/nmap-dev/2012/q3/903
2012-09-18 21:22:14 +00:00
david
fe185dfc24 Show OS scan guesses in XML even without --osscan-guess. 2012-09-18 17:03:47 +00:00
fyodor
b9cdbfa2ca An ID of npìng-man was used, so I changed it to the normal ASCII nping-man (note that the i character is slightly different in these two cases). 2012-09-18 09:07:24 +00:00