1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00
Commit Graph

128 Commits

Author SHA1 Message Date
daniel
50830f7488 o Added initial SCTP port scanning support to Nmap. SCTP is
a layer 4 protocol used mostly for telephony related applications.
  This brings the following new features:
  o SCTP INIT chunk port scan (-sY): open ports return an INIT-ACK
    chunk, closed ones an ABORT chunk.  This is the SCTP equivalent
    of a TCP SYN stealth scan.
  o SCTP COOKIE-ECHO chunk port scan (-sZ): open ports are silent,
    closed ports return an ABORT chunk.
  o SCTP INIT chunk ping probes (-PY): host discovery using SCTP
    INIT chunk packets.
  o SCTP-specific IP protocol scan (-sO -p sctp).
  o SCTP-specific traceroute support (--traceroute).
  o The ability to use the deprecated Adler32 algorithm as specified
    in RFC 2960 instead of CRC32C from RFC 4960 (--adler32).
  o 42 well-known SCTP ports were added to the nmap-services file.
  Part of the work on SCTP support was kindly sponsored by
  Compass Security AG, Switzerland.  [Daniel Roethlisberger]
2009-06-03 23:15:45 +00:00
david
4308302f7d Update the error message shown when attempting to scan an interface
address on Solaris. The Solaris error message was
	/dev/lo: No such file or directory
but apparently it can also be
	lo0: No DLPI device found
Also changed the message to say that it can happen when scanning any
interface address, not just localhost. The new error message was lately
reported by Dom De Vitto.

http://seclists.org/nmap-dev/2006/q2/0127.html
http://seclists.org/nmap-dev/2009/q1/0853.html
2009-05-11 22:31:48 +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
david
970a75edcf Display a warning if we can't read the first line (column headers) of
/proc/net/route. This also silences a _FORTIFY_SOURCE warning.
2009-01-23 21:59:22 +00:00
david
af1ccf0cfe Patch from jah: Move the definition of struct dnet_collector_route_nfo earlier
in tcpip.cc for the WIN32 functions that need it.
2009-01-04 15:08:12 +00:00
david
46378a0dfd Rearrange the dnet route functions so they are all together, add a function
comment.
2009-01-01 19:33:19 +00:00
david
adab33deb9 Split out the assignment of interfaces to routes into a postprocessing step. We
need to have all the routes available before assigning interfaces to handle a
situation like the following:

# nmap --iflist
************************INTERFACES************************
DEV  (SHORT) IP/MASK        TYPE        UP MAC
lo0  (lo0)   127.0.0.1/8    loopback    up
ppp0 (ppp0)  YY.YY.YY.YY/16 point2point up

# netstat -rn
Destination  Gateway      Flags  Refs  Use  Netif Expire
default      XX.XX.XX.XX  UGSc      7   16   ppp0
XX.XX.XX.XX  YY.YY.YY.YY  UH        8    0   ppp0

Here the second route can be matched up immediately with the ppp0 device,
because the YY.YY.YY.YY gateway address matches the YY.YY.YY.YY/16 IP and mask
of ppp0. But the first route (default) needs to go through the second route in
order to find its interface. So we don't reject the default route immediately,
but save it an try to match it with an interface after all routes have been
found. See http://seclists.org/nmap-dev/2008/q4/0576.html for more information.
2009-01-01 19:29:44 +00:00
david
9f7cffc025 Refactor getsysroutes. It had two ways to get routes: by reading
/proc/net/route and with libdnet. I split those into two separate functions.
2009-01-01 16:45:55 +00:00
kris
5be831f06f o Fixed a bug in the IP validation code which would have let a specially
crafted reply sent from a host on the same LAN slip through and cause
  Nmap to segfault.  Thanks to ithilgore of sock-raw.homeunix.org for
  the very detailed bug report. [Kris]
