Nmap - the Network Mapper. Github mirror of official SVN repository. https://svn.nmap.org/
Find a file
david a91c7f75e4 Fix an infinite loop in nmap_dns.cc.
This changes the DNS engine to use addto_etchosts to add entries from
/etc/hosts into the DNS cache, rather than just inserting them using
push_front.

The reason for this is that there is a static unsigned variable in
addto_etchosts that keeps track of how many entries there are in the
cache. Using push_front bypassed this variable, allowing the entries in
/etc/hosts to sneak in under the radar. Thus is was possible for the
cache to contain, say, 266 entries when it thought it only had 256.

When the cache size is greater than or equal to 256, addto_etchosts runs
a deletion pass aiming to reduce the number of entries to 126. But the
peculiar loop logic of that function means that more than 256 entries
can be deleted. (How many more depends in part on how many entries there
are in /etc/hosts. There must be at least one for the hang to occur.)
When this happens, the signed counter underflows and becomes large
positive, ~65000. The code empties the cache trying to get the counter
under 127, but it can never happen.

To reproduce the hang, make an /etc/hosts file like this:

1.0.0.1 host-1-1
1.0.0.2 host-1-2
1.0.0.3 host-1-3
1.0.0.4 host-1-4
1.0.0.5 host-1-5
1.0.0.6 host-1-6
1.0.0.7 host-1-7
1.0.0.8 host-1-8
1.0.0.9 host-1-9
1.0.0.10 host-1-10
2.0.0.1 host-2
3.0.0.1 host-3
...
254.0.0.1 host-254
255.0.0.1 host-255

The hang can occur with even one entry in /etc/hosts, but saturating the
cache like this makes the hang less dependent on network conditions.
Then list-scan a netblock that is greater in size than 256 and is dense
in DNS entries (at least 256 entries per 4096 IP addresses). For
example,

nmap -sL scanme.nmap.org/22

