1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-25 08:59:01 +00:00
Commit Graph

157 Commits

Author SHA1 Message Date
d33tah
ccd0c02a4c Add a lacking space in the license comment. The command I used to do this is:
for file in `grep "* including the terms and conditions of this license text as well.       \*" * -r --files-with-match `; do sed "s/\* including the terms and conditions of this license text as well.       \*/* including the terms and conditions of this license text as well.        */g" -i $file; done
2013-09-11 19:06:20 +00:00
david
1f372aa911 Make format string specifiers better match types.
Suggested by Gisle Vanem.
http://seclists.org/nmap-dev/2013/q3/269
2013-08-15 08:07:26 +00:00
david
4961ebf047 8-byte display for SCTP checksum. 2013-08-15 08:07:24 +00:00
david
ed237e8e19 Use %lu instead of %ul.
Discovered by Gisle Vanem.
http://seclists.org/nmap-dev/2013/q3/269
2013-08-15 08:07:21 +00:00
david
784b1ef4e8 Swap SCTP vtag and csum in HIGH_DETAIL output.
Discovered by Gisle Vanem.
http://seclists.org/nmap-dev/2013/q3/269
2013-08-15 08:07:14 +00:00
fyodor
6e01ecd452 Update an email address, fix a typo, and slightly reword a sentence. 2013-07-30 00:02:00 +00:00
fyodor
83fb10ec56 Update the Nmap copyright/license files. This isn't the new Nmap Public Source License we've been discussing on the list, but rather just a 'quick patch' to hopefully prevent some of the abuse we've been seeing from companies lately. More details on the changes will be posted to the dev list. Also, the copyright year was updated to 2013 (which is the only change to Nsock license statements). 2013-07-28 22:05:05 +00:00
david
9ac1bffad2 Ignore down interfaces at route_dst time, not when building routing table.
The previous code to ignore down interfaces didn't account for implicit
routes that come from interface addresses and netmasks. You can force
the use of a route using a down interface with -e.
2013-07-01 02:06:09 +00:00
david
b415564df9 Sort routes first by netmask, then by metric.
Metric is used to break ties between routes with the same size netmask.
2013-06-30 17:38:15 +00:00
henri
4f36ba9798 Stop parsing TCP options after reaching EOL in libnetutil. Bug reported
by Gustavo Moreira.
2013-06-17 18:19:24 +00:00
david
9ea60a9f1f Consider IPPROTO_NONE (59) an upper-layer protocol for IPv6.
"Upper-layer" here simply means that there are no extension headers
following, which is the case here.
2013-06-06 14:50:09 +00:00
david
ce98c0ad1e Don't consider NOARP devices as Ethernet devices.
NStorm reported a failure of ARP ping scan on OpenVZ venet devices,
which don't have a MAC address and can't do ARP. We don't keep interface
flags such as NOARP at the target level, so check whether the interfaces
returned by libdnet are both INTF_TYPE_ETH and don't have
INTF_FLAG_NOARP set; otherwise call them "other" interfaces.

http://seclists.org/nmap-dev/2013/q1/349
http://openvz.org/Virtual_network_device
2013-05-13 05:38:33 +00:00
david
436d222fff Fix bug: unset bits properly 2013-05-03 05:59:54 +00:00
luis
49e06da86f Merge r30175-176 from nmap-npingchanges: Add support for Node Information queries in print(). Also, add the ability to pass u64 to setNonce() 2013-03-29 18:19:09 +00:00
luis
d8017b1a95 Merge r30080 from nmap-npingchanges: 2013-03-29 18:05:57 +00:00
luis
67a211e298 Merge r30072 from nmap-npingchanges: Print ICMPv6 destination unreachable, time exceeded and parameter problem 2013-03-29 18:02:36 +00:00
luis
7a221508bf Merge r30071 from nmap-npingchanges: Add the const specified to all relevant methods 2013-03-29 18:01:08 +00:00
luis
347badd7f3 Merge r28016 from nmap-npingchanges: Add method to set IP options from a binary buffer than can be inserted right away into the IP header. 2013-03-29 16:48:53 +00:00
luis
8a023e0c06 Merge r27958 from nmap-npingchanges: Simplify print() in RawData:: 2013-03-29 16:34:53 +00:00
luis
30d25e7e1e Merge r27956 from nmap-npingchanges: Improve code description. 2013-03-29 16:32:44 +00:00
luis
642c62e833 Merge r27995 from nmap-npingchanges: Add two missing codes. Also, re-write description so it says the same thing as Wireshark. 2013-03-29 16:30:32 +00:00
luis
afc00e36f2 Merge r27953 from nmap-npingchanges: Add support for ARP Request/Reply packet matching 2013-03-29 16:27:01 +00:00
luis
d5fe922084 Merged r27646 from nmap-npingchages: Add function to determine the tranport layer protocol in a chain of PacketElements 2013-03-29 13:46:14 +00:00
luis
62199a4666 Merged r27540 from nmap-npingchages: Fix bug: convert to u32 after fixing the endianness. 2013-03-29 13:42:41 +00:00
luis
b534fd83a1 Merged r27539 from nmap-npingchages: Implement print() in ICMPv6Header 2013-03-29 13:41:28 +00:00
luis
9fd48a1ea4 Merged r27297 from nmap-npingchages: Implement the print() method for IPv6 headers 2013-03-29 13:32:02 +00:00
luis
2fa6124a79 Merged r27296 from nmap-npingchages: Add some missing code to support ICMP domain name requests 2013-03-29 13:31:04 +00:00
david
39687a80b1 Set source and destination interfaces as rtattrs.
Scans using the -e option could use the correct interface but the wrong
source address.