2008-11-21 16:17:11 +00:00
david
854a04b21c Add a guard against getaddrinfo returning no addresses in tcpip.cc. 2008-09-04 14:41:59 +00:00
david
177e2cd4a2 constify the pointer passed to magic_tcpudp_cksum. 2008-08-21 17:43:23 +00:00
david
87b54dc9f2 Fix magic_tcpudp_cksum not to write into memory outside the buffer it's passed.
The partial checksum for the TCP/UDP pseudo-header is calculated and then it is
added to the checksum for the rest of the packet. I started to write the
functions for such incremental checksum calculation but then I saw they are
already implemented in libdnet.
2008-08-20 19:52:46 +00:00
fyodor
8964cb8773 set the ip->ip_sum to 0 before computing the checksum of fragments. I'm not sure if this is necessary, but it is a useful sanity check at least. 2008-08-15 22:38:30 +00:00
kris
910cb5ca48 Moving block_socket() and unblock_socket() from Nmap to Nbase for reuse in
Nsock and Ncat
2008-08-02 03:44:35 +00:00
kris
5f2e6cf5ac Fixing a Windows casting-related compilation error. Thanks to Jah for reporting this 2008-07-26 02:58:07 +00:00
kris
299e0de19e o Added --ip-options support for the connect() scan (-sT). [Kris] 2008-07-14 20:02:30 +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
david
09cc37f7f0 Rename intf_get_pcap_devname to eth_get_pcap_devname to reflect its new home. 2008-06-20 20:44:54 +00:00
michael
3d2f2f56e8 added more comments, fixed a small bug, and refactored code in route_dst 2008-06-19 02:41:49 +00:00
david
130f794664 Remove the now-unused getInterfaceByIP function from tcpip.cc. (Really, it was
not used before because of how the logic for o.spoofsource and o.device is
handled in nmap.cc.) Its basic purpose remains in the function ipaddr2devname.
2008-06-18 23:03:24 +00:00
david
e4227a44e0 Remove some code which Michael correctly surmised isn't used. Replace it with
an assertion.
2008-06-18 22:51:17 +00:00
david
c67369c6b2 Fix up indentation in route_dst in tcpip.cc (no code changes). This function
has been messed up for a while and I was having trouble reading it. I changed
it to use the mix of 8-wide tabs and spaces used by most of the rest of the
file.
2008-06-18 22:30:38 +00:00
michael
2cdb6d9a2a removed a redundant loop from route_dst() in tcpip.cc 2008-06-18 20:41:45 +00:00
michael
5f390306be A fix to r8309, this uses an error message already in nmap instead of the one I added 2008-06-18 01:55:25 +00:00
kris
861f9ff24b Fixing another bug found by Ilja where a pointer in ippackethdrinfo() could have gone outside of the buffer it was referencing (reading, not writing) 2008-06-11 06:00:17 +00:00
kris
92a9b10138 Fixing a bug in tcppacketoptinfo() spotted by Ilja which would break parsing of the tcp options. Also fixing another one spotted by me when investigating this: if the invalid SACK length of 2 was in the packet, this function would have treated it as valid 2008-06-11 05:23:47 +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
bmenrigh
9b9d2bd85e Updated all the stray calls to rand() to use nbase_rnd instead. The
only code left in Nmap that still uses rand() is in the Lua math 
library.  Perhaps at some point we'll need to expose high-quality random 
numbers to Lua via our custom nmap library.
2008-05-06 01:05:51 +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
f2938a2d37 o Fixed the NmapArpCache so that it actually works. Previously, Nmap
was always falling back to the system ARP cache. Of course this
  raises the question of whether NmapArpCache is needed in the first
  place. [Daniel Roethlisberger]
2008-04-14 23:55:25 +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
1accc12fb2 fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +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
fyodor
09512ff092 o Fix a bunch of warning/error messages which contained an extra
newline.  Thanks to Brandon Enright for the patch.
2007-12-21 03:38:04 +00:00
david
d08af8a057 List all interface aliases on Windows. All aliases of one interface will be
given the same name, e.g., "eth0". Use -e to choose the interface and -S to
choose the source address.
2007-11-26 23:44:20 +00:00
kris
b452a38426 Call arp_close() on arp handle in setTargetNextHopMAC() in tcpip.cc. This functions frees it and closes it's descriptor. Found with Coverity, CID 16 2007-11-16 01:50:51 +00:00
david
95fa8efd19 Don't include sys/sockio.h from tcpip.cc; it's already in tcpip.h. 2007-11-15 17:29:22 +00:00
david
21ee718329 Check for sys/sockio.h in configure and include sys/sockio.h in tcpip.cc. This is where SIOCGIFCONF is on Solaris 9. 2007-11-11 19:34:19 +00:00
kris
4cd9fa160d just fixing some spelling errors in comments 2007-11-03 03:54:11 +00:00
kris
1b1fcc753b Adding a new ping type: IPProto Ping. It's used with '-PO'. I've changed references to -P0 (zero) to -PN throughout the source code and refguide.xml 2007-10-28 00:05:03 +00:00
kris
3195434fed a minor change to that last rev: the setsockopt() calls in Nmap cast the option values to (const char *) 2007-10-14 15:12:49 +00:00
kris
dfc9eba4db enable --ttl support for connect() scans 2007-10-14 14:37:56 +00:00
david
eddc2b0839 Merge r5733:5850 from /nmap-exp/david/nmap-massping-migration.
Remove special-purpose log functions for graphing congestion control and other t
hings. There's enough information provided by -d3.