works for me currently.
2008-03-14 21:45:41 +00:00
docs phrack 60-12 article link changed again, replaced it with a local version 2008-03-04 20:05:50 +00:00
libdnet-stripped Canonicalize interface type numbers used internally by libdnet. Also 2007-12-03 23:51:26 +00:00
liblua move back now 2007-11-27 22:42:03 +00:00
libpcap Delete auxiliary scripts config.guess, config.sub, depcomp, install-sh, 2007-11-27 06:22:46 +00:00
libpcre Upgrading libpcre from 7.4 to 7.6. Tested on Linux and Windows XP. 2008-02-16 20:55:50 +00:00
mswin32 fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nselib o Nmap now saves the target name (if any) specified on the command 2008-02-04 22:10:29 +00:00
nselib-bin Remove from the nselib-bin directory files that are automatically generated: 2007-11-29 09:44:30 +00:00
scripts moving debugger to nmap-exp/diman until further notice 2008-02-03 21:38:38 +00:00
acinclude.m4 Fix the test for GTK+ in configure.ac and move the macro RECVFROM_ARG6_TYPE from aclocal.m4 to acinclude.m4. 2007-10-22 23:27:22 +00:00
aclocal.m4 Check for Python only if Zenmap is requested, and bail out if Zenmap is 2007-11-22 08:37:34 +00:00
CHANGELOG Upgrading libpcre from 7.4 to 7.6. Tested on Linux and Windows XP. 2008-02-16 20:55:50 +00:00
charpool.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
charpool.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
config.guess Regenerate configure scripts with Autoconf 2.61 and update config.guess 2007-11-18 21:36:31 +00:00
config.h.in fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
config.sub Regenerate configure scripts with Autoconf 2.61 and update config.guess 2007-11-18 21:36:31 +00:00
configure Change the Nmap URL in a few more places 2008-01-17 07:36:50 +00:00
configure.ac URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00
COPYING fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
COPYING.OpenSSL get rid of silly top-level trunk dir 2005-04-11 22:34:19 +00:00
depcomp Delete auxiliary scripts config.guess, config.sub, depcomp, install-sh, 2007-11-27 06:22:46 +00:00
FingerPrintResults.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
FingerPrintResults.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
global_structures.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
HACKING URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00
idle_scan.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
idle_scan.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
INSTALL URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00
install-sh get rid of silly top-level trunk dir 2005-04-11 22:34:19 +00:00
ltmain.sh Delete auxiliary scripts config.guess, config.sub, depcomp, install-sh, 2007-11-27 06:22:46 +00:00
MACLookup.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
MACLookup.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
main.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
Makefile.in install the Zenmap man page during 'make install' 2008-01-24 01:36:01 +00:00
missing Delete auxiliary scripts config.guess, config.sub, depcomp, install-sh, 2007-11-27 06:22:46 +00:00
nmap-header-template.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap-mac-prefixes o Updated nmap-mac-prefixes with the latest IEEE data. Also added 2007-12-04 20:29:16 +00:00
nmap-os-db Fix a typo in a comment in nmap-os-db: indivudually -> individually. 2008-03-14 19:12:49 +00:00
nmap-protocols URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00
nmap-rpc URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00
nmap-service-probes Sophos Message Router match lines from Brandon Enright 2008-03-08 05:40:13 +00:00
nmap-services add hddtemp service suggested by Martin Guy 2008-02-02 20:37:06 +00:00
nmap.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap.spec.in URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00
nmap_amigaos.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap_dns.cc Fix an infinite loop in nmap_dns.cc. 2008-03-14 21:45:41 +00:00
nmap_dns.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap_error.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap_error.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap_rpc.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap_rpc.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap_tty.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap_tty.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nmap_winconfig.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
NmapOps.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
NmapOps.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
NmapOutputTable.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
NmapOutputTable.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
nse_auxiliar.cc 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
nse_auxiliar.h cannot directly include nmap_winconfig in these the way I was, or it will be included in nonwin32 2006-12-11 01:40:03 +00:00
nse_debug.cc merge soc07 r5085 - Changing bare printf()s to log_write(LOG_PLAIN,)s because these were always printed even when things like XML and greppable output were sent to stdout (e.g. -oX -). This also adds o.scriptTrace() to make --script-trace behave more like --packet-trace and --version-trace. Nsock tracing was done unconditionally in NSE, and that has been changed to only be done when o.scriptTrace() is true. 2007-08-11 05:13:16 +00:00
nse_debug.h NSE committed 2006-12-11 00:34:26 +00:00
nse_init.cc moving debugger to nmap-exp/diman until further notice 2008-02-03 21:38:38 +00:00
nse_init.h script arguments now get checked before nmap starts scanning 2007-08-20 21:56:36 +00:00
nse_macros.h adding nselib nselib-bin second (should work on unix now) 2007-11-27 22:18:59 +00:00
nse_main.cc Previously, process_mainloop() assumed that there can occur only one event for l_nsock_loop(). This is obviously wrong. This caused that some lua threads wakeups (when multiple events happend for one nsock_loop) were delayed. They were handled but way after real events happened. This patch changes the handing of events. Now we execute every lua thread which is in running_scripts(). I hope that every thread will be scheduled in nsock and removed from running_scripts and added to waiting_scripts. 2008-02-27 00:56:19 +00:00
nse_main.h script arguments now get checked before nmap starts scanning 2007-08-20 21:56:36 +00:00
nse_nmaplib.cc o Nmap now saves the target name (if any) specified on the command 2008-02-04 22:10:29 +00:00
nse_nmaplib.h NSE committed 2006-12-11 00:34:26 +00:00
nse_nsock.cc changing a couple log_write()s to use the SCRIPT_ENGINE macro rather than "SCRIPT ENGINE" literals 2008-01-21 17:18:51 +00:00
nse_nsock.h merge soc07 r5360:5367 - Merge Majek's raw packet NSE patch 2007-08-11 06:13:25 +00:00
nse_pcrelib.cc adjust pcre/pcre.h fix so it actually works. needs to be below a header which includes config.h 2007-11-28 18:46:17 +00:00
nse_pcrelib.h Revert r5485. This changes the pcre Lua module back to statically linked 2007-10-23 00:45:00 +00:00
nse_string.cc merge soc07 r4821 - fix nse build system issues 2007-08-11 03:35:12 +00:00
nse_string.h NSE committed 2006-12-11 00:34:26 +00:00
osscan.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
osscan.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
osscan2.cc improve the tcp options comment even more to ensure is inline with tcp options actually used 2008-03-13 05:34:17 +00:00
osscan2.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
output.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
output.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
portlist.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
portlist.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
portreasons.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
portreasons.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
protocols.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
protocols.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
README-WIN32 URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00
scan_engine.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
scan_engine.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
service_scan.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
service_scan.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
services.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
services.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
shtool misc 2005-06-24 23:50:23 +00:00
Target.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
Target.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
TargetGroup.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
TargetGroup.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
targets.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
targets.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
tcpip.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
tcpip.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
timing.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
timing.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
traceroute.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
traceroute.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
utils.cc fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
utils.h fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
zenmap.spec.in URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00

Here is some documentation for Nmap, but these files are much less
comprehensive than what you'll find at the actual Nmap documentation
site ( http://nmap.org ).