Thanks to Taburiss S for the report and John Bond for help debugging.
http://seclists.org/nmap-dev/2013/q1/269
http://seclists.org/nmap-dev/2013/q1/327
2013-03-08 05:35:07 +00:00
david
96d9d6fc51 Fix some socket leaks in get_srcaddr. 2013-03-08 05:35:05 +00:00
henri
1097ce2e02 Get rid of npacket_debug (dead code). 2013-02-14 14:34:52 +00:00
david
ce51d8c4da Use the default value of MultiThreadedDLL where possible. 2013-02-09 20:30:01 +00:00
david
6b095f42d2 Use MultiThreadedDebugDLL (/MDd) in place of MultiThreadedDebug (/MTd).
This is to match r8507, which did the analogous thing for the Release
configuration.
http://seclists.org/nmap-dev/2013/q1/120
2013-02-09 20:29:55 +00:00
david
66bd9d1993 Enforce device name only after choosing loopback in route_dst_generic.
Nping calls route_dst at least twice: once with a NULL device, and again
with the device learned from the first time. This interfered with the
code that automatically chooses a loopback interface for dests that are
the same as an interface address. For example, if you are 192.168.0.1,
and you are scanning 192.168.0.1, route_dst will tell you to use
interface "lo0" even though the interface of 192.168.0.1 may be "eth0".
route_dst was returning failure because the device name check was being
done before "eth0" got changed to "lo0".

This problem didn't show up on Linux because Linux uses
route_dst_netlink, which delegates the work to the kernel. But I could
reproduce on Linux by forcing the use of route_dst_generic.
2013-02-09 18:55:46 +00:00
david
5ab6c9fa93 Sort by metric. 2013-02-01 05:01:59 +00:00
david
e2387e4693 Add metric to struct sys_route. 2013-02-01 05:01:57 +00:00
david
41b397200b Show ICMP ID and seqno in packet trace by default.
This was previously limited to ippackethdrinfo's medium detail and
above, which required -v in Nping and -d2 in Nmap.
2013-01-28 22:34:37 +00:00
david
50a4817671 Remove dynamically allocated fakeargv.
This used to be used to hold the original argv before quashing with -q.
Now that -q is gone, it was just a copy of argv.

fakeargv was also causing Valgrind to complain about leaked memory. it
wasn't a real leak, but now it's out of the report anyway.
2013-01-25 06:26:21 +00:00
david
e1fba2d663 Merge r30416:30527 from /nmap-exp/david/ipv6-ranges.
This is a refactoring of target parsing that stores different types of
target specifications as different classes. The eventual intention is to
allow easy iteration over each specification for the purpose of IPv6
multicast host discovery.
2013-01-22 00:01:08 +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
3029747902 Actually use the interface address when get_srcaddr fails.
There was an embarrasing bug here added in r28874. In the second of
three calls to get_srcaddr, the interface was being indexed by an index
variable that, in this place, was actually an index into the routes
table. This would in general produce a nonsensical source address or
out-of-bounds access.

The symptom of this problem was the following error messages:
	get_srcaddr: can't connect socket: The requested address is not valid in its context.
	Failed to convert source address to presentation format!?!  Error: Unknown error
The first showed that get_srcaddr failed, and the second was caused by
the bogus source address.

http://seclists.org/nmap-dev/2012/q3/859
http://seclists.org/nmap-dev/2012/q4/59
2012-10-11 03:11:53 +00:00
david
ac606d846f Fallback check for an AF_UNSPEC interface in route_dst_netlink.
When an interface doesn't have an address set, getInterfaceByName can
fail because it checks the address family. The fatal error message would
be something like
	route_dst_netlink: can't find interface "tap0"
If we can't find an interface with a specific address family, fall back
with an AF_UNSPEC search.

http://seclists.org/nmap-dev/2012/q4/12
2012-10-03 21:06:43 +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
d319f8bf56 Uniformity and style in resolve functions. 2012-09-15 17:56:16 +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
e2d17adf9f Fix add_rtattr_addr.
The second argument to RTA_NEXT was missing a dereference, so it was
changing the pointer rather than the integer pointed to. I got this
assertion failure with an IPv6 link-local address:

nmap: netutil.cc:3048: void add_rtattr_addr(nlmsghdr*, rtattr**, unsigned int*, unsigned char, const sockaddr_storage*): Assertion `((*len) >= (int)sizeof(struct rtattr) && (*rtattr)->rta_len >= sizeof(struct rtattr) && (*rtattr)->rta_len <= (*len))' failed.
2012-09-15 17:17:59 +00:00
david
3fb047e237 Don't assign any routes to interfaces that are not up. 2012-09-14 15:51:12 +00:00
david
b5b558f162 Don't use the clobbered rtmsg->rtm_family to look up interfaces.
This value gets clobbered after the netlink recvmsg. It was giving me a
bogus address family (234), which caused the call to getInterfaceByName
to fail:
Could not find interface wlan0 which was specified by -e

This seems to have been exposed by r29754. Specifying a source address
that is not on any actual route seems to result in a netlink query
result with 0 entries, and the changed value of rtm_family. (The fact
that there are no routes returned is not a problem, because we bail out
early when -e is given, now that getInterfaceByName works again.)
2012-09-11 23:50:21 +00:00
david
5b8c1090e5 Add specifiers for source address and interface in route_dst_netlink.
We previously restricted by destination address; do it for source
address as well. This can matter in some configurations.

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

There still seems to be a problem with the wrong route being chosen with
--send-ip, but this patch is reported to work with --send-eth.
2012-09-11 18:39:42 +00:00