Update the congestion control graph program and add a program for graphing probe
s and drops.

Increase the initial ccthresh from 50 to 75.

Change how much the congestion threshold drops on packet drops.

Print group timing stats with -d2 and individual host timing stats with -d3.

Bump up the cc-graph.sh y axis limit to 80.

Put graphs in the same directory as their log file.

Go ahead and adjust timing for ICMP destination unreachables. I'm going to commi
t and experimental change to the congestion control that doesn't rely on this an
y more.

Scale group congestion control increments by the inverse of the packet
receipt ratio. This gives great performance without ignoring ICMP
destintation unreachable drops. This may be the breakthrough we've been
looking for.
I'll probably send a message about this later today. For information and        
graphs right now, see
http://www.bamsoftware.com/wiki/Nmap/ResponseRateScaledCongestionControl.
Sorry it's only in my nmap-massping-migration branch for now, but please
give it a try.

Only -d2 is now needed for cc-graph.sh.

Put a cap of 50 on the cwnd scaling factor.

Fix up the order of things in the packet_ratio debugging output.

Move the packet_ratio debugging output to printAnyStats and rearrange the order 
in which things are printed.

Put a header with the scan args at the top of the probes-graph.sh data files.

Add a function pcap_print_stats that shows the number of received and dropped pa
ckets for a descriptor.

Call pcap_print_stats after a run of ultra_scan.

Increase the congestion window less aggressively than before with -T4 and -T5 (s
till more aggressivly than with lesser timing values).
2007-09-18 06:34:33 +00:00
fyodor
4dc8618965 capitalization changes 2007-09-03 02:55:01 +00:00
fyodor
fc265b6d11 hopefully fix problem with vmware fusion - see http://seclists.org/nmap-dev/2007/q3/0254.html 2007-08-29 08:05:30 +00:00
david
302547375b Look out, world, here comes the Nmap massping migration!
This is the merging of the code that was previously in
/nmap-exp/david/nmap-massping-migration. These are all the big changes
that get rid of massping in favor of doing host discovery using
ultra_scan.

For now, there is a toggle that turns these new changes off. Undefine
NEW_MASSPING in targets.cc to go back to the old code. All of that will
be deleted eventually.

There are likely a few more changes that will be made to this system in
the near future. Those will be made in
/nmap-exp/david/nmap-massping-migration and merged back.

Don't release this just yet, because I'm going to make a few more
commits real quick to remove some debugging stuff.

(Note to self: this merge back was from r5693 in
/nmap-exp/david/nmap-massping-migration.)
2007-08-27 23:58:23 +00:00
kris
d073a19105 Change reason.cc/h to portreasons.cc/h. This is because of a reason.h on Windows which causes compilation problems. A workaround was employed, but this is incase it pops up again. I also changed the recent CHANGELOG entry mentioning reason.h so there's no confusion 2007-08-15 19:26:26 +00:00
kris
0b50c16b38 Adding Snprintf() and Vsnprintf() to nbase/nbase_str.c. This is because of Windows' stupid implementation where it doesn't write a NULL byte at the end of the buffer if the result is truncated. I would've just #defined snprintf and vsnprintf to some wrapper function for Windows, but this doesn't work as libdnet and libpcap (and libpcap includes under mswin32) define snprintf to _snprintf and vsnprintf to _vsnprintf like we do, and through the many defines they end up being available in the Nmap sources. Vsnprintf() uses vsnprintf() (and writes a NULL byte at the end if truncated), and Snprintf uses Vsnprintf(). 2007-08-14 06:46:54 +00:00