From 76acd0a496ecfbcf57466e6b9f96ed7af87729fa Mon Sep 17 00:00:00 2001 From: fyodor Date: Sat, 21 Jan 2006 23:57:49 +0000 Subject: [PATCH] Nmap 3.98BETA1 --- CHANGELOG | 37 ++- Makefile.in | 2 +- NmapOps.cc | 1 + NmapOps.h | 1 + docs/nmap.1 | 157 +++++----- docs/nmap.usage.txt | 44 +-- libdnet-stripped/NMAP_MODIFICATIONS | 3 + libdnet-stripped/configure | 79 +---- libdnet-stripped/configure.in | 27 +- libdnet-stripped/src/fw-ipchains.c | 227 -------------- libdnet-stripped/src/fw-ipf.c | 281 ------------------ libdnet-stripped/src/fw-ipfw.c | 324 -------------------- libdnet-stripped/src/fw-pf.c | 315 -------------------- libdnet-stripped/src/fw-pktfilter.c | 444 ---------------------------- mswin32/winfix.cc | 14 +- nmap.cc | 29 +- nmap_winconfig.h | 2 +- scripts/Makefile | 10 +- tty.cc | 12 +- utils.cc | 8 +- 20 files changed, 192 insertions(+), 1825 deletions(-) delete mode 100644 libdnet-stripped/src/fw-ipchains.c delete mode 100644 libdnet-stripped/src/fw-ipf.c delete mode 100644 libdnet-stripped/src/fw-ipfw.c delete mode 100644 libdnet-stripped/src/fw-pf.c delete mode 100644 libdnet-stripped/src/fw-pktfilter.c diff --git a/CHANGELOG b/CHANGELOG index 5c03ea125..75f6a896c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,10 +1,5 @@ # Nmap Changelog ($Id$); -*-text-*- - -o The 26 Nmap commands that previously included an underscore - (--max_rtt_timeout, --senc_eth, --host_timeout, etc.) have been - renamed to use a hyphen in the preferred format - (i.e. --max-rtt-timeout). Underscores are still supported for - backwared compatability. +3.98BETA1 o Added run time interaction as documented at http://www.insecure.org/nmap/man/man-runtime-interaction.html . @@ -39,9 +34,35 @@ o Added the --badsum option, which causes Nmap to use invalid TCP or author of that paper, Ed3f (ed3f(a)antifork.org), is also the author of this patch. +o The 26 Nmap commands that previously included an underscore + (--max_rtt_timeout, --send_eth, --host_timeout, etc.) have been + renamed to use a hyphen in the preferred format + (i.e. --max-rtt-timeout). Underscores are still supported for + backwared compatability. + o More excellent NmapFE patches from Priit Laes (amd(a)store20.com) - were applied to remove deprecated GTK API calls which could cause - compilation failures and also "Gtk-CRITICAL" warning messages. + were applied to remove all deprecated GTK API calls. This also + eliminates the annoying Gtk-Critical and Gtk-WARNING runtime messages. + +o Changed the way the __attribute__ compiler extension is detected so + that it works with the latest Fedora Core 4 updates (and perhaps other + systems). Thanks to Duilio Protti (dprotti(a)fceia.unr.edu.ar) for + writing the patch. The compilation error message this fixes was + usually something like: "nmap.o(.rodata+0x17c): undefined reference + to `__gthrw_pthread_cancel(unsigned long)" + +o Added some exception handling code to mswin32/winfix.cc to prevent + Nmap from crashing mysteriously when you have WinPcap 3.0 or earlier + (instead of the required 3.1). It now prints an error message instead + asking you to upgrade, then reduces functionality to connect()-only + mode. + +o Stripped the firewall API out of the libdnet included with Nmap + because Nmap doesn't use it anyway. This saves space and reduces the + likelyhood of compilation errors and warnings. + +o Modified the previously useless --noninteractive option so that it + deactivates runtime interaction. 3.96BETA1 diff --git a/Makefile.in b/Makefile.in index 1e8200e45..fa387e9fe 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -export NMAP_VERSION = 3.97Shmoo +export NMAP_VERSION = 3.98BETA1 NMAP_NAME= Nmap NMAP_URL= http://www.insecure.org/nmap/ NMAP_PLATFORM=@host@ diff --git a/NmapOps.cc b/NmapOps.cc index e71abd50c..9f75f91bc 100644 --- a/NmapOps.cc +++ b/NmapOps.cc @@ -250,6 +250,7 @@ void NmapOps::Initialize() { mass_dns = true; resolve_all = 0; dns_servers = NULL; + noninteractive = false; } bool NmapOps::TCPScan() { diff --git a/NmapOps.h b/NmapOps.h index 9e8f35ca3..d7e1d21cb 100644 --- a/NmapOps.h +++ b/NmapOps.h @@ -292,6 +292,7 @@ class NmapOps { int numhosts_up; int numhosts_scanning; stype scantype; + bool noninteractive; private: int max_rtt_timeout; diff --git a/docs/nmap.1 b/docs/nmap.1 index b097af23e..92aeaece3 100644 --- a/docs/nmap.1 +++ b/docs/nmap.1 @@ -2,7 +2,7 @@ .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. -.TH "NMAP" "1" "01/12/2006" "" "Nmap Reference Guide" +.TH "NMAP" "1" "01/21/2006" "" "Nmap Reference Guide" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -122,31 +122,31 @@ PORT SPECIFICATION AND SCAN ORDER: \-r: Scan ports consecutively \- don't randomize SERVICE/VERSION DETECTION: \-sV: Probe open ports to determine service/version info - \-\-version_light: Limit to most likely probes for faster identification - \-\-version_all: Try every single probe for version detection - \-\-version_trace: Show detailed version scan activity (for debugging) + \-\-version\-light: Limit to most likely probes for faster identification + \-\-version\-all: Try every single probe for version detection + \-\-version\-trace: Show detailed version scan activity (for debugging) OS DETECTION: \-O: Enable OS detection - \-\-osscan_limit: Limit OS detection to promising targets - \-\-osscan_guess: Guess OS more aggressively + \-\-osscan\-limit: Limit OS detection to promising targets + \-\-osscan\-guess: Guess OS more aggressively TIMING AND PERFORMANCE: \-T[0\-5]: Set timing template (higher is faster) - \-\-min_hostgroup/max_hostgroup : Parallel host scan group sizes - \-\-min_parallelism/max_parallelism : Probe parallelization - \-\-min_rtt_timeout/max_rtt_timeout/initial_rtt_timeout : Specifies + \-\-min\-hostgroup/max\-hostgroup : Parallel host scan group sizes + \-\-min\-parallelism/max\-parallelism : Probe parallelization + \-\-min_rtt_timeout/max\-rtt\-timeout/initial\-rtt\-timeout : Specifies probe round trip time. - \-\-max_retries : Caps number of port scan probe retransmissions. - \-\-host_timeout : Give up on target after this long - \-\-scan_delay/\-\-max_scan_delay : Adjust delay between probes + \-\-max\-retries : Caps number of port scan probe retransmissions. + \-\-host\-timeout : Give up on target after this long + \-\-scan\-delay/\-\-max_scan\-delay : Adjust delay between probes FIREWALL/IDS EVASION AND SPOOFING: \-f; \-\-mtu : fragment packets (optionally w/given MTU) \-D : Cloak a scan with decoys \-S : Spoof source address \-e : Use specified interface - \-g/\-\-source_port : Use given port number - \-\-data_length : Append random data to sent packets + \-g/\-\-source\-port : Use given port number + \-\-data\-length : Append random data to sent packets \-\-ttl : Set IP time\-to\-live field - \-\-spoof_mac : Spoof your MAC address + \-\-spoof\-mac : Spoof your MAC address \-\-badsum: Send packets with a bogus TCP/UDP checksum OUTPUT: \-oN/\-oX/\-oS/\-oG : Output scan in normal, XML, s|: Output in the three major formats at once \-v: Increase verbosity level (use twice for more effect) \-d[level]: Set or increase debugging level (Up to 9 is meaningful) - \-\-packet_trace: Show all packets sent and received + \-\-packet\-trace: Show all packets sent and received \-\-iflist: Print host interfaces and routes (for debugging) - \-\-append_output: Append to rather than clobber specified output files + \-\-append\-output: Append to rather than clobber specified output files \-\-resume : Resume an aborted scan \-\-stylesheet : XSL stylesheet to transform XML output to HTML \-\-webxml: Reference stylesheet from Insecure.Org for more portable XML @@ -165,7 +165,7 @@ MISC: \-6: Enable IPv6 scanning \-A: Enables OS detection and Version detection \-\-datadir : Specify custom Nmap data file location - \-\-send_eth/\-\-send_ip: Send using raw ethernet frames or IP packets + \-\-send\-eth/\-\-send\-ip: Send using raw ethernet frames or IP packets \-\-privileged: Assume that the user is fully privileged \-V: Print version number \-h: Print this help summary page. @@ -265,7 +265,7 @@ The option sends an ICMP echo request and a TCP packet to port 80 by default. When executed by an unprivileged user, a SYN packet is sent (using a \fBconnect()\fR call) to port 80 on the target. When a privileged user tries to scan targets on a local ethernet network, ARP requests (\fB\-PR\fR) are used unless -\fB\-\-send_ip\fR +\fB\-\-send\-ip\fR was specified. The \fB\-sP\fR option can be combined with any of the discovery probe types (the @@ -315,7 +315,7 @@ and .TP \fB\-PU [portlist]\fR (UDP Ping) Another host discovery option is the UDP ping, which sends an empty (unless -\fB\-\-data_length\fR +\fB\-\-data\-length\fR is specified) UDP packet to the given ports. The portlist takes the same format as with the previously discussed \fB\-PS\fR and @@ -349,7 +349,7 @@ ARP scan puts Nmap and its optimized algorithms in charge of ARP requests. And i \fB\-PE\fR or \fB\-PS\fR) are specified, Nmap uses ARP instead for any of the targets which are on the same LAN. If you absolutely don't want to do an ARP scan, specify -\fB\-\-send_ip\fR. +\fB\-\-send\-ip\fR. .TP \fB\-n\fR (No DNS resolution) Tells Nmap to @@ -453,7 +453,7 @@ A big challenge with UDP scanning is doing it quickly. Open and filtered ports r \fInet/ipv4/icmp.c\fR). .sp Nmap detects rate limiting and slows down accordingly to avoid flooding the network with useless packets that the target machine will drop. Unfortunately, a Linux\-style limit of one packet per second makes a 65,536\-port scan take more than 18 hours. Ideas for speeding your UDP scans up include scanning more hosts in parallel, doing a quick scan of just the popular ports first, scanning from behind the firewall, and using -\fB\-\-host_timeout\fR +\fB\-\-host\-timeout\fR to skip slow hosts. .TP \fB\-sN\fR; \fB\-sF\fR; \fB\-sX\fR (TCP Null, FIN, and Xmas scans) @@ -679,22 +679,22 @@ to scan all ports regardless of any Exclude directive. .TP -\fB\-\-version_intensity \fR (Set version scan intensity) +\fB\-\-version\-intensity \fR (Set version scan intensity) When performing a version scan (\fB\-sV\fR), nmap sends a series of probes, each of which is assigned a rarity value between 1 and 9. The lower\-numbered probes are effective against a wide variety of common services, while the higher numbered ones are rarely useful. The intensity level specifies which probes should be applied. The higher the number, the more likely it is the service will be correctly identified. However, high intensity scans take longer. The intensity must be between 0 and 9. The default is 7. When a probe is registered to the target port via the \fInmap\-service\-probes\fRports directive, that probe is tried regardless of intensity level. This ensures that the DNS probes will always be attempted against any open port 53, the SSL probe will be done against 443, etc. .TP -\fB\-\-version_light\fR (Enablie light mode) +\fB\-\-version\-light\fR (Enablie light mode) This is a convenience alias for -\fB\-\-version_intensity 2\fR. This light mode makes version scanning much faster, but it is slightly less likely to identify services. +\fB\-\-version\-intensity 2\fR. This light mode makes version scanning much faster, but it is slightly less likely to identify services. .TP -\fB\-\-version_all\fR (Try every single probe) +\fB\-\-version\-all\fR (Try every single probe) An alias for -\fB\-\-version_intensity 9\fR, ensuring that every single probe is attempted against each port. +\fB\-\-version\-intensity 9\fR, ensuring that every single probe is attempted against each port. .TP -\fB\-\-version_trace\fR (Trace version scan activity) +\fB\-\-version\-trace\fR (Trace version scan activity) This causes Nmap to print out extensive debugging info about what version scanning is doing. It is a subset of what you get with -\fB\-\-packet_trace\fR. +\fB\-\-packet\-trace\fR. .TP \fB\-sR\fR (RPC scan) This method works in conjunction with the various port scan methods of Nmap. It takes all the TCP/UDP ports found open and floods them with SunRPC program NULL commands in an attempt to determine whether they are RPC ports, and if so, what program and version number they serve up. Thus you can effectively obtain the same info as @@ -728,7 +728,7 @@ Enables OS detection, as discussed above. Alternatively, you can use \fB\-A\fR to enable both OS detection and version detection. .TP -\fB\-\-osscan_limit\fR (Limit OS detection to promising targets) +\fB\-\-osscan\-limit\fR (Limit OS detection to promising targets) OS detection is far more effective if at least one open and one closed TCP port are found. Set this option and Nmap will not even try OS detection against hosts that do not meet this criteria. This can save substantial time, particularly on \fB\-P0\fR scans against many hosts. It only matters when OS detection is requested with @@ -736,7 +736,7 @@ scans against many hosts. It only matters when OS detection is requested with or \fB\-A\fR. .TP -\fB\-\-osscan_guess\fR; \fB\-\-fuzzy\fR (Guess OS detection results) +\fB\-\-osscan\-guess\fR; \fB\-\-fuzzy\fR (Guess OS detection results) When Nmap is unable to detect a perfect OS match, it sometimes offers up near\-matches as possibilities. The match has to be very close for Nmap to do this by default. Either of these (equivalent) options make Nmap guess more aggressively. .SH "TIMING AND PERFORMANCE" .PP @@ -744,32 +744,32 @@ One of my highest Nmap development priorities has always been performance. A def .PP Techniques for improving scan times include omitting non\-critical tests, and upgrading to the latest version of Nmap (performance enhancements are made frequently). Optimizing timing parameters can also make a substantial difference. Those options are listed below. .TP -\fB\-\-min_hostgroup \fR; \fB\-\-max_hostgroup \fR (Adjust parallel scan group sizes) +\fB\-\-min\-hostgroup \fR; \fB\-\-max\-hostgroup \fR (Adjust parallel scan group sizes) Nmap has the ability to port scan or version scan multiple hosts in parallel. Nmap does this by dividing the target IP space into groups and then scanning one group at a time. In general, larger groups are more efficient. The downside is that host results can't be provided until the whole group is finished. So if Nmap started out with a group size of 50, the user would not receive any reports (except for the updates offered in verbose mode) until the first 50 hosts are completed. .sp By default, Nmap takes a compromise approach to this conflict. It starts out with a group size as low as five so the first results come quickly and then increases the groupsize to as high as 1024. The exact default numbers depend on the options given. For efficiency reasons, Nmap uses larger group sizes for UDP or few\-port TCP scans. .sp When a maximum group size is specified with -\fB\-\-max_hostgroup\fR, Nmap will never exceed that size. Specify a minimum size with -\fB\-\-min_hostgroup\fR +\fB\-\-max\-hostgroup\fR, Nmap will never exceed that size. Specify a minimum size with +\fB\-\-min\-hostgroup\fR and Nmap will try to keep group sizes above that level. Nmap may have to use smaller groups than you specify if there are not enough target hosts left on a given interface to fulfill the specified minimum. Both may be set to keep the group size within a specific range, though this is rarely desired. .sp The primary use of these options is to specify a large minimum group size so that the full scan runs more quickly. A common choice is 256 to scan a network in Class C sized chunks. For a scan with many ports, exceeding that number is unlikely to help much. For scans of just a few port numbers, host group sizes of 2048 or more may be helpful. .TP -\fB\-\-min_parallelism \fR; \fB\-\-max_parallelism \fR (Adjust probe parallelization) +\fB\-\-min\-parallelism \fR; \fB\-\-max\-parallelism \fR (Adjust probe parallelization) These options control the total number of probes that may be outstanding for a host group. They are used for port scanning and host discovery. By default, Nmap calculates an ever\-changing ideal parallelism based on network performance. If packets are being dropped, Nmap slows down and allows fewer outstanding probes. The ideal probe number slowly rises as the network proves itself worthy. These options place minimum or maximum bounds on that variable. By default, the ideal parallelism can drop to 1 if the network proves unreliable and rise to several hundred in perfect conditions. .sp The most common usage is to set -\fB\-\-min_parallelism\fR +\fB\-\-min\-parallelism\fR to a number higher than one to speed up scans of poorly performing hosts or networks. This is a risky option to play with, as setting it too high may affect accuracy. Setting this also reduces Nmap's ability to control parallelism dynamically based on network conditions. A value of ten might be reasonable, though I only adjust this value as a last resort. .sp The -\fB\-\-max_parallelism\fR +\fB\-\-max\-parallelism\fR option is sometimes set to one to prevent Nmap from sending more than one probe at a time to hosts. This can be useful in combination with -\fB\-\-scan_delay\fR +\fB\-\-scan\-delay\fR (discussed later), although the latter usually serves the purpose well enough by itself. .TP -\fB\-\-min_rtt_timeout