merge soc07 r5124:5142 - build/install system updates; changelog updates; umit install code; compilation fixes; integrate umit

This commit is contained in:
fyodor 2007-08-11 05:41:41 +00:00
parent 1ec0823730
commit 5528726e5b
35 changed files with 358 additions and 10650 deletions

View file

@ -2,8 +2,13 @@
4.22SOC1
o Upgraded from WinPcap 4.0 to WinPcap 4.01 and fixed a versioning
error [Eddie]
o The UMIT graphical Nmap frontend is now included (as an ALPHA TEST
release) with the Nmap tarball distribution. It isn't yet in the
RPMs or the Windows distributions. UMIT is written with Python/GTK
and has many huge advantages over NmapFE. It installs from the Nmap
source tarballs as part of the "make install" process unless you
specify --without-umit to configure. Please give UMIT a try (the
executable is named umit) and let us know the results!
o The port selection mechanism was overhauled. Nmap now knows
(roughly) how common various services are, so you can specify
@ -62,7 +67,8 @@ o The build dependencies were dramatically reduced by removing
This should make Nmap compilation faster and prevent some
portability problems. [David Fifield]
o Upgraded from WinPcap 3.1 to WinPcap 4.0 [Eddie]
o Upgraded from WinPcap 3.1 to WinPcap 4.01 and fixed a pcap installer
error. [Eddie]
o In verbose mode, Nmap now reports where it obtains data files (such as
nmap-services) from. [David Fifield]
@ -112,6 +118,8 @@ o A number of changes were made to the Windows build system to handle
version numbers, publisher field, add/remove program support,
etc. [Eddie]
o The Nmap -A option now enables the traceroute option too [Eddie]
o Improved how the Gen1 OS Detection system selects which UDP ports to
send probes to. [Kris]

View file

@ -53,6 +53,7 @@ TARGET = nmap
TARGETNMAPFE=@TARGETNMAPFE@
INSTALLNMAPFE=@INSTALLNMAPFE@
INSTALLNSE=@INSTALLNSE@
INSTALLUMIT=@INSTALLUMIT@
ifneq (@LIBLUA_LIBS@,)
NSE_SRC=nse_main.cc nse_auxiliar.cc nse_nsock.cc nse_init.cc nse_nmaplib.cc nse_debug.cc nse_pcrelib.cc nse_string.cc
@ -103,7 +104,7 @@ $(NSOCKDIR)/src/libnsock.a: $(NSOCKDIR)/src/Makefile FORCE
cd $(NSOCKDIR)/src && $(MAKE)
$(LIBLUADIR)/liblua.a: $(LIBLUADIR)/Makefile FORCE
@echo Compiling liblua; cd $(LIBLUADIR) && $(MAKE) @LUAFLAVOR@
@echo Compiling liblua; cd $(LIBLUADIR) && $(MAKE) liblua.a @LUAFLAGS@
#$(LIBPCAPDIR)/Makefile:
# @echo Configuring libpcap; cd $(LIBPCAPDIR); ./configure
@ -197,6 +198,9 @@ install-nmapfe: $(TARGETNMAPFE)
@echo "If the next command fails -- you cannot use the X front end"
-test -f nmapfe/nmapfe && $(INSTALL) -c -m 755 -s nmapfe/nmapfe $(DESTDIR)$(bindir)/nmapfe && rm -f $(DESTDIR)$(bindir)/xnmap && $(SHTOOL) mkln -f -s $(DESTDIR)$(bindir)/nmapfe $(DESTDIR)$(bindir)/xnmap && $(INSTALL) -c -m 644 nmapfe.desktop $(DESTDIR)$(deskdir)/nmapfe.desktop && $(INSTALL) -c -m 644 docs/nmapfe.1 $(DESTDIR)$(mandir)/man1/nmapfe.1 && $(INSTALL) -c -m 644 docs/xnmap.1 $(DESTDIR)$(mandir)/man1/xnmap.1
install-umit: umit/setup.py
cd umit && python setup.py install --prefix $(DESTDIR)$(prefix)
NSE_FILES = scripts/script.db scripts/*.nse
NSE_LIB_FILES = nselib/*lua nselib/*so
install-nse: $(TARGET)
@ -205,7 +209,8 @@ install-nse: $(TARGET)
$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(nmapdatadir)/nselib
cp -f $(NSE_LIB_FILES) $(DESTDIR)$(nmapdatadir)/nselib
install: install-nmap $(INSTALLNMAPFE) $(INSTALLNSE)
install: install-nmap $(INSTALLNMAPFE) $(INSTALLNSE) $(INSTALLUMIT)
@echo "NMAP SUCCESSFULLY INSTALLED"
uninstall:
rm -f $(bindir)/$(TARGET) $(bindir)/nmapfe $(bindir)/xnmap

115
configure vendored
View file

@ -673,12 +673,13 @@ host
host_cpu
host_vendor
host_os
LUAFLAVOR
LUAFLAGS
CPP
GREP
EGREP
TARGETNMAPFE
INSTALLNMAPFE
INSTALLUMIT
OPENSSL_LIBS
PCAP_DEPENDS
PCAP_CLEAN
@ -1300,7 +1301,8 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-localdirs Explicitly ask compiler to use
/usr/local/{include,libs} if they exist
--without-nmapfe skip nmapfe X-window GUI
--without-nmapfe Skip nmapfe X-window GUI
--without-umit Skip installation of the UMIT graphical frontend
--with-openssl=DIR Use optional openssl libs and includes from
DIR/lib/ and DIR/include/openssl/)
--with-libpcap=DIR Look for pcap in DIR/include and DIR/libs.
@ -3408,14 +3410,14 @@ case "$host" in
#define DEC 1
_ACEOF
LUAFLAVOR=posix
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-netbsd* | *-knetbsd*-gnu)
cat >>confdefs.h <<\_ACEOF
#define NETBSD 1
_ACEOF
LUAFLAVOR=bsd
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-openbsd*)
@ -3423,7 +3425,7 @@ _ACEOF
#define OPENBSD 1
_ACEOF
LUAFLAVOR=bsd
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-sgi-irix5*)
@ -3433,8 +3435,8 @@ _ACEOF
if test -z "$GCC"; then
sgi_cc=yes
LUAFLAVOR=posix
fi
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-sgi-irix6*)
cat >>confdefs.h <<\_ACEOF
@ -3444,7 +3446,7 @@ _ACEOF
if test -z "$GCC"; then
sgi_cc=yes
fi
LUAFLAVOR=posix
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-hpux*)
cat >>confdefs.h <<\_ACEOF
@ -3524,7 +3526,7 @@ _ACEOF
fi
LUAFLAVOR=posix
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.0*)
cat >>confdefs.h <<\_ACEOF
@ -3535,14 +3537,14 @@ _ACEOF
#define SOLARIS 1
_ACEOF
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.[1-9][0-9]*)
cat >>confdefs.h <<\_ACEOF
#define SOLARIS 1
_ACEOF
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.1*)
cat >>confdefs.h <<\_ACEOF
@ -3553,7 +3555,7 @@ _ACEOF
#define SOLARIS 1
_ACEOF
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.2*)
cat >>confdefs.h <<\_ACEOF
@ -3564,7 +3566,7 @@ _ACEOF
#define SOLARIS 1
_ACEOF
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.3*)
cat >>confdefs.h <<\_ACEOF
@ -3575,7 +3577,7 @@ _ACEOF
#define SOLARIS 1
_ACEOF
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.4*)
cat >>confdefs.h <<\_ACEOF
@ -3586,7 +3588,7 @@ _ACEOF
#define SOLARIS 1
_ACEOF
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.5.1)
cat >>confdefs.h <<\_ACEOF
@ -3597,14 +3599,14 @@ _ACEOF
#define SOLARIS 1
_ACEOF
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris*)
cat >>confdefs.h <<\_ACEOF
#define SOLARIS 1
_ACEOF
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-sunos4*)
cat >>confdefs.h <<\_ACEOF
@ -3615,7 +3617,7 @@ _ACEOF
#define SPRINTF_RETURNS_STRING 1
_ACEOF
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-linux*)
linux=yes
@ -3628,7 +3630,7 @@ _ACEOF
_ACEOF
# libpcap doesn't even LOOK at
# the timeout you give it under Linux
LUAFLAVOR=linux
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-freebsd* | *-kfreebsd*-gnu | *-dragonfly*)
@ -3636,7 +3638,7 @@ _ACEOF
#define FREEBSD 1
_ACEOF
LUAFLAVOR=bsd
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-bsdi*)
@ -3645,7 +3647,7 @@ _ACEOF
_ACEOF
LUAFLAVOR=bsd
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-apple-darwin*)
macosx=yes
@ -3654,10 +3656,10 @@ _ACEOF
_ACEOF
needs_cpp_precomp=yes
LUAFLAVOR=macosx
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_MACOSX\""
;;
*)
LUAFLAVOR=posix
LUAFLAGS=MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN"
esac
@ -5426,7 +5428,23 @@ fi
# First we test whether they specified openssl desires explicitly
# Do they want UMIT?
INSTALLUMIT=install-umit
# Check whether --with-umit was given.
if test "${with_umit+set}" = set; then
withval=$with_umit; case "$with_umit" in
no)
INSTALLUMIT=""
;;
esac
fi
# We test whether they specified openssl desires explicitly
use_openssl="yes"
specialssldir=""
@ -7067,6 +7085,7 @@ if test "${with_liblua+set}" = set; then
LUA_DEPENDS="$LIBLUADIR/liblua.a"
LUA_CLEAN="lua_clean"
LUA_DIST_CLEAN="lua_dist_clean"
have_lua="yes"
;;
no)
@ -9593,12 +9612,13 @@ host!$host$ac_delim
host_cpu!$host_cpu$ac_delim
host_vendor!$host_vendor$ac_delim
host_os!$host_os$ac_delim
LUAFLAVOR!$LUAFLAVOR$ac_delim
LUAFLAGS!$LUAFLAGS$ac_delim
CPP!$CPP$ac_delim
GREP!$GREP$ac_delim
EGREP!$EGREP$ac_delim
TARGETNMAPFE!$TARGETNMAPFE$ac_delim
INSTALLNMAPFE!$INSTALLNMAPFE$ac_delim
INSTALLUMIT!$INSTALLUMIT$ac_delim
OPENSSL_LIBS!$OPENSSL_LIBS$ac_delim
PCAP_DEPENDS!$PCAP_DEPENDS$ac_delim
PCAP_CLEAN!$PCAP_CLEAN$ac_delim
@ -9629,7 +9649,6 @@ NSOCKDIR!$NSOCKDIR$ac_delim
LIBNSOCK_LIBS!$LIBNSOCK_LIBS$ac_delim
GTK_CONFIG!$GTK_CONFIG$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@ -9668,6 +9687,50 @@ CEOF$ac_eof
_ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 1; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
{ (exit 1); exit 1; }; }
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
if test -n "$ac_eof"; then
ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
ac_eof=`expr $ac_eof + 1`
fi
cat >>$CONFIG_STATUS <<_ACEOF
cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
_ACEOF
sed '
s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
s/^/s,@/; s/!/@,|#_!!_#|/
:n
t n
s/'"$ac_delim"'$/,g/; t
s/$/\\/; p
N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
' >>$CONFIG_STATUS <conf$$subs.sed
rm -f conf$$subs.sed
cat >>$CONFIG_STATUS <<_ACEOF
:end
s/|#_!!_#|//g
CEOF$ac_eof
_ACEOF
# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
@ -9906,7 +9969,7 @@ s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
$ac_datarootdir_hack
" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed 's/|#_!!_#|//g' >$tmp/out
" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&

View file

@ -136,111 +136,111 @@ needs_cpp_precomp=no
case "$host" in
*alpha-dec-osf*)
AC_DEFINE(DEC)
LUAFLAVOR=posix
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-netbsd* | *-knetbsd*-gnu)
AC_DEFINE(NETBSD)
LUAFLAVOR=bsd
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-openbsd*)
AC_DEFINE(OPENBSD)
LUAFLAVOR=bsd
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-sgi-irix5*)
AC_DEFINE(IRIX)
if test -z "$GCC"; then
sgi_cc=yes
LUAFLAVOR=posix
fi
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-sgi-irix6*)
AC_DEFINE(IRIX)
if test -z "$GCC"; then
sgi_cc=yes
fi
LUAFLAVOR=posix
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-hpux*)
AC_DEFINE(HPUX)
# To link with libnet and NM (/usr/lib/libnm.sl) library
# on HP-UX 11.11 (other versions?) Mikhail Zakharov (zmey20000@yahoo.com)
AC_CHECK_LIB(nm, open_mib)
LUAFLAVOR=posix
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.0*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.[[1-9]][[0-9]]*)
AC_DEFINE(SOLARIS)
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.1*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.2*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.3*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.4*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris2.5.1)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-solaris*)
AC_DEFINE(SOLARIS)
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-sunos4*)
AC_DEFINE(SUNOS)
AC_DEFINE(SPRINTF_RETURNS_STRING)
LUAFLAVOR=solaris
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-linux*)
linux=yes
AC_DEFINE(LINUX)
AC_DEFINE(PCAP_TIMEOUT_IGNORED) # libpcap doesn't even LOOK at
# the timeout you give it under Linux
LUAFLAVOR=linux
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-freebsd* | *-kfreebsd*-gnu | *-dragonfly*)
AC_DEFINE(FREEBSD)
LUAFLAVOR=bsd
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-bsdi*)
AC_DEFINE(BSDI)
LUAFLAVOR=bsd
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""
;;
*-apple-darwin*)
macosx=yes
AC_DEFINE(MACOSX)
needs_cpp_precomp=yes
LUAFLAVOR=macosx
LUAFLAGS="MYCFLAGS=\"-DLUA_USE_MACOSX\""
;;
*)
LUAFLAVOR=posix
LUAFLAGS=MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN"
esac
AC_SUBST(LUAFLAVOR)
AC_SUBST(LUAFLAGS)
AC_SEARCH_LIBS(dlopen, dl)
dnl equiv to '#define inline' to 'inline', '__inline__', '__inline' or ''
@ -300,7 +300,7 @@ test "${with_nmapfe+set}" != "set" && with_nmapfe=yes
TARGETNMAPFE=nmapfe/nmapfe
INSTALLNMAPFE=install-nmapfe
AC_ARG_WITH(nmapfe, AC_HELP_STRING([--without-nmapfe], [skip nmapfe X-window GUI]),
AC_ARG_WITH(nmapfe, AC_HELP_STRING([--without-nmapfe], [Skip nmapfe X-window GUI]),
[ case "$with_nmapfe" in
no)
TARGETNMAPFE=""; INSTALLNMAPFE=""
@ -310,7 +310,19 @@ AC_ARG_WITH(nmapfe, AC_HELP_STRING([--without-nmapfe], [skip nmapfe X-window GUI
AC_SUBST(TARGETNMAPFE)
AC_SUBST(INSTALLNMAPFE)
# First we test whether they specified openssl desires explicitly
# Do they want UMIT?
INSTALLUMIT=install-umit
AC_ARG_WITH(umit, AC_HELP_STRING([--without-umit], [Skip installation of the UMIT graphical frontend]),
[ case "$with_umit" in
no)
INSTALLUMIT=""
;;
esac]
)
AC_SUBST(INSTALLUMIT)
# We test whether they specified openssl desires explicitly
use_openssl="yes"
specialssldir=""
@ -589,6 +601,7 @@ AC_HELP_STRING([--without-liblua], [Compile without lua (this will exclude all o
LUA_DEPENDS="$LIBLUADIR/liblua.a"
LUA_CLEAN="lua_clean"
LUA_DIST_CLEAN="lua_dist_clean"
have_lua="yes"
;;
no)

View file

@ -12,5 +12,3 @@
/ / _/ / + / \/
' (__/ / \
NMAP IS A POWERFUL TOOL -- USE CAREFULLY AND RESPONSIBLY
[ Sick of the Nmap dragon? Submit your art and tag ]
[ lines to nmap-dev@insecure.org for next release! ]

View file

@ -1,620 +0,0 @@
[ NOTE -- A more up-to-date version of this paper and translations to
many other languages are available from
http://www.insecure.org/nmap/nmap-fingerprinting-article.html ]
Remote OS detection via TCP/IP Stack FingerPrinting
by Fyodor <fyodor@insecure.org> (www.insecure.org)
October 18, 1998
ABSTRACT
This paper discusses how to glean precious information about a host by
querying its TCP/IP stack. I first present some of the "classical"
methods of determining host OS which do not involve stack
fingerprinting. Then I describe the current "state of the art" in
stack fingerprinting tools. Next comes a description of many
techniques for causing the remote host to leak information about
itself. Finally I detail my (nmap) implementation of this, followed
by a snapshot gained from nmap which discloses what OS is running on
many popular Internet sites.
REASONS
I think the usefulness of determining what OS a system is running is
pretty obvious, so I'll make this section short. One of the strongest
examples of this usefulness is that many security holes are dependent
on OS version. Lets say you are doing a penetration test and you find
port 53 open. If this is a vulnerable version of Bind, you only get
one chance to exploit it since a failed attempt will crash the daemon.
With a good TCP/IP fingerprinter, you will quickly find that this
machine is running 'Solaris 2.51' or 'Linux 2.0.35' and you can adjust
your shellcode accordingly.
A worse possibility is someone scanning 500,000 hosts in advance to
see what OS is running and what ports are open. Then when someone
posts (say) a root hole in Sun's comsat daemon, our little cracker
could grep his list for 'UDP/512' and 'Solaris 2.6' and he immediately
has pages and pages of rootable boxes. It should be noted that this
is SCRIPT KIDDIE behavior. You have demonstrated no skill and nobody
is even remotely impressed that you were able to find some vulnerable
.edu that had not patched the hole in time. Also, people will be even
_less_ impressed if you use your newfound access to deface the
department's web site with a self-aggrandizing rant about how damn
good you are and how stupid the sysadmins must be.
Another possible use is for social engineering. Lets say that you are
scanning your target company and nmap reports a 'Datavoice TxPORT
PRISM 3000 T1 CSU/DSU 6.22/2.06'. The hacker might now call up as
'Datavoice support' and discuss some issues about their PRISM 3000.
"We are going to announce a security hole soon, but first we want all
our current customers to install the patch -- I just mailed it to you
..." Some naive administrators might assume that only an authorized
engineer from Datavoice would know so much about their CSU/DSU.
Another potential use of this capability is evaluation of companies
you may want to do business with. Before you choose a new ISP, scan
them and see what equipment is in use. Those "$99/year" deals don't
sound nearly so good when you find out they have crappy routers and
offer PPP services off a bunch of Windows boxes.
CLASSICAL TECHNIQUES
Stack fingerprinting solves the problem of OS identification in a
unique way. I think this technique holds the most promise, but there
are currently many other solutions. Sadly, this is still one the most
effective of those techniques:
playground~> telnet hpux.u-aizu.ac.jp
Trying 163.143.103.12...
Connected to hpux.u-aizu.ac.jp.
Escape character is '^]'.
HP-UX hpux B.10.01 A 9000/715 (ttyp2)
login:
There is no point going to all this trouble of fingerprinting if the
machine will blatantly announce to the world exactly what it is
running! Sadly, many vendors ship _current_ systems with these kind
of banners and many admins do not turn them off. Just because there
are other ways to figure out what OS is running (such as
fingerprinting), does not mean we should just announce our OS and
architecture to every schmuck who tries to connect.
The problems with relying on this technique are that an increasing
number of people are turning banners off, many systems don't give much
information, and it is trivial for someone to "lie" in their banners.
Nevertheless, banner reading is all you get for OS and OS Version
checking if you spend $thousands on the commercial ISS scanner.
Download nmap or queso instead and save your money :).
Even if you turn off the banners, many applications will happily give
away this kind of information when asked. For example lets look at an
FTP server:
payfonez> telnet ftp.netscape.com 21
Trying 207.200.74.26...
Connected to ftp.netscape.com.
Escape character is '^]'.
220 ftp29 FTP server (UNIX(r) System V Release 4.0) ready.
SYST
215 UNIX Type: L8 Version: SUNOS
First of all, it gives us system details in its default banner. Then
if we give the 'SYST' command it happily feeds back even more information.
If anon FTP is supported, we can often download /bin/ls or other
binaries and determine what architecture it was built for.
Many other applications are too free with information. Take web
servers for example:
playground> echo 'GET / HTTP/1.0\n' | nc hotbot.com 80 | egrep '^Server:'
Server: Microsoft-IIS/4.0
playground>
Hmmm ... I wonder what OS those lamers are running.
Other classic techniques include DNS host info records (rarely
effective) and social engineering. If the machine is listening on
161/udp (snmp), you are almost guaranteed a bunch of detailed info
using 'snmpwalk' from the CMU SNMP tools distribution and the 'public'
community name.
CURRENT FINGERPRINTING PROGRAMS
Nmap is not the first OS recognition program to use TCP/IP
fingerprinting. The common IRC spoofer sirc by Johan has included
very rudimentary fingerprinting techniques since version 3 (or
earlier). It attempts to place a host in the classes "Linux",
"4.4BSD", "Win95", or "Unknown" using a few simple TCP flag tests.
Another such program is checkos, released publicly in January of this
year by Shok in Confidence Remains High Issue #7.
The fingerprinting techniques are exactly the same as SIRC, and even
the _code_ is identical in many places. Checkos was privately
available for a long time prior to the public release, so I have no
idea who swiped code from whom. But neither seems to credit the
other. One thing checkos does add is telnet banner checking, which is
useful but has the problems described earlier. [ Update: Shok wrote in
to say that chekos was never intended to be public and this is why he
didn't bother to credit SIRC for some of the code. ]
Su1d also wrote an OS checking program. His is called SS and as of
Version 3.11 it can identify 12 different OS types. I am somewhat
partial to this one since he credits my nmap program for some of the
networking code :).
Then there is queso. This program is the newest and it is a huge leap
forward from the other programs. Not only do they introduce a couple
new tests, but they were the first (that I have seen) to move the
OS fingerprints _out_ of the code. The other scanners included code like:
/* from ss */
if ((flagsfour & TH_RST) && (flagsfour & TH_ACK) && (winfour == 0) &&
(flagsthree & TH_ACK))
reportos(argv[2],argv[3],"Livingston Portmaster ComOS");
Instead, queso moves this into a configuration file which obviously
scales much better and makes adding an OS as easy as appending a few
lines to a fingerprint file.
Queso was written by Savage, one of the fine folks at Apostols.org .
One problem with all the programs describe above is that they are very
limited in the number of fingerprinting tests which limits the
granularity of answers. I want to know more than just 'this machine
is OpenBSD, FreeBSD, or NetBSD', I wish to know exactly which of those
it is as well as some idea of the release version number. In the same
way, I would rather see 'Solaris 2.6' than simply 'Solaris'. To
achieve this response granularity, I worked on a number of
fingerprinting techniques which are described in the next section.
FINGERPRINTING METHODOLOGY
There are many, many techniques which can be used to fingerprint
networking stacks. Basically, you just look for things that differ
among operating systems and write a probe for the difference. If you
combine enough of these, you can narrow down the OS very tightly. For
example nmap can reliably distinguish Solaris 2.4 vs. Solaris 2.5-2.51
vs Solaris 2.6. It can also tell Linux kernel 2.0.30 from 2.0.31-34
or 2.0.35. Here are some techniques:
The FIN probe -- Here we send a FIN packet (or any packet without an
ACK or SYN flag) to an open port and wait for a response. The
correct RFC793 behavior is to NOT respond, but many broken
implementations such as MS Windows, BSDI, CISCO, HP/UX, MVS, and
IRIX send a RESET back. Most current tools utilize this
technique.
The BOGUS flag probe -- Queso is the first scanner I have seen to use
this clever test. The idea is to set an undefined TCP "flag" ( 64
or 128) in the TCP header of a SYN packet. Linux boxes prior to
2.0.35 keep the flag set in their response. I have not found any
other OS to have this bug. However, some operating systems seem
to reset the connection when they get a SYN+BOGUS packet. This
behavior could be useful in identifying them.
TCP ISN Sampling -- The idea here is to find patterns in the initial
sequence numbers chosen by TCP implementations when responding to
a connection request. These can be categorized in to many groups
such as the traditional 64K (many old UNIX boxes), Random
increments (newer versions of Solaris, IRIX, FreeBSD, Digital
UNIX, Cray, and many others), True "random" (Linux 2.0.*, OpenVMS,
newer AIX, etc). Windows boxes (and a few others) use a "time
dependent" model where the ISN is incremented by a small fixed
amount each time period. Needless to say, this is almost as
easily defeated as the old 64K behavior. Of course my favorite
technique is "constant". The machines ALWAYS use the exact same
ISN :). I've seen this on some 3Com hubs (uses 0x803) and Apple
LaserWriter printers (uses 0xC7001).
You can also subclass groups such as random incremental by
computing variances, greatest common divisors, and other functions
on the set of sequence numbers and the differences between the
numbers.
It should be noted that ISN generation has important security
implications. For more information on this, contact "security
expert" Tsutomu "Shimmy" Shimomura at SDSC and ask him how he was
owned. Nmap is the first program I have seen to use this for OS
identification.
Don't Fragment bit -- Many operating systems are starting to set the
IP "Don't Fragment" bit on some of the packets they send. This
gives various performance benefits (though it can also be annoying
-- this is why nmap fragmentation scans do not work from Solaris
boxes). In any case, not all OS's do this and some do it in
different cases, so by paying attention to this bit we can glean
even more information about the target OS. I haven't seen this
one before either.
TCP Initial Window -- This simply involves checking the window size on
returned packets. Older scanners simply used a non-zero window on
a RST packet to mean "BSD 4.4 derived". Newer scanners such as
queso and nmap keep track of the exact window since it is actually
pretty constant by OS type. This test actually gives us a lot of
information, since some operating systems can be uniquely
identified by the window alone (for example, AIX is the only OS I
have seen which uses 0x3F25). In their "completely rewritten"
TCP stack for NT5, Microsoft uses 0x402E. Interestingly, that is
exactly the number used by OpenBSD and FreeBSD.
ACK Value -- Although you would think this would be completely
standard, implementations differ in what value they use for the
ACK field in some cases. For example, lets say you send a
FIN|PSH|URG to a closed TCP port. Most implementations will set
the ACK to be the same as your initial sequence number, though
Windows and some stupid printers will send your seq + 1. If you
send a SYN|FIN|URG|PSH to an open port, Windows is very
inconsistent. Sometimes it sends back your seq, other times it
sends S++, and still other times is sends back a seemingly random
value. One has to wonder what kind of code MS is writing that
changes its mind like this.
ICMP Error Message Quenching -- Some (smart) operating systems follow
the RFC 1812 suggestion to limit the rate at which various error
messages are sent. For example, the Linux kernel (in
net/ipv4/icmp.h) limits destination unreachable message generation
to 80 per 4 seconds, with a 1/4 second penalty if that is
exceeded. One way to test this is to send a bunch of packets to
some random high UDP port and count the number of unreachables
received. I have not seen this used before, and in fact I have
not added this to nmap (except for use in UDP port scanning).
This test would make the OS detection take a bit longer since you
need to send a bunch of packets and wait for them to return. Also
dealing with the possibility of packets dropped on the network
would be a pain.
ICMP Message Quoting -- The RFCs specify that ICMP error messages
quote some small amount of an ICMP message that causes various
errors. For a port unreachable message, almost all
implementations send only the required IP header + 8 bytes back.
However, Solaris sends back a bit more and Linux sends back even
more than that. The beauty with this is it allows nmap to
recognize Linux and Solaris hosts even if they don't have any
ports listening.
ICMP Error message echoing integrity -- I got this idea from something
Theo De Raadt (lead OpenBSD developer) posted to
comp.security.unix. As mentioned before, machines have to send
back part of your original message along with a port unreachable
error. Yet some machines tend to use your headers as 'scratch
space' during initial processing and so they are a bit warped by
the time you get them back. For example, AIX and BSDI send back an
IP 'total length' field that is 20 bytes too high. Some BSDI,
FreeBSD, OpenBSD, ULTRIX, and VAXen fuck up the IP ID that you sent
them. While the checksum is going to change due to the changed
TTL anyway, there are some machines (AIX, FreeBSD, etc.) which send
back an inconsistent or 0 checksum. Same thing goes with the UDP
checksum. All in all, nmap does nine different tests on the ICMP
errors to sniff out subtle differences like these.
Type of Service -- For the ICMP port unreachable messages I look at
the type of service (TOS) value of the packet sent back. Almost
all implementations use 0 for this ICMP error although Linux uses
0xC0. This does not indicate one of the standard TOS values, but instead is
part of the unused (AFAIK) precedence field. I do not know why
this is set, but if they change to 0 we will be able to keep
identifying the old versions _and_ we will be able to identify
between old and new.
Fragmentation Handling -- This is a favorite technique of Thomas
H. Ptacek of Secure Networks, Inc (now owned by a bunch of Windows
users at NAI). This takes advantage of the fact that different
implementations often handle overlapping IP fragments differently.
Some will overwrite the old portions with the new, and in other
cases the old stuff has precedence. There are many different
probes you can use to determine how the packet was reassembled. I
did not add this capability since I know of no portable way to send
IP fragments (in particular, it is a bitch on Solaris). For more
information on overlapping fragments, you can read their IDS paper
(www.secnet.com).
TCP Options -- These are truly a gold mine in terms of leaking
information. The beauty of these options is that:
1) They are generally optional (duh!) :) so not all hosts implement
them.
2) You know if a host implements them by sending a query with an
option set. The target generally show support of the option by
setting it on the reply.
3) You can stuff a whole bunch of options on one packet to test
everything at once.
Nmap sends these options along with almost every probe packet:
Window Scale=10; NOP; Max Segment Size = 265; Timestamp; End of Ops;
When you get your response, you take a look at which options were
returned and thus are supported. Some operating systems such as
recent FreeBSD boxes support all of the above, while others, such
as Linux 2.0.X support very few. The latest Linux 2.1.x kernels
do support all of the above. On the other hand, they are more
vulnerable to TCP sequence prediction. Go figure.
Even if several operating systems support the same set of options,
you can sometimes distinguish them by the _values_ of the options.
For example, if you send a small MSS value to a Linux box, it will
generally echo that MSS back to you. Other hosts will give you
different values.
And even if you get the same set of supported options AND the same
values, you can still differentiate via the _order_ that the
options are given, and where padding is applied. For example
Solaris returns 'NNTNWME' which means:
<no op><no op><timestamp><no op><window scale><echoed MSS>
While Linux 2.1.122 returns MENNTNW. Same options, same values,
but different order!
I have not seen any other OS detection tools utilizes TCP options,
but it is very useful.
There are a few other useful options I might probe for at some
point, such as those that support T/TCP and selective
acknowledgements.
Exploit Chronology -- Even with all the tests above, nmap is unable to
distinguish between the TCP stacks of Win95, WinNT, or Win98.
This is rather surprising, especially since Win98 came out about 4
years after Win95. You would think they would have bothered to
improve the stack in some way (like supporting more TCP options)
and so we would be able to detect the change and distinguish the
operating systems. Unfortunately, this is not the case. The NT
stack is apparently the same crappy stack they put into '95. And
they didn't bother to upgrade it for '98.
But do not give up hope, for there is a solution. You can simply
start with early Windows DOS attacks (Ping of Death, Winnuke, etc)
and move up a little further to attacks such as Teardrop and Land.
After each attack, ping them to see whether they have crashed.
When you finally crash them, you will likely have narrowed what
they are running down to one service pack or hotfix.
I have not added this functionality to nmap, although I must admit
it is very tempting :).
SYN Flood Resistance -- Some operating systems will stop accepting new
connections if you send too many forged SYN packets at them
(forging the packets avoids trouble with your kernel resetting the
connections). Many operating systems can only handle 8 packets.
Recent Linux kernels (among other operating systems) allow
various methods such as SYN cookies to prevent this from being a
serious problem. Thus you can learn something about your target
OS by sending 8 packets from a forged source to an open port and
then testing whether you can establish a connection to that port
yourself. This was not implemented in nmap since some people get
upset when you SYN flood them. Even explaining that you were
simply trying to determine what OS they are running might not help
calm them.
NMAP IMPLEMENTATION AND RESULTS
I have created a reference implementation of the OS detection
techniques mentioned above (except those I said were excluded). I
have added this to my Nmap scanner which has the advantage that it
already _knows_ what ports are open and closed for fingerprinting so
you do not have to tell it. It is also portable among Linux, *BSD,
and Solaris 2.51 and 2.6, and some other operating systems.
The new version of nmap reads a file filled with Fingerprint templates
that follow a simple grammar. Here is an example:
FingerPrint IRIX 6.2 - 6.4 # Thanks to Lamont Granquist
TSeq(Class=i800)
T1(DF=N%W=C000|EF2A%ACK=S++%Flags=AS%Ops=MNWNNT)
T2(Resp=Y%DF=N%W=0%ACK=S%Flags=AR%Ops=)
T3(Resp=Y%DF=N%W=C000|EF2A%ACK=O%Flags=A%Ops=NNT)
T4(DF=N%W=0%ACK=O%Flags=R%Ops=)
T5(DF=N%W=0%ACK=S++%Flags=AR%Ops=)
T6(DF=N%W=0%ACK=O%Flags=R%Ops=)
T7(DF=N%W=0%ACK=S%Flags=AR%Ops=)
PU(DF=N%TOS=0%IPLEN=38%RIPTL=148%RID=E%RIPCK=E%UCK=E%ULEN=134%DAT=E)
Lets look at the first line (I'm adding '>' quote markers):
> FingerPrint IRIX 6.2 - 6.3 # Thanks to Lamont Granquist
This simply says that the fingerprint covers IRIX versions 6.2 through
6.3 and the comment states that Lamont Granquist kindly sent me the IP
addresses or fingerprints of the IRIX boxes tested.
> TSeq(Class=i800)
This means that ISN sampling put it in the "i800 class". This means
that each new sequence number is a multiple of 800 greater than the
last one.
> T1(DF=N%W=C000|EF2A%ACK=S++%Flags=AS%Ops=MNWNNT)
The test is named T1 (for test1, clever eh?). In this test we send a
SYN packet with a bunch of TCP options to an open port. DF=N means
that the "Don't fragment" bit of the response must not be set.
W=C000|EF2A means that the window advertisement we received must
be 0xC000 or EF2A. ACK=S++ means the acknowledgement we receive must
be our initial sequence number plus 1. Flags = AS means the ACK and
SYN flags were sent in the response. Ops = MNWNNT means the options
in the response must be (in this order):
<MSS (not echoed)><NOP><Window scale><NOP><NOP><Timestamp>
> T2(Resp=Y%DF=N%W=0%ACK=S%Flags=AR%Ops=)
Test 2 involves a NULL with the same options to an open port. Resp=Y
means we must get a response. Ops= means that there must not be any
options included in the response packet. If we took out '%Ops='
entirely then any options sent would match.
> T3(Resp=Y%DF=N%W=400%ACK=S++%Flags=AS%Ops=M)
Test 3 is a SYN|FIN|URG|PSH w/options to an open port.
> T4(DF=N%W=0%ACK=O%Flags=R%Ops=)
This is an ACK to an open port. Note that we do not have a Resp=
here. This means that lack of a response (such as the packet being
dropped on the network or an evil firewall) will not disqualify a
match as long as all the other tests match. We do this because
virtually any OS will send a response, so a lack of response is
generally an attribute of the network conditions and not the OS
itself. We put the Resp tag in tests 2 and 3 because some operating
systems _do_ drop those without responding.
> T5(DF=N%W=0%ACK=S++%Flags=AR%Ops=)
> T6(DF=N%W=0%ACK=O%Flags=R%Ops=)
> T7(DF=N%W=0%ACK=S%Flags=AR%Ops=)
These tests are a SYN, ACK, and FIN|PSH|URG, respectively, to a closed
port. The same options as always are set. Of course this is all
probably obvious given the descriptive names 'T5', 'T6', and 'T7' :).
> PU(DF=N%TOS=0%IPLEN=38%RIPTL=148%RID=E%RIPCK=E%UCK=E%ULEN=134%DAT=E)
This big sucker is the 'port unreachable' message test. You should
recognize the DF=N by now. TOS=0 means that IP type of service field
was 0. The next two fields give the (hex) values of the IP total
length field of the message IP header and the total length given in
the IP header they are echoing back to us. RID=E means the RID value
we got back in the copy of our original UDP packet was expected (ie
the same as we sent). RIPCK=E means they didn't fuck up the checksum
(if they did, it would say RIPCK=F). UCK=E means the UDP checksum is
also correct. Next comes the UDP length which was 0x134 and DAT=E
means they echoed our UDP data correctly. Since most implementations
(including this one) do not send any of our UDP data back, they get
DAT=E by default.
The version of nmap with this functionality is currently in the 6th
private beta cycle. It may be out by the time you read this in
Phrack. Then again, it might not. See http://www.insecure.org/nmap/
for the latest version.
POPULAR SITE SNAPSHOTS
Here is the fun result of all our effort. We can now take random
Internet sites and determine what OS they are using. A lot of these
people have eliminated telnet banners, etc. to keep this information
private. But this is of no use with our new fingerprinter! Also
this is a good way to expose the <your favorite crap OS> users as the
lamers that they are :)!
The command used in these examples was: nmap -sS -p 80 -O -v <host>
Also note that most of these scans were done on 10/18/98. Some of
these folks may have upgraded/changed servers since then.
Note that I do not like every site on here.
# "Hacker" sites or (in a couple cases) sites that think they are
www.l0pht.com => OpenBSD 2.2 - 2.4
www.insecure.org => Linux 2.0.31-34
www.rhino9.ml.org => Windows 95/NT # No comment :)
www.technotronic.com => Linux 2.0.31-34
www.nmrc.org => FreeBSD 2.2.6 - 3.0
www.cultdeadcow.com => OpenBSD 2.2 - 2.4
www.kevinmitnick.com => Linux 2.0.31-34 # Free Kevin!
www.2600.com => FreeBSD 2.2.6 - 3.0 Beta
www.antionline.com => FreeBSD 2.2.6 - 3.0 Beta
www.rootshell.com => Linux 2.0.35 # Changed to OpenBSD after
# they got owned.
# Security vendors, consultants, etc.
www.repsec.com => Linux 2.0.35
www.iss.net => Linux 2.0.31-34
www.checkpoint.com => Solaris 2.5 - 2.51
www.infowar.com => Win95/NT
# Vendor loyalty to their OS
www.li.org => Linux 2.0.35 # Linux International
www.redhat.com => Linux 2.0.31-34 # I wonder what distribution :)
www.debian.org => Linux 2.0.35
www.linux.org => Linux 2.1.122 - 2.1.126
www.sgi.com => IRIX 6.2 - 6.4
www.netbsd.org => NetBSD 1.3X
www.openbsd.org => Solaris 2.6 # Ahem :)
www.freebsd.org => FreeBSD 2.2.6-3.0 Beta
# Ivy league
www.harvard.edu => Solaris 2.6
www.yale.edu => Solaris 2.5 - 2.51
www.caltech.edu => SunOS 4.1.2-4.1.4 # Hello! This is the 90's :)
www.stanford.edu => Solaris 2.6
www.mit.edu => Solaris 2.5 - 2.51 # Coincidence that so many good
# schools seem to like Sun?
# Perhaps it is the 40%
# .edu discount :)
www.berkeley.edu => UNIX OSF1 V 4.0,4.0B,4.0D
www.oxford.edu => Linux 2.0.33-34 # Rock on!
# Lamer sites
www.aol.com => IRIX 6.2 - 6.4 # No wonder they are so insecure :)
www.happyhacker.org => OpenBSD 2.2-2.4 # Sick of being owned, Carolyn?
# Even the most secure OS is
# useless in the hands of an
# incompetent admin.
# Misc
www.lwn.net => Linux 2.0.31-34 # This Linux news site rocks!
www.slashdot.org => Linux 2.1.122 - 2.1.126
www.whitehouse.gov => IRIX 5.3
sunsite.unc.edu => Solaris 2.6
Notes: In their security white paper, Microsoft said about their lax
security: "this assumption has changed over the years as Windows NT
gains popularity largely because of its security features.". Hmm,
from where I stand it doesn't look like Windows is very popular among
the security community :). I only see 2 Windows boxes from the whole
group, and Windows is _easy_ for nmap to distinguish since it is so
broken (standards wise).
And of course, there is one more site we must check. This is the web
site of the ultra-secret Transmeta corporation. Interestingly the
company was funded largely by Paul Allen of Microsoft, but it employs
Linus Torvalds. So do they stick with Paul and run NT or do they side
with the rebels and join the Linux revolution? Let us see:
We use the command:
nmap -sS -F -o transmeta.log -v -O www.transmeta.com/24
This says SYN scan for known ports (from /etc/services), log the
results to 'transmeta.log', be verbose about it, do an OS scan, and
scan the class 'C' where www.transmeta.com resides. Here is the gist
of the results:
neon-best.transmeta.com (206.184.214.10) => Linux 2.0.33-34
www.transmeta.com (206.184.214.11) => Linux 2.0.30
neosilicon.transmeta.com (206.184.214.14) => Linux 2.0.33-34
ssl.transmeta.com (206.184.214.15) => Linux unknown version
linux.kernel.org (206.184.214.34) => Linux 2.0.35
www.linuxbase.org (206.184.214.35) => Linux 2.0.35 ( possibly the same
machine as above )
Well, I think this answers our question pretty clearly :).
ACKNOWLEDGEMENTS
The only reason Nmap is currently able to detect so many different
operating systems is that many people on the private beta team went to
a lot of effort to search out new and exciting boxes to fingerprint!
In particular, Jan Koum, van Hauser, Dmess0r, David O'Brien, James
W. Abendschan, Solar Designer, Chris Wilson, Stuart Stock, Mea Culpa,
Lamont Granquist, Dr. Who, Jordan Ritter, Brett Eldridge, and Pluvius
sent in tons of IP addresses of wacky boxes and/or fingerprints of
machines not reachable through the Internet.
Thanks to Richard Stallman for writing GNU Emacs. This article would
not be so well word-wrapped if I was using vi or cat and ^D.
Questions and comments can be sent to fyodor@insecure.org (if that doesn't
work for some reason, use fyodor@insecure.org). Nmap can be obtained
from http://www.insecure.org/nmap .

View file

@ -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" "07/04/2007" "" "Nmap Reference Guide"
.TH "NMAP" "1" "07/07/2007" "" "Nmap Reference Guide"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
@ -40,9 +40,9 @@ In addition to the interesting ports table, Nmap can provide further information
.PP
A typical Nmap scan is shown in
Example\ 14.1, \(lqA representative Nmap scan\(rq. The only Nmap arguments used in this example are
\fB\-A\fR, to enable OS and version detection,
\fB\-A\fR, to enable OS and version detection, script scanning, and traceroute;
\fB\-T4\fR
for faster execution, and then the two target hostnames.
for faster execution; and then the two target hostnames.
Example\ 14.1.\ A representative Nmap scan.sp
.nf
# nmap \-A \-T4 scanme.nmap.org playground
@ -118,7 +118,6 @@ SCAN TECHNIQUES:
\-sO: IP protocol scan
\-b <ftp relay host>: FTP bounce scan
\-\-traceroute: Trace hop path to each host
\-\-reason: Display the reason a port is in a particular state
PORT SPECIFICATION AND SCAN ORDER:
\-p <port ranges>: Only scan specified ports
Ex: \-p22; \-p1\-65535; \-p U:53,111,137,T:21\-25,80,139,8080
@ -180,7 +179,7 @@ OUTPUT:
\-\-no\-stylesheet: Prevent associating of XSL stylesheet w/XML output
MISC:
\-6: Enable IPv6 scanning
\-A: Enables OS detection, Version detection, Script scanning and Traceroute
\-A: Enables OS detection and Version detection
\-\-datadir <dirname>: Specify custom Nmap data file location
\-\-send\-eth/\-\-send\-ip: Send using raw ethernet frames or IP packets
\-\-privileged: Assume that the user is fully privileged
@ -383,7 +382,7 @@ Traceroutes are performed post\-scan using information from the scan results to
Traceroute works by sending packets with a low TTL (time\-to\-live) in an attempt to illicit ICMP TTL_EXCCEDED messages from intermediate hops between the scanner and the target host. Standard traceroute implementation start with a TTL of 1 and increment the TTL until the destination host is reached. Nmap's traceroute starts with a high TTL and then decrements the TTL until it reaches 0. Doing it backwards lets nmap employ clever caching algorithms to speed up traces over multiple hosts. On average nmap sends 5\-10 fewer packets per host, depending on network conditions. If a single subnet is being scanned (i.e. 192.168.0.0/24) nmap may only have to send a single packet to most hosts.
.TP
\fB\-\-reason\fR (Host and port state reasons)
Shows the reason each port is set to a specific state and the reason each host is up or down. This option displays the type of the packet that determined a port or hosts state. For example, A RST packet from a closed port or an echo reply from an alive host. The information nmap can provide is determined by the type of scan or ping. The SYN scan and SYN ping (\fB\-sS and -PT\fR) are very detailed. Whilst the TCP connect scan and ping (\fB\-sT\fR) are limited by the implementation of connect(). This feature is automatically enabled by the debug flag (\fB\-d\fR) and the results are stored in XML log files even if this option is not specified.
Shows the reason each port is set to a specific state and the reason each host is up or down. This option displays the type of the packet that determined a port or hosts state. For example, A RST packet from a closed port or an echo reply from an alive host. The information nmap can provide is determined by the type of scan or ping. The SYN scan and SYN ping (\fB\\\-sS and \-PT\fR) are very detailed. Whilst the TCP connect scan and ping (\fB\\\-sT\fR) are limited by the implementation of connect(). This feature is automatically enabled by the debug flag (\fB\\\-d\fR) and the results are stored in XML log files even if this option is not specified.
.TP
\fB\-n\fR (No DNS resolution)
Tells Nmap to
@ -664,6 +663,15 @@ and at least one TCP scan type (such as
\fB\-sS\fR,
\fB\-sF\fR, or
\fB\-sT\fR). If no protocol qualifier is given, the port numbers are added to all protocol lists.
Ports can also be specified by name according to what the port is referred to in the
\fInmap\-services\fR. You can even use the wildcards * and ? with the names. For example, to scan ftp and all ports whose names begin with http, use
\fB\-p ftp,http*\fR. Be careful about shell expansions and quote the argument to \-p if unsure.
.sp
Ranges of ports can be surrounded by square brackets to indicate ports inside that range that appear in
\fInmap\-services\fR. For example, the following will scan all ports in
\fInmap\-services\fR
equal to or below 1024:
\fB\-p [\-1024]\fR. Be careful with shell expansions and quote the argument to \-p if unsure.
.TP
\fB\-F\fR (Fast (limited port) scan)
Specifies that you only wish to scan for ports listed in the
@ -681,6 +689,20 @@ options.
By default, Nmap randomizes the scanned port order (except that certain commonly accessible ports are moved near the beginning for efficiency reasons). This randomization is normally desirable, but you can specify
\fB\-r\fR
for sequential port scanning instead.
.TP
\fB\-\-port\-ratio <decimal number between 0 and 1>\fR
Scans all ports in
\fInmap\-services\fR
file with a ratio greater than the number specified as the argument. (new format
\fInmap\-services\fR
only.)
.TP
\fB\-\-top\-ports <integer of 1 or greater>\fR
Scans the N highest\-ratio ports found in
\fInmap\-services\fR
file. (new format
\fInmap\-services\fR
only.)
.SH "SERVICE AND VERSION DETECTION"
.PP
Point Nmap at a remote machine and it might tell you that ports 25/tcp, 80/tcp, and 53/udp are open. Using its
@ -706,8 +728,7 @@ Version detection is enabled and controlled with the following options:
.TP
\fB\-sV\fR (Version detection)
Enables version detection, as discussed above. Alternatively, you can use
\fB\-A\fR
to enable both OS detection and version detection.
\fB\-A\fR, which enables version detection among other things.
.TP
\fB\-\-allports\fR (Don't exclude any ports from version detection)
By default, Nmap version detection skips TCP port 9100 because some printers simply print anything sent to that port, leading to dozens of pages of HTTP get requests, binary SSL session requests, etc. This behavior can be changed by modifying or removing the
@ -766,7 +787,7 @@ OS detection is enabled and controlled with the following options:
\fB\-O\fR (Enable OS detection)
Enables OS detection, as discussed above. Alternatively, you can use
\fB\-A\fR
to enable both OS detection and version detection. 2nd generation OS detection is tried first. If that fails, Nmap will either print out the host fingerprint and ask you to submit it (if you are certain about what the target host is running), or Nmap will fall back to the 1st generation OS detection system in case its larger database has a match.
to enable OS detection along with other things. 2nd generation OS detection is tried first. If that fails, Nmap will either print out the host fingerprint and ask you to submit it (if you are certain about what the target host is running), or Nmap will fall back to the 1st generation OS detection system in case its larger database has a match.
.TP
\fB\-O2\fR (2nd Generation OS Detection Only)
Enables 2nd generation OS detection, but never falls back to the old (1st generation) system, even if it fails to find any match. This saves time and can reduce the number of packets sent to each target.

View file

@ -1,371 +0,0 @@
.oO Phrack 51 Oo.
Volume Seven, Issue Fifty One
xx of xx
The Art of Port Scanning
by Fyodor (fyodor@insecure.org)
[ Abstract ]
This paper details many of the techniques used to determine what ports (or
similar protocol abstraction) of a host are listening for connections. These
ports represent potential communication channels. Mapping their existence
facilitates the exchange of information with the host, and thus it is quite
useful for anyone wishing to explore their networked environment, including
hackers. Despite what you have heard from the media, the Internet is NOT
all about TCP port 80. Anyone who relies exclusively on the WWW for
information gathering is likely to gain the same level of proficiency as your
average AOLer, who does the same. This paper is also meant to serve as an
introduction to and ancillary documentation for a coding project I have been
working on. It is a full featured, robust port scanner which (I hope) solves
some of the problems I have encountered when dealing with other scanners and
when working to scan massive networks. The tool, nmap, supports the following:
- vanilla TCP connect() scanning,
- TCP SYN (half open) scanning,
- TCP FIN (stealth) scanning,
- TCP ftp proxy (bounce attack) scanning
- SYN/FIN scanning using IP fragments (bypasses packet filters),
- UDP recvfrom() scanning,
- UDP raw ICMP port unreachable scanning,
- ICMP scanning (ping-sweep), and
- reverse-ident scanning.
The freely distributable source code is appended to this paper.
[ Introduction ]
Scanning, as a method for discovering exploitable communication channels, has
been around for ages. The idea is to probe as many listeners as possible, and
keep track of the ones which are receptive or useful to your particular need.
Much of the field of advertising is based on this paradigm, and the "to current
resident" brute force style of bulk mail is an almost perfect parallel to what
we will discuss. Just stick a message in every mailbox and wait for the
responses to trickle back.
Scanning entered the h/p world along with the phone systems. Here we have this
tremendous global telecommunications network, all reachable through codes on
our telephone. Millions of numbers are reachable locally, yet we may only
be interested in 0.5% of these numbers, perhaps those that answer with a
carrier.
The logical solution to finding those numbers that interest us is to try them
all. Thus the field of "wardialing" arose. Excellent programs like Toneloc
were developed to facilitate the probing of entire exchanges and more. The
basic idea is simple. If you dial a number and your modem gives you a CONNECT,
you record it. Otherwise the computer hangs up and tirelessly dials the next
one.
While wardialing is still useful, we are now finding that many of the computers
we wish to communicate with are connected through networks such as the Internet
rather than analog phone dialups. Scanning these machines involves the same
brute force technique. We send a blizzard of packets for various protocols,
and we deduce which services are listening from the responses we receive (or
don't receive).
[ Techniques ]
Over time, a number of techniques have been developed for surveying the
protocols and ports on which a target machine is listening. They all offer
different benefits and problems. Here is a line up of the most common:
- TCP connect() scanning : This is the most basic form of tcp scanning. The
connect() system call provided by your operating system is used to open a
connection to every interesting port on the machine. If the port is listening,
connect() will succeed, otherwise the port isn't reachable. One strong
advantage to this technique is that you don't need any special privileges. Any
user on most UNIX boxes is free to use this call. Another advantage is speed.
While making a separate connect() call for every targeted port in a linear
fashion would take ages over a slow connection, you can hasten the scan by
using many sockets in parallel. Using non-blocking I/O allows you to set a low
time-out period and watch all the sockets at once. This is the fastest
scanning method supported by nmap, and is available with the -t (TCP) option.
The big downside is that this sort of scan is easily detectable and filterable.
The target hosts logs will show a bunch of connection and error messages for
the services which take the connection and then have it immediately shutdown.
- TCP SYN scanning : This technique is often referred to as "half-open"
scanning, because you don't open a full TCP connection. You send a SYN packet,
as if you are going to open a real connection and wait for a response. A
SYN|ACK indicates the port is listening. A RST is indicative of a non-
listener. If a SYN|ACK is received, you immediately send a RST to tear down
the connection (actually the kernel does this for us). The primary advantage
to this scanning technique is that fewer sites will log it. Unfortunately you
need root privileges to build these custom SYN packets. SYN scanning is the -s
option of nmap.
- TCP FIN scanning : There are times when even SYN scanning isn't clandestine
enough. Some firewalls and packet filters watch for SYNs to an unallowed port,
and programs like synlogger and courtney are available to detect these scans.
FIN packets, on the other hand, may be able to pass through unmolested. This
scanning technique was featured in detail by Uriel Maimon in Phrack 49, article
15. The idea is that closed ports tend to reply to your FIN packet with the
proper RST. Open ports, on the other hand, tend to ignore the packet in
question. This is a bug in TCP implementations and so it isn't 100% reliable
(some systems, notably Micro$oft boxes, seem to be immune). It works well on
most other systems I've tried. FIN scanning is the -U (Uriel) option of nmap.
- Fragmentation scanning : This is not a new scanning method in and of itself,
but a modification of other techniques. Instead of just sending the probe
packet, you break it into a couple of small IP fragments. You are splitting
up the TCP header over several packets to make it harder for packet filters
and so forth to detect what you are doing. Be careful with this! Some
programs have trouble handling these tiny packets. My favorite sniffer
segmentation faulted immediately upon receiving the first 36-byte fragment.
After that comes a 24 byte one! While this method won't get by packet filters
and firewalls that queue all IP fragments (like the CONFIG_IP_ALWAYS_DEFRAG
option in Linux), a lot of networks can't afford the performance hit this
causes. This feature is rather unique to scanners (at least I haven't seen
any others that do this). Thanks to daemon9 for suggesting it. The -f
instructs the specified SYN or FIN scan to use tiny fragmented packets.
- TCP reverse ident scanning : As noted by Dave Goldsmith in a 1996 Bugtraq
post, the ident protocol (rfc1413) allows for the disclosure of the username of
the owner of any process connected via TCP, even if that process didn't
initiate the connection. So you can, for example, connect to the http port
and then use identd to find out whether the server is running as root. This
can only be done with a full TCP connection to the target port (ie the -t
option). nmap's -i option queries identd for the owner of all listen()ing
ports.
- FTP bounce attack : An interesting "feature" of the ftp protocol (RFC 959) is
support for "proxy" ftp connections. In other words, I should be able to
connect from evil.com to the FTP server-PI (protocol interpreter) of target.com
to establish the control communication connection. Then I should be able to
request that the server-PI initiate an active server-DTP (data transfer
process) to send a file ANYWHERE on the internet! Presumably to a User-DTP,
although the rfc specifically states that asking one server to send a file to
another is OK. Now this may have worked well in 1985, when the rfc was
written. But nowadays, we can't have people hijacking ftp servers and
requesting that data be spit out to arbitrary points on the internet. As
*Hobbit* wrote back in 1995, this protocol flaw "can be used to post virtually
untraceable mail and news, hammer on servers at various sites, fill up disks,
try to hop firewalls, and generally be annoying and hard to track down at the
same time." What we will exploit this for is to (surprise, surprise) scan TCP
ports from a "proxy" ftp server. Thus you could connect to an ftp server
behind a firwall, and then scan ports that are more likely to be blocked (139
is a good one). If the ftp server allows reading from and writing to a
directory (such as /incoming), you can send arbitrary data to ports that you do
find open.
For port scanning, our technique is to use the PORT command to declare that
our passive "User-DTP" is listening on the target box at a certain port number.
Then we try to LIST the current directory, and the result is sent over the
Server-DTP channel. If our target host is listening on the specified port, the
transfer will be successful (generating a 150 and a 226 response). Otherwise
we will get "425 Can't build data connection: Connection refused." Then we
issue another PORT command to try the next port on the target host. The
advantages to this approach are obvious (harder to trace, potential to bypass
firewalls). The main disadvantages are that it is slow, and that some FTP
servers have finally got a clue and disabled the proxy "feature". For what it
is worth, here is a list of benners from sites where it does/doesn't work:
*Bounce attacks worked:*
220 xxxxxxx.com FTP server (Version wu-2.4(3) Wed Dec 14 ...) ready.
220 xxx.xxx.xxx.edu FTP server ready.
220 xx.Telcom.xxxx.EDU FTP server (Version wu-2.4(3) Tue Jun 11 ...) ready.
220 lem FTP server (SunOS 4.1) ready.
220 xxx.xxx.es FTP server (Version wu-2.4(11) Sat Apr 27 ...) ready.
220 elios FTP server (SunOS 4.1) ready
*Bounce attack failed:*
220 wcarchive.cdrom.com FTP server (Version DG-2.0.39 Sun May 4 ...) ready.
220 xxx.xx.xxxxx.EDU Version wu-2.4.2-academ[BETA-12](1) Fri Feb 7
220 ftp Microsoft FTP Service (Version 3.0).
220 xxx FTP server (Version wu-2.4.2-academ[BETA-11](1) Tue Sep 3 ...) ready.
220 xxx.unc.edu FTP server (Version wu-2.4.2-academ[BETA-13](6) ...) ready.
The 'x's are partly there to protect those guilty of running a flawed server,
but mostly just to make the lines fit in 80 columns. Same thing with the
ellipse points. The bounce attack is avalable with the -b <proxy_server>
option of nmap. proxy_server can be specified in standard URL format,
username:password@server:port , with everything but server being optional.
- UDP ICMP port unreachable scanning : This scanning method varies from the
above in that we are using the UDP protocol instead of TCP. While this
protocol is simpler, scanning it is actually significantly more difficult.
This is because open ports don't have to send an acknowledgement in response to
our probe, and closed ports aren't even required to send an error packet.
Fortunately, most hosts do send an ICMP_PORT_UNREACH error when you send a
packet to a closed UDP port. Thus you can find out if a port is NOT open, and
by exclusion determine which ports which are. Neither UDP packets, nor the
ICMP errors are guaranteed to arrive, so UDP scanners of this sort must also
implement retransmission of packets that appear to be lost (or you will get a
bunch of false positives). Also, this scanning technique is slow because of
compensation for machines that took RFC 1812 section 4.3.2.8 to heart and limit
ICMP error message rate. For example, the Linux kernel (in net/ipv4/icmp.h)
limits destination unreachable message generation to 80 per 4 seconds, with a
1/4 second penalty if that is exceeded. At some point I will add a better
algorithm to nmap for detecting this. Also, you will need to be root for
access to the raw ICMP socket necessary for reading the port unreachable. The
-u (UDP) option of nmap implements this scanning method for root users.
Some people think UDP scanning is lame and pointless. I usually remind them of
the recent Solaris rcpbind hole. Rcpbind can be found hiding on an
undocumented UDP port somewhere above 32770. So it doesn't matter that 111 is
blocked by the firewall. But can you find which of the more than 30,000 high
ports it is listening on? With a UDP scanner you can!
- UDP recvfrom() and write() scanning : While non-root users can't read
port unreachable errors directly, Linux is cool enough to inform the user
indirectly when they have been received. For example a second write()
call to a closed port will usually fail. A lot of scanners such as netcat
and Pluvius' pscan.c do this. I have also noticed that recvfrom() on
non-blocking UDP sockets usually return EAGAIN ("Try Again", errno 13) if
the ICMP error hasn't been received, and ECONNREFUSED ("Connection refused",
errno 111) if it has. This is the technique used for determining open ports
when non-root users use -u (UDP). Root users can also use the -l (lamer
UDP scan) options to force this, but it is a really dumb idea.
- ICMP echo scanning : This isn't really port scanning, since ICMP doesn't have
a port abstraction. But it is sometimes useful to determine what hosts in a
network are up by pinging them all. the -P option does this. Also you might
want to adjust the PING_TIMEOUT #define if you are scanning a large
network. nmap supports a host/bitmask notation to make this sort of thing
easier. For example 'nmap -P cert.org/24 152.148.0.0/16' would scan CERT's
class C network and whatever class B entity 152.148.* represents. Host/26 is
useful for 6-bit subnets within an organization.
[ Features ]
Prior to writing nmap, I spent a lot of time with other scanners exploring the
Internet and various private networks (note the avoidance of the "intranet"
buzzword). I have used many of the top scanners available today, including
strobe by Julian Assange, netcat by *Hobbit*, stcp by Uriel Maimon, pscan by
Pluvius, ident-scan by Dave Goldsmith, and the SATAN tcp/udp scanners by
Wietse Venema. These are all excellent scanners! In fact, I ended up hacking
most of them to support the best features of the others. Finally I decided
to write a whole new scanner, rather than rely on hacked versions of a dozen
different scanners in my /usr/local/sbin. While I wrote all the code, nmap
uses a lot of good ideas from its predecessors. I also incorporated some new
stuff like fragmentation scanning and options which were on my "wish list" for
other scanners. Here are some of the (IMHO) useful features of nmap:
- dynamic delay time calculations: Some scanners require that you supply a
delay time between sending packets. Well how should I know what to use?
Sure, I can ping them, but that is a pain, and plus the response time of many
hosts changes dramatically when they are being flooded with requests. nmap
tries to determine the best delay time for you. It also tries to keep track
of packet retransmissions, etc. so that it can modify this delay time during
the course of the scan. For root users, the primary technique for finding an
initial delay is to time the internal "ping" function. For non-root users, it
times an attempted connect() to a closed port on the target. It can also pick
a reasonable default value. Again, people who want to specify a delay
themselves can do so with -w (wait), but you shouldn't have to.
- retransmission: Some scanners just send out all the query packets, and
collect the responses. But this can lead to false positives or negatives in
the case where packets are dropped. This is especially important for
"negative" style scans like UDP and FIN, where what you are looking for is a
port that does NOT respond. In most cases, nmap implements a configurable
number of retransmissions for ports that don't respond.
- parallel port scanning: Some scanners simply scan ports linearly, one at a
time, until they do all 65535. This actually works for TCP on a very fast
local network, but the speed of this is not at all acceptable on a wide area
network like the Internet. nmap uses non-blocking i/o and parallel scanning
in all TCP and UDP modes. The number of scans in parallel is configurable
with the -M (Max sockets) option. On a very fast network you will actually
decrease performance if you do more than 18 or so. On slow networks, high
values increase performance dramatically.
- Flexible port specification: I don't always want to just scan all 65535
ports. Also, the scanners which only allow you to scan ports 1 - N sometimes
fall short of my need. The -p option allows you to specify an arbitrary
number of ports and ranges for scanning. For example, '-p 21-25,80,113,
60000-' does what you would expect (a trailing hyphen means up to 65536, a
leading hyphen means 1 through). You can also use the -F (fast) option, which
scans all the ports registered in your /etc/services (a la strobe).
- Flexible target specification: I often want to scan more then one host,
and I certainly don't want to list every single host on a large network to
scan. Everything that isn't an option (or option argument) in nmap is
treated as a target host. As mentioned before, you can optionally append
/mask to a hostname or IP address in order to scan all hosts with the same
initial <mask> bits of the 32 bit IP address.
- detection of down hosts: Some scanners allow you to scan large networks, but
they waste a huge amount of time scanning 65535 ports of a dead host! By
default, nmap pings each host to make sure it is up before wasting time on it.
It is also capable of bailing on hosts which seem down based on strange port
scanning errors. It is also meant to be tolerant of people who accidently scan
network addresses, broadcast addresses, etc.
- detection of your IP address: For some reason, a lot of scanners ask you to
type in your IP address as one of the parameters. Jeez, I don't want to have
to 'ifconfig' and figure out my current address every time I scan. Of course,
this is better then the scanners I've seen which require recompilation every
time you change your address! nmap first tries to detect your address during
the ping stage. It uses the address that the echo response is received on, as
that is the interface it should almost always be routed through. If it can't
do this (like if you don't have host pinging enabled), nmap tries to detect
your primary interface and uses that address. You can also use -S to specify
it directly, but you shouldn't have to (unless you want to make it look like
someone ELSE is SYN or FIN scanning a host.
Some other, more minor options:
-v (verbose): This is highly recommended for interactive use. Among other
useful messages, you will see ports come up as they are found, rather than
having to wait for the sorted summary list.
-r (randomize): This will randomize the order in which the target host's
ports are scanned.
-q (quash argv): This changes argv[0] to FAKE_ARGV ("pine" by default).
It also eliminates all other arguments, so you won't look too suspicious in
'w' or 'ps' listings.
-h for an options summary.
Also look for http://www.insecure.org/nmap/, which is the web site I plan to
put future versions and more information on. In fact, you would be well
advised to check there right now.
[ Greets ]
Of course this paper would not be complete without a shout out to all the
people who made it possible.
* Congratulations to the people at Phrack for getting this thing going again!
* Greets to the whole dc-stuff crew.
* Greets to the STUPH, Turntec, L0pht, TACD, the Guild, cDc, and all the other
groups who help keep the scene alive.
* Shout out to _eci for disclosing the coolest Windows bug in recent history.
* Thanks to the Data Haven Project (dhp.com) admins for providing such great
service for $10/month.
* And a special shout out goes to all my friends. You know who
you are and some of you (wisely) stay out of the spotlight, so I'll keep you
anonymous ... except of course for Ken and Jay, and Avenger, Grog, Cash
Monies, Ethernet Kid, Zos, JuICe, Mother Prednisone, and Karen.
And finally, we get to ...
[ The code ]
This should compile fine on any Linux box with 'gcc -O6 -o nmap nmap.c -lm'.
It is distrubuted under the terms of the GNU GENERAL PUBLIC LICENSE. If you
have problems or comments, feel free to mail me (fyodor@insecure.org).

View file

@ -89,7 +89,7 @@ OUTPUT:
--no-stylesheet: Prevent associating of XSL stylesheet w/XML output
MISC:
-6: Enable IPv6 scanning
-A: Enables OS detection, Version detection, Script scanning and Traceroute
-A: Enables OS detection and Version detection, Script scanning and Traceroute
--datadir <dirname>: Specify custom Nmap data file location
--send-eth/--send-ip: Send using raw ethernet frames or IP packets
--privileged: Assume that the user is fully privileged

View file

@ -1,449 +0,0 @@
<HTML>
<HEAD>
<TITLE>Nmap: The Art of Port Scanning</TITLE>
</HEAD>
<BODY BGCOLOR="#2A0D45" TEXT="#ffffff" LINK="#ff0000" ALINK="#00ff00" VLINK="#ff0000">
<H1><CENTER>The Art of Port Scanning</CENTER></H1>
<CENTER><H1>by Fyodor <A HREF="mailto:fyodor@insecure.org">&lt;fyodor@insecure.org&gt;</A></H1></CENTER>
<CENTER>(Last significant update: Sat Sep 6 03:24:53 GMT 1997)</CENTER>
<BR><BR>
<H1>Warning, the interface to nmap has changed a bit and so not all the flags and options mentioned in this paper are still accurate. The authoritative documentation is now the man page (<A HREF="nmap_manpage.html">html version</A>). This article still contains a lot of information on port scanning though and so I recommend that nmap users read it.</H1>
<TABLE WIDTH="100%"><TR BGCOLOR="#4444aa"><TH ALIGN="CENTER">Abstract</TH></TR></TABLE>
<P>This paper details many of the techniques used to determine what ports (or
similar protocol abstraction) of a host are listening for connections. These
ports represent potential communication channels. Mapping their existence
facilitates the exchange of information with the host, and thus it is quite
useful for anyone wishing to explore their networked environment, including
hackers. Despite what you have heard from the media, the Internet is NOT
all about TCP port 80. Anyone who relies exclusively on the WWW for
information gathering is likely to gain the same level of proficiency as your
average AOLer, who does the same. This paper is also meant to serve as an
introduction to and ancillary documentation for a coding project I have been
working on. It is a full featured, robust port scanner which (I hope) solves
some of the problems I have encountered when dealing with other scanners and
when working to scan massive networks. The tool, nmap, supports the following:
<BR><BR>
<UL>
<LI><A HREF="#connect">Vanilla TCP connect() scanning</A>,
<LI><A HREF="#syn">TCP SYN (half open) scanning</A>,
<LI><A HREF="#fin">TCP FIN (stealth) scanning</A>,
<LI><A HREF="#bounce">TCP ftp proxy (bounce attack) scanning</A>,
<LI><A HREF="#frag">SYN/FIN scanning using IP fragments (bypasses packet filters)</A>,
<LI><A HREF="#recvfrom">UDP recvfrom() scanning</A>,
<LI><A HREF="#port_unreach">UDP raw ICMP port unreachable scanning</A>,
<LI><A HREF="#icmp">ICMP scanning (ping-sweep)</A>, and
<LI><A HREF="#ident">Reverse-ident scanning</A>.
</UL>
<BR><BR>
The freely distributable source code is available at <A HREF="http://www.insecure.org/nmap/">http://www.insecure.org/nmap/</A>
<BR><BR>
<TABLE WIDTH="100%"><TR BGCOLOR="#4444aa"><TH
ALIGN="CENTER">Introduction</TH></TR></TABLE>
<P>Scanning, as a method for discovering exploitable communication channels, has
been around for ages. The idea is to probe as many listeners as possible, and
keep track of the ones that are receptive or useful to your particular need.
Much of the field of advertising is based on this paradigm, and the "to current
resident" brute force style of bulk mail is an almost perfect parallel to what
we will discuss. Just stick a message in every mailbox and wait for the
responses to trickle back.
<P>Scanning entered the h/p world along with the phone systems. Here
we have this tremendous global telecommunications network, all
reachable through codes on our telephone. Millions of numbers are
reachable locally, yet we may only be interested in 0.5% of these
numbers, perhaps those that answer with a carrier.
<P>The logical solution to finding those numbers that interest us is
to try them all. Thus the field of "wardialing" arose. Excellent
programs like Toneloc were developed to facilitate the probing of
entire exchanges and more. The basic idea is simple. If you dial a
number and your modem gives you a CONNECT, you record it. Otherwise
the computer hangs up and tirelessly dials the next one.
<P>While wardialing is still useful, we are now finding that many of
the computers we wish to communicate with are connected through
networks such as the Internet rather than analog phone dialups.
Scanning these machines involves the same brute force technique. We
send a blizzard of packets for various protocols, and we deduce which
services are listening from the responses we receive (or don't
receive).
<BR><BR>
<TABLE WIDTH="100%"><TR BGCOLOR="#4444aa"><TH ALIGN="CENTER">Techniques</TH></TR></TABLE>
<P>Over time, a number of techniques have been developed for surveying the
protocols and ports on which a target machine is listening. They all offer
different benefits and problems. Here is a line up of the most common:<BR><BR>
<UL>
<LI><A NAME="connect">TCP connect() scanning : This is the most basic
form of TCP scanning. The connect() system call provided by your
operating system is used to open a connection to every interesting
port on the machine. If the port is listening, connect() will
succeed, otherwise the port isn't reachable. One strong advantage to
this technique is that you don't need any special privileges. Any
user on most UNIX boxes is free to use this call. Another advantage
is speed. While making a separate connect() call for every targeted
port in a linear fashion would take ages over a slow connection, you
can hasten the scan by using many sockets in parallel. Using
non-blocking I/O allows you to set a low time-out period and watch all
the sockets at once. This is the fastest scanning method supported by
nmap, and is available with the -t (TCP) option. The big downside is
that this sort of scan is easily detectable and filterable. The
target hosts logs will show a bunch of connection and error messages
for the services which take the connection and then have it
immediately shutdown.<BR><BR>
<LI><A NAME="syn">TCP SYN scanning : This technique is often referred
to as "half-open" scanning, because you don't open a full TCP
connection. You send a SYN packet, as if you are going to open a real
connection and wait for a response. A SYN|ACK indicates the port is
listening. A RST is indicative of a non- listener. If a SYN|ACK is
received, you immediately send a RST to tear down the connection
(actually the kernel does this for us). The primary advantage to this
scanning technique is that fewer sites will log it. Unfortunately you
need root privileges to build these custom SYN packets. SYN scanning
is the -s option of nmap.<BR><BR>
<LI><A NAME="fin">TCP FIN scanning : There are times when even SYN
scanning isn't clandestine enough. Some firewalls and packet filters
watch for SYNs to restricted ports, and programs like synlogger and
Courtney are available to detect these scans. FIN packets, on the
other hand, may be able to pass through unmolested. This scanning
technique was featured in detail by Uriel Maimon in Phrack 49, article
15. The idea is that closed ports tend to reply to your FIN packet
with the proper RST. Open ports, on the other hand, tend to ignore
the packet in question. As Alan Cox has pointed out, this is required
TCP behavior. However, some systems (notably Micro$oft boxes), are
broken in this regard. They send RST's regardless of the port state,
and thus they aren't vulnerable to this type of scan. It works well
on most other systems I've tried. Actually, it is often useful to
discriminate between a *NIX and NT box, and this can be used to do
that. FIN scanning is the -U (Uriel) option of nmap.<BR><BR>
<LI><A NAME="frag">Fragmentation scanning : This is not a new scanning
method in and of itself, but a modification of other techniques.
Instead of just sending the probe packet, you break it into a couple
of small IP fragments. You are splitting up the TCP header over
several packets to make it harder for packet filters and so forth to
detect what you are doing. Be careful with this! Some programs have
trouble handling these tiny packets. My favorite sniffer segmentation
faulted immediately upon receiving the first 36-byte fragment. After
that comes a 24 byte one! While this method won't get by packet
filters and firewalls that queue all IP fragments (like the
CONFIG_IP_ALWAYS_DEFRAG option in Linux), a lot of networks can't
afford the performance hit this causes. This feature is rather unique
to scanners (at least I haven't seen any others that do this). Thanks
to daemon9 for suggesting it. The -f instructs the specified SYN or
FIN scan to use tiny fragmented packets.<BR><BR>
<LI><A NAME="ident">TCP reverse ident scanning : As noted by Dave
Goldsmith in a 1996 Bugtraq post, the ident protocol (rfc1413) allows
for the disclosure of the username of the owner of any process
connected via TCP, even if that process didn't initiate the
connection. So you can, for example, connect to the http port and
then use identd to find out whether the server is running as root.
This can only be done with a full TCP connection to the target port
(i.e. the -t option). nmap's -i option queries identd for the owner
of all listen()ing ports.<BR><BR>
<LI><A NAME="bounce">FTP bounce attack : An interesting "feature" of
the ftp protocol (RFC 959) is support for "proxy" ftp connections. In
other words, I should be able to connect from evil.com to the FTP
server-PI (protocol interpreter) of target.com to establish the
control communication connection. Then I should be able to request
that the server-PI initiate an active server-DTP (data transfer
process) to send a file ANYWHERE on the internet! Presumably to a
User-DTP, although the RFC specifically states that asking one server
to send a file to another is OK. Now this may have worked well in
1985 when the RFC was just written. But nowadays, we can't have
people hijacking ftp servers and requesting that data be spit out to
arbitrary points on the internet. As *Hobbit* wrote back in 1995,
this protocol flaw "can be used to post virtually untraceable mail and
news, hammer on servers at various sites, fill up disks, try to hop
firewalls, and generally be annoying and hard to track down at the
same time." What we will exploit this for is to (surprise, surprise)
scan TCP ports from a "proxy" ftp server. Thus you could connect to
an ftp server behind a firewall, and then scan ports that are more
likely to be blocked (139 is a good one). If the ftp server allows
reading from and writing to a directory (such as /incoming), you can
send arbitrary data to ports that you do find open.
<P>For port scanning, our technique is to use the PORT command to declare that
our passive "User-DTP" is listening on the target box at a certain port number.
Then we try to LIST the current directory, and the result is sent over the
Server-DTP channel. If our target host is listening on the specified port, the
transfer will be successful (generating a 150 and a 226 response). Otherwise
we will get "425 Can't build data connection: Connection refused." Then we
issue another PORT command to try the next port on the target host. The
advantages to this approach are obvious (harder to trace, potential to bypass
firewalls). The main disadvantages are that it is slow, and that some FTP
servers have finally got a clue and disabled the proxy "feature". For what it
is worth, here is a list of banners from sites where it does/doesn't work:
<P>*Bounce attacks worked:*<BR><BR>
<PRE>
220 xxxxxxx.com FTP server (Version wu-2.4(3) Wed Dec 14 ...) ready.
220 xxx.xxx.xxx.edu FTP server ready.
220 xx.Telcom.xxxx.EDU FTP server (Version wu-2.4(3) Tue Jun 11 ...) ready.
220 lem FTP server (SunOS 4.1) ready.
220 xxx.xxx.es FTP server (Version wu-2.4(11) Sat Apr 27 ...) ready.
220 elios FTP server (SunOS 4.1) ready
</PRE>
<P>*Bounce attack failed:*<BR><BR>
<PRE>
220 wcarchive.cdrom.com FTP server (Version DG-2.0.39 Sun May 4 ...) ready.
220 xxx.xx.xxxxx.EDU Version wu-2.4.2-academ[BETA-12](1) Fri Feb 7
220 ftp Microsoft FTP Service (Version 3.0).
220 xxx FTP server (Version wu-2.4.2-academ[BETA-11](1) Tue Sep 3 ...) ready.
220 xxx.unc.edu FTP server (Version wu-2.4.2-academ[BETA-13](6) ...) ready.
</PRE>
The 'x's are partly there to protect those guilty of running a flawed server,
but mostly just to make the lines fit in 80 columns. Same thing with the
ellipse points. The bounce attack is available with the -b <proxy_server>
option of nmap. proxy_server can be specified in standard URL format,
username:password@server:port , with everything but server being optional.<BR><BR>
<LI><A NAME="port_unreach">UDP ICMP port unreachable scanning : This
scanning method varies from the above in that we are using the UDP
protocol instead of TCP. While this protocol is simpler, scanning it
is actually significantly more difficult. This is because open ports
don't have to send an acknowledgement in response to our probe, and
closed ports aren't even required to send an error packet.
Fortunately, most hosts do send an ICMP_PORT_UNREACH error when you
send a packet to a closed UDP port. Thus you can find out if a port
is NOT open, and by exclusion determine which ports which are.
Neither UDP packets, nor the ICMP errors are guaranteed to arrive, so
UDP scanners of this sort must also implement retransmission of
packets that appear to be lost (or you will get a bunch of false
positives). Also, this scanning technique is slow because of
compensation for machines that took RFC 1812 section 4.3.2.8 to heart
and limit ICMP error message rate. For example, the Linux kernel (in
net/ipv4/icmp.h) limits destination unreachable message generation to
80 per 4 seconds, with a 1/4 second penalty if that is exceeded. At
some point I will add a better algorithm to nmap for detecting this.
Also, you will need to be root for access to the raw ICMP socket
necessary for reading the port unreachable. The -u (UDP) option of
nmap implements this scanning method for root users.
<P>Some people think UDP scanning is lame and pointless. I usually
remind them of the recent Solaris rcpbind hole. Rpcbind can be found
hiding on an undocumented UDP port somewhere above 32770. So it
doesn't matter that 111 is blocked by the firewall. But can you find
which of the more than 30,000 high ports it is listening on? With a
UDP scanner you can!<BR><BR>
<LI><A NAME="recvfrom">UDP recvfrom() and write() scanning : While
non-root users can't read port unreachable errors directly, Linux is
cool enough to inform the user indirectly when they have been
received. For example a second write() call to a closed port will
usually fail. A lot of scanners such as netcat and Pluvius' pscan.c
does this. I have also noticed that recvfrom() on non-blocking UDP
sockets usually return EAGAIN ("Try Again", errno 13) if the ICMP
error hasn't been received, and ECONNREFUSED ("Connection refused",
errno 111) if it has. This is the technique used for determining open
ports when non-root users use -u (UDP). Root users can also use the
-l (lamer UDP scan) options to force this, but it is a really dumb
idea.<BR><BR>
<LI><A NAME="icmp">ICMP echo scanning : This isn't really port
scanning, since ICMP doesn't have a port abstraction. But it is
sometimes useful to determine what hosts in a network are up by
pinging them all. the -P option does this. ICMP scanning is now in
parallel, so it can be quite fast. To speed things up even more, you
can increase the number of pings in parallel with the '-L <num>'
option. It can also be helpful to tweek the ping timeout value with
'-T <num_seconds>'. nmap supports a host/bitmask notation to make
this sort of thing easier. For example 'nmap -P cert.org/24
152.148.0.0/16' would scan CERT's class C network and whatever class B
entity 152.148.* represents. Host/26 is useful for 6-bit subnets
within an organization. Nmap now also offers a more powerful form.
You can now do things like '150.12,17,71-79.7.*' and it will do what
you expect. For each of the four values, you can either put a single
number, a range (with '-'), a comma-separated list of numbers and
ranges, or a '*' which is just a short cut for 0-255. By default,
likely network/broadcast addresses like .0 and .255 are not scanned,
but the '-A' option allows you to do this if you wish.
</UL>
<BR><BR>
<TABLE WIDTH="100%"><TR BGCOLOR="#4444aa"><TH ALIGN="CENTER">Features</TH></TR></TABLE>
<P>Prior to writing nmap, I spent a lot of time with other scanners
exploring the Internet and various private networks (note the
avoidance of the "intranet" buzzword). I have used many of the top
scanners available today, including strobe by Julian Assange, netcat
by *Hobbit*, stcp by Uriel Maimon, pscan by Pluvius, ident-scan by
Dave Goldsmith, and the SATAN tcp/udp scanners by Wietse Venema.
These are all excellent scanners! In fact, I ended up hacking most of
them to support the best features of the others. Finally I decided to
write a whole new scanner, rather than rely on hacked versions of a
dozen different scanners in my /usr/local/sbin. While I wrote all the
code, nmap uses a lot of good ideas from its predecessors. I also
incorporated some new stuff like fragmentation scanning and options
that were on my "wish list" for other scanners. Here are some of the
(IMHO) useful features of nmap:<BR><BR>
<UL>
<LI>dynamic delay time calculations: Some scanners require that you
supply a delay time between sending packets. Well how should I know
what to use? Sure, I can ping them, but that is a pain, and plus the
response time of many hosts changes dramatically when they are being
flooded with requests. nmap tries to determine the best delay time
for you. It also tries to keep track of packet retransmissions,
etc. so that it can modify this delay time during the course of the
scan. For root users, the primary technique for finding an initial
delay is to time the internal "ping" function. For non-root users, it
times an attempted connect() to a closed port on the target. It can
also pick a reasonable default value. Again, people who want to
specify a delay themselves can do so with -w (wait), but you shouldn't
have to.<BR><BR>
<LI>retransmission: Some scanners just send out all the query packets,
and collect the responses. But this can lead to false positives or
negatives in the case where packets are dropped. This is especially
important for "negative" style scans like UDP and FIN, where what you
are looking for is a port that does NOT respond. In most cases, nmap
implements a configurable number of retransmissions for ports that
don't respond.<BR><BR>
<LI>parallel port scanning: Some scanners simply scan ports linearly,
one at a time, until they do all 65535. This actually works for TCP
on a very fast local network, but the speed of this is not at all
acceptable on a wide area network like the Internet. nmap uses
non-blocking i/o and parallel scanning in all TCP and UDP modes. The
number of scans in parallel is configurable with the -M (Max sockets)
option. On a very fast network you will actually decrease performance
if you do more than 18 or so. On slow networks, high values increase
performance dramatically.<BR><BR>
<LI>Flexible port specification: I don't always want to just scan all
65535 ports. Also, the scanners which only allow you to scan ports 1
- N sometimes fall short of my need. The -p option allows you to
specify an arbitrary number of ports and ranges for scanning. For
example, '-p 21-25,80,113, 60000-' does what you would expect (a
trailing hyphen means up to 65536, a leading hyphen means 1 through).
You can also use the -F (fast) option, which scans all the ports
registered in your /etc/services (a la strobe).<BR><BR>
<LI>Flexible target specification: I often want to scan more then one
host, and I certainly don't want to list every single host on a large
network to scan. Everything that isn't an option (or option argument)
in nmap is treated as a target host. As mentioned before, you can
optionally append /mask to a hostname or IP address in order to scan
all hosts with the same initial <mask> bits of the 32 bit IP
address. You can use the same powerful syntax as the port
specifications to specify targets like '150.12.17.71-79.7.*'. '*' is
just a shortcut for 0-255, remember to escape it from your shell if
used.<BR><BR>
<LI>detection of down hosts: Some scanners allow you to scan large
networks, but they waste a huge amount of time scanning 65535 ports of
a dead host! By default, nmap pings each host to make sure it is up
before wasting time on it. It also does thin in parallel, to speed
things up. You can change the parrallel ping lookahead with '-L' and
the ping timeout with '-T'. You can turn pinging off completely with
the '-D' command line option. This is useful for scanning networks
like microsoft.com where ICMP echo requests can't get through. Nmap
is also capable of bailing on hosts that seem down based on strange
port scanning errors. It is also meant to be tolerant of people who
accidentally scan network addresses, broadcast addresses, etc.<BR><BR>
<LI>detection of your IP address: For some reason, a lot of scanners
ask you to type in your IP address as one of the parameters. Jeez, I
don't want to have to 'ifconfig' and figure out my current address
every time I scan. Of course, this is better then the scanners I've
seen which require recompilation every time you change your address!
nmap first tries to detect your address during the ping stage. It
uses the address that the echo response is received on, as that is the
interface it should almost always be routed through. If it can't do
this (like if you don't have host pinging enabled), nmap tries to
detect your primary interface and uses that address. You can also use
-S to specify it directly, but you shouldn't have to (unless you want
to make it look like someone ELSE is SYN or FIN scanning a
host.<BR><BR>
</UL>
Some other, more minor options:<BR>
<PRE>
-v (verbose): This is highly recommended for interactive use. Among other
useful messages, you will see ports come up as they are found, rather than
having to wait for the sorted summary list.
-r (randomize): This will randomize the order in which the target host's
ports are scanned.
-q (quash argv): This changes argv[0] to FAKE_ARGV ("pine" by default).
It also eliminates all other arguments, so you won't look too suspicious in
'w' or 'ps' listings.
-h for an options summary.
-R show and resolve all hosts, even down ones.
</PRE>
Also look for <A
HREF="http://www.insecure.org/nmap/">http://www.insecure.org/nmap</A>,
which is the web site I plan to put future versions and more
information on. In fact, you would be well advised to check there
right now. (If that isn't where you are reading this).
<TABLE WIDTH="100%"><TR BGCOLOR="#4444aa"><TH ALIGN="CENTER">Example
Usage</TH></TR></TABLE>
<BR><BR>
To launch a stealth scan of the entire class 'B' networks 166.66.0.0 and
166.67.0.0 for the popularly exploitable imapd daemon:<BR>
<pre>
# nmap -Up 143 166.66.0.0/16 166.67.0.0/16
</pre>
To do a standard tcp scan on the reserved ports of host
&lt;target&gt;:<BR>
<pre>
&gt; nmap target
</pre>
To check the class 'C' network on which warez.com sits for popular
services (via fragmented SIN scan):<BR>
<pre>
# nmap -fsp 21,22,23,25,80,110 warez.com/24
</pre>
To scan the same network for all the services in your /etc/services
via (very fast) tcp scan:<BR>
<pre>
&gt; nmap -F warez.com/24
</pre>
To scan secret.pathetic.net using the ftp bounce attack off of
ftp.pathetic.net:<BR>
<pre>
&gt; nmap -Db ftp.pathetic.net secret.pathetic.net
</pre>
To find hosts that are up in the the adjacent class C's 193.14.12,
.13, .14, .15, ... , .30:<BR>
<pre>
&gt; nmap -P '193.14.[12-30].*'
</pre>
If you don't want to have to quote it to avoid shell interpretation,
this does the same thing:<BR>
<pre>
&gt; nmap -P 193.14.12-30.0-255
</pre>
</BODY>
</HTML>

View file

@ -1,950 +0,0 @@
.\" nmap version 3.00, August 2002
.\" This definition swiped from the gcc(1) man page
.de Sp
.if n .sp
.if t .sp 0.4
..
.TH NMAP 1
.SH NOM
nmap \- Outil d'exploration réseau et analyseur de sécurité
.SH SYNOPSIS
.B nmap
[Type(s) de scan] [Options] <hôte ou réseau #1 ... [#N]>
.SH DESCRIPTION
.I Nmap
a été conçu pour que les administrateurs systèmes et les curieux
puissent analyser de grands réseaux pour déterminer les hôtes actifs et les
services offerts.
.I nmap
supporte un grand nombre de techniques d'analyse\ : UDP, TCP
connect(), TCP SYN (mi ouvert), ftp proxy (attaque par rebond),
Reverse-ident, ICMP (balayage de ping), FIN, balayage de ACK, Xmas Tree, balayage
de SYN, Protocoles IP, et Null scan. Voir la section
.I Types de scans
pour plus de détails. Nmap offre également des caractéristiques avancées
comme la détection du système d'exploitation distant via l'empreinte
TCP/IP, l'analyse furtive, le délai dynamique et les calculs de retransmission,
l'analyse parallèle, détection de hôtes inactifs via
des pings parallèles, l'analyse avec leurres, la détection des ports filtrés,
analyse directe (sans portmapper) des RCP, l'analyse avec fragmentation,
et une notation puissante pour désigner les hôtes et les ports.
.PP
Des efforts significatifs ont été consacrés pour que nmap soit utilisable
par des utilisateurs non-root. Malheureusement, la plupart des interfaces
noyaux critiques (comme les raw sockets) requièrent les privilèges root.
Nmap devrait donc être lancé en tant que root autant que possible
(mais pas en setuid root, évidemment).
.PP
Le résultat de l'exécution de nmap est habituellement une liste
de ports intéressants sur les machines analysées. Nmap donne pour
chaque port le nom du service, le numéro, l'état et le protocole.
L'état peut être «\ open\ », «\ filtered\ » ou «\ unfiltered\ ».
«\ Open\ » signifie que la machine cible accepte les connexions sur ce port.
«\ Filtered\ » signifie qu'un pare-feu, un filtre ou un autre obstacle réseau
protège le port et empêche nmap de détecter si le port est ouvert.
«\ Unfiltered\ » signifie que le port est fermé et qu'aucun pare-feu n'a
interféré avec nmap.
Les ports «\ Unfiltered\ » sont les plus courants et ne sont affichés
que lorsque la majorité des ports analysés sont dans l'état «\ filtered\ ».
.PP
En fonction des options utilisées, nmap peut aussi rapporter les caractéristiques
suivantes du système d'exploitation distant\ :
type de système d'exploitation, séquencement TCP, noms des utilisateurs
qui ont lancé les programmes qui écoutent sur chaque port, le nom DNS,
et d'autres choses encore.
.SH OPTIONS
Les options ayant du sens ensemble peuvent généralement être combinées.
Certaines options sont spécifiques à certains modes d'analyses.
.I nmap
essaye de détecter et de prévenir l'utilisateur
en cas de combinaisons d'options démentes ou non supportées.
.Sp
Si vous êtes impatient, vous pouvez passer directement
à la section des
.I exemples
à la fin, qui illustre l'usage courant. Vous pouvez aussi lancer
.B nmap -h
pour un bref rappel de toutes les options.
.TP
.B TYPES DE SCANS
.TP
.B \-sS
TCP SYN scan\ : Cette technique est souvent appelée scan
«\ mi ouvert\ », parce qu'on ouvre une connexion TCP incomplète.
On envoie un paquet SYN, comme pour une véritable ouverture de connexion
et on attend une réponse. Un SYN ou ACK indique
que le port est sous écoute, en revanche un RST signifie que personne n'écoute
sur ce port.
Si un SYN ou ACK est reçu, un RST est immédiatement envoyé pour interrompre
la connexion.
Le principal avantage de cette technique est que peu de sites l'archiveront.
dans leurs logs.
Malheureusement vous avez besoin des privilèges root pour construire
ces paquets SYN sur mesure. C'est le scan par défaut pour les utilisateurs
qui ont les privilèges root.
.TP
.B \-sT
TCP connect() scan\ : C'est la forme la plus simple de scan TCP.
L'appel système connect() fournit par votre système d'exploitation
est utilisé pour ouvrir une connexion sur tous les ports intéressants
de la cible. Si le port est sur écoute,
connect() réussira, sinon le port est injoignable.
Le principal avantage de cette technique est qu'elle ne nécessite pas
de privilèges particuliers. Presque tous les utilisateurs de toutes les machines Unix
sont libres d'utiliser cet appel système.
.Sp
Ce type de scan est facilement détectable par l'hôte cible
puisque les logs de la cible montreront un ensemble de connexions
et de messages d'erreurs pour les services qui ont accepté la connexion
qui a été immédiatement coupée.
C'est le scan par défaut pour les utilisateurs normaux (non root).
.TP
.B \-sF \-sX \-sN
Stealth FIN, Xmas Tree, ou Null scan modes\ : Parfois même
un SYN scan n'est pas suffisamment discret.
Certains pare-feux et filtreurs de paquets regardent les
SYNs vers les ports interdits, et des programmes comme Synlogger et
Courtney peuvent détecter ces scans. En revanche, ces scans avancés
devrait pourvoir passer sans problèmes.
.Sp
L'idée est qu'un port fermé est requis pour
répondre au paquet de test par un RST, alors
que les ports ouverts doivent ignorer les paquets en question
(voir RFC 793 pp 64). Le FIN scan utilise
un paquet FIN nu comme testeur, alors que le scan Xmas tree
active les drapeaux URG et PUSH du paquet FIN. Le scan Null, désactive tous
les drapeaux. Malheureusement Microsoft (comme d'habitude)
a décidé d'ignorer complètement le standard et de faire les choses à sa façon.
C'est pourquoi ce type de scan ne fonctionne pas contre les systèmes sous
Windows95/NT. Le côté positif est que c'est un bon moyen de distinguer deux
plates-formes.
Si le scan trouve des ports ouverts, vous savez que la machine cible n'est
pas sous Windows. Si un -sF,-sX, ou -sN scan montre tous les ports
fermés, et qu'un scan SYN (-sS) montre tous les ports ouverts, la machine cible
fonctionne probablement sous
Windows. Ceci est moins utile depuis que nmap a son propre détecteur de système
d'exploitation intégré. D'autres systèmes ont le même problème que Windows\ :
Cisco, BSDI, HP/UX, MVS, et IRIX.
La plupart envoient des resets depuis les ports ouverts au lieu d'ignorer
le paquet.
.TP
.B \-sP
Ping scanning\ : Parfois vous voulez juste savoir quels sont les hôtes
actifs d'un réseau.
Nmap peut le faire pour vous en envoyant des paquets d'écho ICMP à chaque adresse IP du réseau spécifié.
Les hôtes qui répondent sont actifs. Malheureusement, certains sites comme
microsoft.com, bloquent les paquets d'écho.
Toutefois nmap peut aussi envoyer un paquet TCP ack au port 80 (par défaut).
Si vous recevez un RST en retour, la machine est active. Une troisième
technique consiste à envoyer un paquet SYN et d'attendre un RST ou un SYN/ACK.
Pour les utilisateurs non-root, la méthode connect() est utilisée.
.Sp
Par défaut (pour les utilisateurs root), nmap utilise la technique
ICMP et ACK en parallèle. Vous pouvez changer l'option
.B \-P
décrite plus tard.
.Sp
Remarquez que le ping est fait par défaut de toutes façons
et seuls les hôtes qui répondent sont analysés.
N'utilisez cette option que si vous voulez faire un balayage de
ping
.B sans
faire d'analyse de ports.
.TP
.B \-sU
UDP scans\ : Cette méthode est utilisée pour déterminer les ports UDP
(User Datagram Protocol, RFC 768) qui sont ouverts sur l'hôte
Cette technique consiste à envoyer un paquet udp de 0 octet à chaque
port de la machine cible. Si on reçoit un message ICMP «\ port unreachable\ »,
alors le port est fermé. Autrement nous supposons qu'il est ouvert.
.Sp
Certaines personne pensent que l'analyse UDP est inutile.
J'ai pour habitude de leur rappeler le trou récent dans rcpbind sous Solaris.
Rpcbind peut dissimuler un port UDP non documenté quelque part au dessus
de 32\ 770. Comme découvrir un tel port sans scanner UDP\ ?
Il y a aussi le programme
cDc Back Orifice backdoor qui cache un port UDP configurable
sur les machines Windows. Sans même mentionner tous les services courants
qui utilisent UDP tels que snmp, tftp, NFS, etc.
.Sp
Malheureusement l'analyse UDP peut être particulièrement longue puisque la plupart
des hôtes implémente une suggestion de la RFC 1812 (section
4.3.2.8) pour limiter le débit des messages d'erreurs ICMP. Par exemple,
le noyau Linux (dans net/ipv4/icmp.h) limite la génération de
message «\ destination unreachable\ » à 80 pour 4 secondes, avec
une pénalité de 1/4 secondes si ce nombre est dépassé.
Solaris a des limites encore plus strictes (à peu près 2 messages par
seconde) et l'analyse nécessite encore plus de temps.
.I Nmap
détecte cette limite de débit et ralentit plutôt que d'inonder inutilement
le réseau avec des paquets qui seront ignorés par la machine cible.
.Sp
Comme d'habitude, Microsoft a ignoré la suggestion RFC
et n'a pas implémenté de limitation de taux dans les machines
Win95 et NT. C'est pourquoi nous pouvons analyser
les 65K ports d'une machine Windows
.B très
rapidement. Wahoo !
.TP
.B \-sO
IP protocol scans\ : Cette méthode est utilisée
pour déterminer les protocoles IP supportés par l'hôte.
La technique consiste à envoyer des paquets IP bruts sans entête de protocole
à chaque protocole spécifié sur la machine cible.
Si nous recevons un message ICMP «\ protocol unreachable\ »,
alors le protocole n'est pas utilisé. Autrement nous supposons qu'il est
ouvert. Remarquez que certains hôtes (AIX, HP-UX, Digital UNIX)
et les pare-feux peuvent ne pas renvoyer les
messages «\ protocol unreachable\ », faisant apparaître ouverts
tous les protocoles.
.Sp
Comme cette technique est très similaire à l'analyse des ports UDP, la
limitation du débit ICMP peut aussi apparaître.
Mais comme le champ protocole d'IP n'a que 8 bits, il y a au plus 256
protocoles, donc la durée restera raisonnable.
.TP
.B \-sI <zombie host[:probeport]>
scan paresseux : cette méthode de scan avancée autorise un scan TCP
véritablement aveugle de la cible (aucun paquet ne sera envoyé à la cible
depuis votre véritable adresse IP). À la place, une attaque unilatérale
exploite la prédiction de la séquence d'identificateur de fragmentation IP
de l'hôte zombie pour glaner des informations sur les ports ouverts de la cible.
Les systèmes de détections d'intrusion indiqueront que le scan provient de la
machine zombie spécifiée (qui doit être active et vérifier un certain nombre de
critères). J'envisage de donner plus d'explication à http://www.insecure.org/nmap/nmap_documentation.html
dans un futur proche.
.TP
.Sp
En plus d'être extraordinairement furtive (grâce à sa nature aveugle), ce scan
permet de s'affranchir des relations de confiance entre machines
fondées sur l'IP. La liste de ports montre les ports ouverts
.I tels que les voit l'hôte zombie.
Aussi, vous pouvez essayer de scanner une cible en utilisant différents zombies
à qui elle fait confiance (via les règles de filtrage des routeurs/paquets).
Évidemment cette information est cruciale pour orienter l'attaque. Autrement
votre test de pénétration va consommer des ressources considérables
appartenant au système intermédiaire, pour s'apercevoir en fin de compte
qu'il n'y a pas de relation de confiance entre l'hôte cible
et l'IP de la machine zombie.
.Sp
Vous pouvez ajouter un deux-point suivi par le numéro de port si vous
voulez tester un port particulier sur l'hôte zombie pour les changement IPID.
Autrement Nmap utilisera le port qu'il utilise par défaut pour les pings TCP.
.TP
.B \-sA
ACK scan\ : C'est une technique avancée qui est utilisé pour découvrir
les règles des pare-feux et pour savoir si on a affaire à un pare-feu ou un simple
filtreur de paquets qui bloquent les paquets SYN entrant.
.Sp
Ce type d'analyse envoie un paquet ACK (avec un numéro
d'acquittement/séquence aléatoire) aux ports spécifiés.
Si un RST vient en retour, les ports sont classés comme
non filtrés. Si rien ne revient (ou alors un message ICMP
«\ unreachable\ »), les ports sont classés comme filtrés . Remarquez
que
.I nmap
n'affiche pas les ports non filtrés.
Aussi, si
.B aucun
port n'est affiché dans la sortie, c'est souvent un signe que tous
les tests ont fonctionné (et retourné RSTs). Ce scan ne montrera évidement
jamais de port ouvert.
.TP
.B \-sW
Window scan\ : C'est une analyse avancée très similaire au
ACK scan, sauf qu'il peut parfois détecter aussi bien des
ports ouverts que filtrés/non filtrés grâce à une anomalie
dans la taille de la fenêtre TCP rapportée par certains systèmes.
Parmi les systèmes vulnérables se trouvent certaines versions de
AIX, Amiga, BeOS, BSDI, Cray, Tru64 UNIX, DG/UX, OpenVMS, Digital
UNIX, FreeBSD, HP-UX, OS/2, IRIX, MacOS, NetBSD, OpenBSD,
OpenStep, QNX, Rhapsody, SunOS 4.X, Ultrix, VAX, et
VxWorks. Voir les archives de la liste de diffusion nmap-hackers pour une liste
exhaustive.
.TP
.B \-sR
RPC scan. Cette méthode fonctionne en combinaison
avec diverses méthodes d'analyse de port de nmap.
Il prend tous les ports TCP/UDP ouverts et les inonde de
commandes SunRPC NULL pour déterminer ceux qui sont
des ports RPC, et si c'est le cas, le programme et son numéro de version
qui les servent.
Vous pouvez obtenir la même information
que 'rpcinfo -p' même si le portmapper cible est derrière un
pare-feu (ou protégé par un wrapper TCP). Les leurres ne fonctionnent pour le
moment pas avec les scans RCP, et je dois ajouter le support pour les leurres
dans les scans UPD RCP.
.TP
.B \-sL
scan-liste. Cette méthode génère une liste d'IP/nom sans les pinger ou les
scanner. La résolution de nom DNS sera réalisée sauf si vous utilisez -n.
.TP
.B \-b <ftp relay host>
attaque par rebond FTP\ : Une caractéristique intéressante du
protocole ftp (RFC 959) est le support des connexions \fBproxy\fR.
En d'autres termes, je dois être capable de me connecter depuis
mechant.com au serveur FTP de cible.com et demander que le serveur envoie
un fichier N'IMPORTE OÙ sur Internet. Ça fonctionnait bien
en 1985 quand la RFC a été écrite. Mais dans l'Internet d'aujourd'hui
nous ne pouvons pas nous permettre d'avoir des pirates qui détournent
des serveurs ftp et envoient des données n'importe où dans Internet.
J'avais écrit en 1995 que ce défaut du protocole «\ peut être utilisé pour
envoyer des courriers et nouvelles intracables,
matraquer des serveurs de sites, saturer les disques,
essayer de contourner les pare-feux et généralement être difficile à repérer\ ».
On peut aussi l'exploiter pour faire un scan
des ports TCP depuis un serveur ftp «\ proxy\ ». Ainsi, vous pouvez vous
connecter à un serveur ftp derrière un pare-feu et scanner les ports
sans être bloqué (139 est un bon nombre). Si le serveur ftp
autorise la lecture et l'écriture dans certains répertoires
(tel que /incoming), vous pouvez envoyez des données arbitraires
aux ports que vous avez trouvé ouvert (nmap ne le fera toutefois pas pour vous)
.Sp
L'argument passé à l'option \fB-b\fR est l'hôte que vous voulez utiliser comme
proxy, dans la notation URL standard. Le format est\ :
.I username:password@server:port.
Tout sauf
.I server
est optionnel. Pour déterminer les serveurs qui sont
vulnérables à cette attaque, vous pouvez voir mon article dans
.I Phrack
51. Une version mise à jour est disponible à l'URL
http://www.insecure.org/nmap.
.TP
.B OPTIONS GÉNÉRALES
Aucune n'est nécessaire, mais certaines peuvent être très utiles.
.TP
.B \-P0
Ne pas essayer de ping sur les hôtes avant de les analyser.
Cela permet l'analyse des réseaux qui ne permettent pas les requêtes
ou les réponses ICMP à travers leurs pare-feux.
Microsoft.com en est un exemple, et vous devez
toujours utiliser
.B \-P0
ou
.B \-PT80
pour faire une analyse de port sur microsoft.com.
.TP
.B \-PT
Utilise TCP "ping" pour déterminer les hôtes actifs. Au lieu
d'envoyer une requête d'écho ICMP et d'attendre une réponse, nous
envoyons des paquets TCP ACK dans le réseau cible
(ou contre une machine) et attendons des réponses pour conclure.
Les hôtes devraient répondre par un
RST. Cette option préserve l'efficacité des scan
des hôtes qui sont actifs mais autorise l'analyse des
hôtes/réseaux qui bloquent les paquets de ping.
Pour les utilisateurs non root,
nous utilisons connect(). Pour spécifier le port de destination
du test utilisez -PT<port number>. Le port par défaut est
80, car ce port n'est pas souvent filtré.
.TP
.B \-PS
Cette option utilise des paquets SYN (demande de connexion) à la place
des paquets ACK pour les utilisateurs ROOT. Les hôtes actifs devrait répondre
par un RST (ou, rarement par un SYN | ACK).
.TP
.B \-PI
Cette option utilise un véritable paquet ping (requête d'écho ICMP).
Il recherche les hôtes actifs et aussi regarde les adresses
de diffusion des sous-réseaux. Il y a des adresses IP
qui sont joignable de l'extérieur et qui sont traduites
en une diffusion de paquet entrant dans un réseau.
Ça devrait être supprimé, si découvert, car ça permet un grand nombre
d'attaques de déni de service.
.TP
.B \-PP
utilise un paquet ICMP de requête d'estampille temporelle (code 13) pour
déterminer les hôtes qui écoutent.
.TP
.B \-PM
Fait la même chose que
.B \-PI
et
.B \-PP
sauf qu'il utilise une requête de masque de sous-réseau (ICMP code 17).
.TP
.B \-PB
C'est le ping par défaut. Il utilise les balayages ACK (
.B \-PT
) et ICMP (
.B \-PI
) en parallèle. De cette manière, vous pouvez passer les pare-feux qui ne filtrent
que l'un des deux types de paquets.
.TP
.B \-O
Cette option active l'identification de l'hôte distant via l'empreinte
TCP/IP. Autrement dit, nmap utilise un ensemble de techniques
pour détecter les subtilités dans la pile réseau du système d'exploitation
de l'ordinateur que vous êtes en train d'analyser. Il utilise ces informations
pour créer une «\ empreinte\ » qui est comparée avec sa base de données
d'empreintes connues (le fichier nmap-os-fingerprints) pour retrouver le type
de système que vous êtes en train d'analyser.
.Sp
Si Nmap est incapable de deviner le système d'exploitation de la machine,
et que les conditions sont bonnes (par exemple, au moins un port est ouvert)
Nmap fournira une URL que vous pourrez utiliser pour soumettre si vous
connaissez avec certitude le nom du système d'exploitation à qui appartient
cette nouvelle empreinte.
Vous contribuerez ainsi à augmenter le nombre de systèmes d'exploitations
détectable par nmap et la la précision de la détection. Si vous laissez
une adresse IP dans le formulaire, la machine pourra être analysée lorsque
nous ajouterons l'empreinte (pour valider que ça marche).
.Sp
L'option \-O active aussi plusieurs autres tests. L'un d'entre eux est la mesure
de «\ uptime\ » (durée écoulée depuis le dernier redémarrage du système), qui utilise l'estampille TCP (RFC 1323) pour deviner la date du
dernier redémarrage de la machine. Ceci n'est rapporté que pour les machines
qui fournissent cette information.
.Sp
Un autre test activé par \-O est la classification de la prédiction
de la séquence TCP. C'est une mesure qui décrit approximativement la difficulté
d'établir une connexion TCP forgée contre l'hôte distant. C'est utile
pour exploiter les relations de confiances fondées sur l'IP source
(rlogin, firewall filters, etc) ou pour cacher la source d'une attaque.
La valeur réelle de la difficulté est calculée sur un échantillon et peut
fluctuer. Il est généralement plus approprié d'utiliser une classification
par nom tel que «\ worthy challenge\ » ou «\ trivial joke\ ». Ceci n'est
rapporté dans la sortie normale qu'avec l'option -v.
.Sp
Si le mode verbeux (\-v) est activé en même temps que \-O,
la génération de séquence IPID est aussi rapportée.
La plupart des machines appartiennent à la classe incrémentale,
ce qui signifie qu'elle incrémente le champ ID dans l'entête
IP pour chaque paquet envoyé. Ce qui les rend vulnérables
à la collecte d'information avancée et aux attaques par
usurpation.
.TP
.B \-I
Active l'analyse TCP reverse ident. Dave Goldsmith
dans un message à Bugtraq en 1996, a fait remarquer que le protocole
ident (rfc 1413) autorise la découverte du nom d'utilisateur qui
possède un processus connecté via TCP, même si le processus n'est pas à
l'instigateur de la connexion. Vous pouvez ainsi vous connecter au port
http et utiliser identd pour découvrir si le serveur tourne sous root.
Ceci ne peut être fait qu'avec une connexion TCP complète sur le port cible
(i.e. l'option d'analyse -sT). Quand
.B \-I
est utilisé, l'identd de l'hôte distant est interrogé pour chaque port
ouvert trouvé. Évidemment ça ne fonctionne pas si l'hôte n'utilise pas identd.
.TP
.B \-f
Cette option oblige les analyses FIN, XMAS, ou NULL
à utiliser de petit paquets IP fragmentés. L'idée est de partager
l'entête TCP en plusieurs paquets pour rendre leurs détections plus difficile
par les filtres et les systèmes de détection d'intrusion, et les autres
enquiquineurs qui tentent de détecter ce que vous êtes en train de faire.
Faites attention avec ceci, certains programmes ont des difficultés avec ces
petits paquets. Mon sniffer favori plante immédiatement lorsqu'il reçoit le
premier fragment de 36 octets.
Cette option est inefficace contre les filtreurs de paquets et les pare-feux
qui réassemblent les fragments IP
(comme l'option CONFIG_IP_ALWAYS_DEFRAG dans le noyau Linux),
certains réseaux ne peuvent pas supporter cette perte de performance
et ne réassemblent pas les paquets.
.Sp
Remarquez que je n'ai pas encore fait fonctionner cette option sur tous les
systèmes. Ça marche parfaitement sur les machines Linux, FreeBSD et OpenBSD
et certaines personnes m'ont rapporté leurs succès avec d'autres saveurs
d'Unix.
.TP
.B \-v
Mode verbeux. C'est une option hautement recommandée qui fournit beaucoup
d'informations sur ce que vous êtes en train de faire. Vous pouvez l'utiliser
deux fois pour un effet plus important. Utiliser
.B \-d
une paire de fois si vous voulez vraiment devenir fou avec le défilement de
l'écran\ !
.TP
.B \-h
Cette option affiche un bref récapitulatif des options de nmap.
Comme vous l'avez sans doute remarqué, cette page de manuel n'est pas vraiment
un «\ bref récapitulatif\ ». :)
.TP
.B \-oN <logfilename>
Enregistre les résultats de vos analyses dans un
format
.B lisible par un humain
dans le fichier spécifié en argument.
.TP
.B \-oX <logfilename>
Enregistre le résultat de vos analyses dans un format
.B XML
dans le fichier spécifié en argument. Ceci permet à des programmes
d'interpréter facilement les résultats de nmap.
Vous pouvez donner l'argument '\fB-\fR' (sans les guillemets) pour envoyer la sortie sur la sortie standard
(pour les pipelines shells, etc).
Dans ce cas la sortie normale sera supprimée.
Regardez attentivement les messages d'erreurs si vous utilisez ceci (ils sont
encore envoyés sur la sortie d'erreur standard).
Notez aussi que \fB-v\fR peut afficher des informations supplémentaires.
La définition de type de document (DTD) définissant la structure de la sortie
XML est disponible à http://www.insecure.org/nmap/data/nmap.dtd .
.TP
.B \-oG <logfilename>
Enregistre les résultats de vos analyses dans une forme adaptée pour
.B grep.
Ce format simple fournit toutes les informations sur une ligne. C'est le
mécanisme préféré des programmes qui interagissent avec nmap, mais désormais nous
recommandons plutôt la sortie XML (-oX). Ce format simple ne contient pas autant d'informations
que les autres formats. Vous pouvez donner l'argument «\fB-\fR» (sans les guillemets) pour envoyer la sortie sur la sortie standard
(pour les pipelines shells, etc).
Dans ce cas la sortie normale sera supprimée.
Regardez attentivement les messages d'erreurs si vous utilisez ceci (ils sont
encore envoyés sur la sortie d'erreur standard).
Notez aussi que \fB-v\fR peut afficher des informations supplémentaires.
.TP
.B \-oA <logfilename>
indique à nmap d'enregistrer dans tous les formats majeurs (normal, grep et
XML). Vous fournissez le préfixe du nom de fichier et les sorties auront
respectivement les suffixes .nmap, .gnmap et .xml .
.TP
.B \-oS <logfilename>
enregistre les résultats de vos analyses en format
.B script kiddie
(NdT\ : C'est un langage dans lequel certaines lettres sont remplacées par des chiffres/symboles
typiquement exemple A devient 4, E devient 3, etc. Cette langue est utilisée par
les «\ cowboyz\ » d'Internet.
Cette population folklorique amuse beaucoup les autres internautes, au point qu'il existe une option pour eux dans nmap)
V0u$ poUV3z dOnn3r l'4rgUm3nt '\fB-\fR' (s4ns l3$ guIll3m3ts) poUr 3nvoy3r l4 sOrti3 sUr l4 $orti3 $t4nd4rd.
.TP
.B \--resume <logfilename>
L'analyse d'un réseau qui a été annulée par un Ctrl-C, problème de réseau, etc.
peut être reprise en utilisant cette option.
logfilename doit être soit un log normal (-oN) soit
un log lisible par une machine (-oM) d'une analyse avortée.
Aucune autre option ne peut être donnée (ce sont obligatoirement les mêmes que
celles du scan avorté).
Nmap démarrera sur la machine après la dernière machine qui a été analysée avec succès dans le
fichier de log.
.TP
.B \--append_output
indique à Nmap d'écrire à la fin des fichiers de sortie au lieu de les écraser.
.TP
.B \-iL <inputfilename>
Lit les spécifications de la cible depuis le fichier spécifié
plutôt que depuis la ligne de commande. Le fichier doit contenir une liste
d'hôtes, d'expressions de réseaux séparées par des espaces, tabulations ou retour chariots.
Utilisez le tiret
pour lire depuis stdin (comme la fin d'un pipe).
Voyez la section \fIspécification de cible\fR
pour plus d'information sur les expressions que vous pouvez mettre dans le fichier.
.TP
.B \-iR
Cette option indique à Nmap de générer ses propres hôtes
à analyser par tirage aléatoire :). Ça ne finit jamais.
Ça peut être utile pour un échantillon d'Internet pour estimer diverses choses.
Si vous vous ennuyez, essayez
.I nmap \-sS \-iR \-p 80
pour rechercher des serveurs web à regarder.
.TP
.B \-p <port ranges>
Cette option spécifie les ports que vous voulez essayer.
Par exemple '-p 23' n'essayera que le port 23 of de l'hôte
cible. '\-p 20-30,139,60000-' analysera les ports entre 20 et 30, le port
139, et tous les ports supérieurs à 60000. Le comportement par défaut est d'analyser tous
les ports de 1 à 1024 ainsi que tous les ports listés dans les fichiers de services fournis avec nmap.
Pour l'analyse par IP (-sO), ceci spécifie le numéro de protocole que vous voulez analyser
.Sp
Lorsque vous scannez les ports TCP et UPD vous pouvez spécifier un protocole
particulier en préfixant les numéros de ports par «\ T\ »: ou «\ U:\ ».
L'effet du spécificateur dure jusqu'à ce que vous en spécifiez un autre.
Par exemple, l'argument «\ -p U:53,111,137,T:21-25,80,139,8080\ »
scannera les ports UDP 53, 111 et 137 ainsi que les ports TCP mentionnés.
Remarquez que pour scanner UDP et TCP, vous devez spécifier -sU et au moins une
analyse TCP (telle que -sS, -sF ou -sT). Si aucune spécification de
protocole n'est indiquée, les numéros de ports sont ajoutés à tous les
protocoles.
.TP
.B \-F Fast scan mode.
Spécifie que vous ne voulez analyser que les ports listés
dans le fichier des services livré avec nmap (ou le fichier des protocoles pour
-sO).
C'est évidemment plus rapide que d'analyser les 65535 ports d'un hôte.
.TP
.B \-D <decoy1 [,decoy2][,ME],...>
réalise un scan avec leurres. Du point de vue de l'hôte distant, les hôtes
leurres apparaîtront comme s'ils analysaient aussi le réseau cible. Ainsi,
les systèmes de détection d'intrusion ne pourront pas savoir parmi l'ensemble
des IP qui semblent les scanner quelle est l'IP qui effectue réellement
l'analyse et quelles IP ne sont en réalité que d'innocent leurres.
Bien que ceci puisse être contré par
path tracing, response-dropping, et d'autres mécanismes actifs,
c'est généralement une technique efficace pour dissimuler son adresse IP.
.Sp
Séparez chaque hôte-leurre par des virgules, et vous pouvez optionnellement
utiliser '\fBME\fR' (Moi) comme l'un des leurres pour représenter
la position que vous voulez utiliser pour votre adresse.
Si vous utilisez '\fBME\fR' au delà de la 6ème position, la plupart des détecteurs de scan
(même l'excellent scanlogd de Solar Designer) seront incapables de voir votre adresse IP.
Si vous n'utilisez pas '\fBME\fR', nmap choisira une position aléatoire.
.Sp
Remarquez que les hôtes leurres doivent être actifs
ou vous risquez accidentellement de faire une inondation SYN sur vos cibles.
Il est aussi presque facile de déterminer qui est en train de scanner si seul une
seule machine est active sur le réseau. Vous pouvez vouloir utiliser des adresses IP
à la place des noms (ainsi les réseaux leurres ne vous verront pas dans les logs du serveurs de nom).
.Sp
Remarquez également que quelques détecteurs (stupides) de scan bloqueront
les hôtes qui tentent des scans de ports. Aussi vous pouvez par inadvertance
bloquer l'accès des machines leurres à la machine cible.
Ceci peut provoquer de grave problèmes aux machines cibles si le leurre s'avère être
sa passerelle internet ou même «\ localhost\ ». Il faut donc utiliser prudemment cette option.
La vraie morale de cette histoire est que les détecteurs de scan ne doivent pas prendre de
mesures contre les machines qui semblent les analyser, car il se peut que ce soit des leurres\ !
.Sp
Les leurres sont utilisés pour le scan initial (en utilisant ICMP,
SYN, ACK, ou autre chose) et pendant la véritable phase de scan. Les leurres sont aussi
utilisés pendant la détection de l'hôte distant (
.B \-O
).
.Sp
Il ne faut pas oublier que d'utiliser un trop grand nombre de leurres
peut ralentir
le scan et même le rendre imprécis. De plus certains
fournisseurs d'accès à Internet (FAI) filtreront vos paquets usurpés, bien que la plupart
n'applique aucune restriction sur les paquets usurpés.
.TP
.B \-S <adresse_ip>
Dans certaines circonstances,
.I nmap
est incapable de déterminer l'adresse source.
.I Nmap
vous avertira si c'est le cas). Dans cette situation, utilisez
\-S avec votre adresse IP (ou l'interface depuis laquelle vous voulez envoyer les paquets).
.Sp
Une autre utilisation possible de ce drapeau est d'usurper le scan pour faire croire
aux cibles que
.B quelqu'un d'autre les scanne.
Imaginez une entreprise qui se croit régulièrement scannée par un concurrent\ !
Ce n'est pas l'utilisation première ni le but principal de ce drapeau.
Je pense que c'est juste une possibilité intéressante pour les personnes qui sont au courant
avant qu'elles n'en accusent d'autres de les scanner.
.B \-e
est généralement requis pour ce type d'utilisation.
.TP
.B \-e <interface>
indique l'interface réseau à utiliser pour envoyer et recevoir les paquets.
\fBNmap\fR devrait être capable de détecter ceci mais il vous préviendra s'il n'y parvient pas.
.TP
.B \-g <portnumber>
Spécifie le numéro de port source dans le scan.
Beaucoup de pare-feux et de filtreur de paquets naïfs
feront une exception dans leurs règles pour autoriser le passage des paquets
DNS (53) ou FTP-DATA (20) pour établir une connexion.
Évidemment ça réduit complètement les avantages de sécurité d'un pare-feu
puisque les intrus n'ont qu'à se déguiser en FTP ou DNS en modifiant leur
port source. Évidemment pour un scan UDP vous devriez utiliser
53 en premier et pour les scans TCP vous devriez utiliser
20 avant 53.
Remarquer que ce n'est qu'une requête -- nmap ne le fera que s'il y parvient.
Par exemple, vous ne pouvez pas faire des analyse en parallèle avec un seul port.
Aussi \fBnmap\fR changera le port source même si vous utilisez \fB-g\fR.
.Sp
Sachez qu'il y a une petite pénalité de performance sur certains scans si vous utilisez
cette option, parce que j'enregistre parfois des informations utiles dans le numéro de port
source.
.TP
.B \--data_length <nombre>
Normalement nmap envoie des paquets minimalistes qui ne contiennent que l'en-tête.
Ainsi, les paquets TCP font 40 octets et les requêtes d'écho ICMP, 28 octets.
Cette option indique à Nmap d'ajouter le nombre spécifié d'octets initialisés à 0
à la plupart des paquets qu'il envoie. La détection de système d'exploitation
(-O) n'est pas affectée, mais la plupart des paquets de ping et de scan de port
le sont. Ça ralentit les choses, mais ça peut être un peu moins voyant.
.TP
.B \-n
Dit à Nmap de ne
.B JAMAIS
faire de résolution DNS inverse sur une adresse IP active. Comme DNS est
souvent lent,
ça peut aider à accélérer les choses.
.TP
.B \-R
Dit à Nmap de
.B TOUJOURS
faire la résolution DNS inverse des adresses IP cibles. Normalement
ceci n'est fait que pour les machines vivantes.
.TP
.B \-r
Dit à Nmap
.B DE NE PAS
changer aléatoirement l'ordre dans lequel les ports seront analysés.
.TP
.B \-\-randomize_hosts
Dit à nmap de mélanger chaque groupe comprenant jusqu'à 2048 hôtes avant de les analyser.
Ceci rend les scans moins évidents à de nombreux systèmes de surveillance réseau,
particulièrement quand vous le combinez avec des options
pour ralentir le timing (voir ci-dessous).
.TP
.B \-M <max sockets>
Spécifie le nombre maximum de sockets qui seront utilisés en parallèle
pour le scan TCP connect() (celui par défaut). C'est utile pour
ralentir légèrement le scan et éviter de crasher les machines cibles. Une autre
approche consiste à utiliser \fB-sS\fR, qui est généralement plus facile à gérer
pour les machines.
.TP
.B OPTIONS TIMING
généralement nmap parvient à s'ajuster correctement
aux caractéristiques du réseau et à analyser aussi vite que possible
tout en minimisant la probabilité d'être détecté.
Cependant, il y a des cas où les timings par défaut
de Nmap ne correspondent pas à vos objectifs. Les options suivantes
permettent un contrôle fin des timings\ :
.TP
.B -T <Paranoid | Sneaky | Polite | Normal | Aggressive | Insane>
Ce sont les différentes politiques de timing pour communiquer de
manière pratique vos priorités à nmap.
.B Paranoid
analyse
.B très lentement
dans l'espoir d'éviter d'être repéré par les système de détection d'intrusion.
Il sérialise tous les scans (pas de scan parallèle) et attend au moins
5 minutes entre les envois de paquets.
.B Sneaky
c'est la même chose, sauf qu'il attend 15 secondes entre les envois de paquets.
.B Polite
essaye de minimiser la charge sur le réseau et de réduire la probabilité de
crasher des machines. Il sérialises les test et attend
.B au moins
0,4 secondes entre chaque.
.B Normal
c'est le comportement par défaut de Nmap, qui essaye de s'exécuter aussi
vite que possible sans surcharger le réseau ou oublier des
hôtes/ports.
.B Aggressive
ajoute un décompte de 5 minutes par hôte et n'attends jamais les réponses
individuelles plus de 1.25 secondes.
.B Insane
ne convient qu'aux réseaux ultra-rapides où vous ne risquez par de perdre
d'informations. Il ajoute un décompte de 75
secondes et n'attend les réponses individuelles que pendant
0,3 secondes. Il permet de balayer très rapidement les réseaux.
Vous pouvez aussi référencer ces modes par numéro (0-5).
Par exemple, '-T 0' donne le mode Paranoid et '-T 5' le mode Insane.
.Sp
Ces modes timings NE devrait PAS être utiliser en combinaison avec les contrôles
de bas niveau donnés ci-dessous.
.TP
.B --host_timeout <millisecondes>
Spécifie la durée que \fBnmap\fR est autorisée à consacrer
à l'analyse d'un hôte unique avant d'abandonner cette IP.
Par défaut il n'y a pas de temps limite pour un hôte.
.TP
.B --max_rtt_timeout <millisecondes>
Spécifie la durée maximale que \fBnmap\fR peut laisser s'écouler en attendant
une réponse à ses tests avant de retransmettre ou de laisser tomber.
La valeur par défaut est 9\ 000.
.TP
.B --min_rtt_timeout <millisecondes>
Quand les hôtes cibles commencent à établir un modèle de réponse très
rapidement, \fBnmap\fR diminuera la durée accordée par test.
Ceci augmente la vitesse du scan, mais peut conduire à la perte de paquets
quand une réponse prend plus de temps que d'habitude.
Avec ce paramètre vous pouvez garantir que \fBnmap\fR attende au moins
une certaine durée avant de laisser tomber un test.
.TP
.B --initial_rtt_timeout <millisecondes>
Spécifie le décompte du test initial. Ce n'est généralement utile
que lors de l'analyse d'hôte derrière un pare-feu avec -P0.
Normalement \fBnmap\fR obtient de bonnes estimations à partir
du ping et des premiers tests. Le mode par défaut est 6\ 000.
.TP
.B --max_parallelism <nombre>
Spécifie le nombre maximum de scans que \fBnmap\fR est autorisé à mener en parallèle.
Positionner ceci à 1 signifie que \fBnmap\fR n'essayera jamais de
scanner plus d'un port à la fois. Ce nombre affecte aussi les autres scans
parallèle comme le balayage de ping, RPC scan, etc.
.TP
.B --scan_delay <millisecondes>
Spécifie la durée
.B minimum
que \fBnmap\fR doit laisser s'écouler entre ses envois. C'est utile pour réduire la
charge du réseau ou pour ralentir le débit du scan afin de ne pas atteindre
le seuil de déclenchement des systèmes de détection d'intrusion.
.SH SPÉCIFICATION DE CIBLE
Tout ce qui n'est pas une option ou un argument d'option
est traité par nmap comme une spécification d'hôte.
Le cas le plus simple et une liste de nom d'hôtes ou d'adresse IP sur la ligne
de commande.
Si vous voulez analyser un sous réseau d'adresses IP vous pouvez ajouter
.B '/mask'
au nom d'hôtes
.B mask
doit être compris entre 0 (scanner tout internet) et 32 (scanner un seul
hôte). Utiliser /24 pour analyser des adresses de classe 'C'
et /16 pour la classe 'B'.
.Sp
\fBNmap\fR utilise une notation puissante pour spécifier une adresse IP
en utilisant des listes/intervalles pour chaque élément.
Ainsi vous pouvez analyser tout un réseau de classe B
192.168.*.* en spécifiant '192.168.*.*' ou '192.168.0-255.0-255' ou
même '192.168.1-50,51-255.1,2,3,4,5-255'. Et bien sûr, vous pouvez utiliser
la notation mask : '192.168.0.0/16'. Elles sont toutes équivalentes
Si vous utilisez des astérisques ('*'), souvenez-vous que la plupart des
shells nécessitent que vous les précédiez par des anti-slash ou que vous les
protégiez par des guillemets.
.Sp
Une autre chose intéressante à faire et de découper Internet\ :
au lieu de scanner les hôtes dans une classe 'B',
scanner '*.*.5.6-7' pour analyser toutes les adresses IP se terminant
par .5.6 ou .5.7. Pour plus d'informations sur la spécification
des hôtes à analyser, voyez la section
.I exemples.
.SH EXEMPLES
Voici quelques exemples d'utilisation de \fBnmap\fR du plus simple au plus compliqué.
Remarquez que les noms et adresses sont utilisées pour rendre les choses
plus concrètes. À leur place vous devriez substituer les noms et adresses
de
.B votre propre réseau.
Je ne pense pas que l'analyse de ports d'autres réseaux soit illégale, ni
que l'analyse de ports doit être considérée par les autres comme une attaque.
J'ai analysé des centaines de milliers de machines et je n'ai reçu
qu'une seule plainte. Mais je ne suis pas juriste et certaines personnes pourraient
être ennuyées par les tests de
.I nmap.
Aussi demandez préalablement la permission ou utilisez \fBnmap\fR
à vos risques et périls.
.Sp
.B nmap -v cible.exemple.com
.Sp
Cette option analyse tous les ports TCP réservés sur la machine
cible.exemple.com . Le \-v signifie d'activer le mode verbeux.
.Sp
.B nmap -sS -O cible.exemple.com/24
.Sp
Envoie un scan SYN furtif contre chaque machine active parmi
les 255 machines de classe 'C' qui sont sur cible.exemple.com.
Il essaye aussi de déterminer quel système d'exploitation fonctionne sur
chaque hôte. Ceci nécessite les privilèges root en raison du scan SYN et
de la détection de système d'exploitation.
.Sp
.B nmap -sX -p 22,53,110,143,4564 "198.116.*.1-127"
.Sp
Envoie un scan Xmas tree à la première moitié
de chacun des 255 sous-réseaux de l'espace d'adresse de classe B
198.116. Nous sommes en train de tester si les systèmes font fonctionner sshd,
DNS, pop3d, imapd, ou port 4564. Remarquez que les scan Xmas
ne fonctionnent pas contre les machines Microsoft en raison de leur pile TCP
déficiente. Le même problème se produit aussi avec les machines
CISCO, IRIX, HP/UX, et BSDI.
.Sp
.B nmap -v --randomize_hosts -p 80 '*.*.2.3-5'
.Sp
Plutôt que de se concentrer sur une plage spécifique d'IP,
il est parfois intéressant de découper l'ensemble d'Internet et
d'analyser un petit échantillon de chaque tranche. Cette commande
trouve tous les serveurs web sur des machines dont l'adresse IP
se termine par .2.3, .2.4 ou .2.5 .
Si vous êtes root, vous pouvez aussi ajouter \fB-sS\fR.
Vous trouverez plus de machine intéressantes en commençant à 127, aussi
vous utiliserez '127-222' à la place de la première astérisque
car cette section possède une plus grande densité de machine intéressantes.
.Sp
.B host -l company.com | cut '-d ' -f 4 | ./nmap -v -iL -
.Sp
Fait un transfert DNS pour découvrir les hôtes de company.com
et utiliser leurs adresses IP pour alimenter
\fInmap\fR.
Les commandes ci-dessus sont pour mon ordinateur GNU/Linux.
Vous pouvez avoir besoin d'autres commandes/options pour d'autres systèmes d'exploitations.
.SH BOGUES
Bogues\ ? Quels bogues\ ? Envoyez-moi tout ce que vous trouverez.
Les patchs sont les bienvenus. Souvenez-vous
que vous pouvez aussi envoyer les empreintes de nouveaux systèmes
d'exploitation pour enrichir la base de données.
Si une empreinte appropriée est trouvée, Nmap
affichera l'URL à laquelle vous pourrez l'envoyer.
.SH AUTEUR
.Sp
Fyodor
.I <fyodor@insecure.org>
.SH DISTRIBUTION
La dernière version de
.I nmap
peut être obtenu depuis
.I http://www.insecure.org/nmap/
.Sp
.I nmap
est (C) 1995-2001 par Insecure.Com LLC
.Sp
.I libpcap
est aussi distribuée avec nmap. Il est copyrighté par
Van Jacobson, Craig Leres et Steven McCanne, tous du
Lawrence Berkeley National Laboratory, University of
California, Berkeley, CA. La version distribuée avec nmap
peut être modifiée, les sources d'origine sont disponibles
à ftp://ftp.ee.lbl.gov/libpcap.tar.Z .
.Sp
Ce programme est un logiciel libre, vous pouvez
le redistribuer et/ou le modifier sous les termes de la
GNU General Public License telle que publiée par
par la Free Software Foundation\ ;
Version 2. Ceci garantit votre droit d'utiliser, modifier
et redistribuer Nmap sous certaines conditions.
Si cette licence est inacceptable pour vous, Insecure.Org
pourrait éventuellement vendre d'autres licences.
(contacter \fBfyodor@dhp.com\fR).
.Sp
Les sources sont fournies avec ce logiciel
car nous croyons que les utilisateurs ont le droit de savoir exactement ce que
fait un programme avant de le lancer. Ceci vous permet aussi d'auditer le
logiciel pour rechercher des trous de sécurité
(aucun n'a été trouvé jusqu'à présent).
.Sp
Le code source vous permet aussi de porter Nmap vers de nouvelles plates-formes,
corriger des bogues et ajouter de nouvelles caractéristiques.
Vous êtes vivement encouragé à envoyer vos modifications
à \fBfyodor@insecure.org\fR pour une éventuelle incorporation dans
la distribution principale. En envoyant ces modifications à
Fyodor ou à quelqu'un de la liste de diffusion de développement
de insecure.org, il est supposé que vous offrez à
Fyodor le droit illimité et non exclusif de réutiliser,
modifier et relicencier le code. C'est important parce que l'impossibilité
de relicencier le code a provoqué des problèmes dévastateurs dans d'autres
projets de logiciel libre (comme KDE et NASM).
Nmap sera toujours disponible en Open Source.
Si vous désirez spécifier des conditions particulières de licence pour vos
contributions, dites-le nous simplement quand vous nous les envoyez.
.Sp
Ce programme est distribué dans l'espoir d'être utile, mais
.B SANS AUCUNE GARANTIE
même la garantie implicite relative à la
.B QUALITÉ MARCHANDE
ou
.B D'APTITUDE À UNE UTILISATION PARTICULIÈRE.
Voir la licence GPL (c'est le fichier COPYING de la
distribution \fInmap\fR.
.Sp
Remarque\ : Nmap a déjà fait planter certaines
applications, des piles TCP/IP et même des systèmes d'exploitations mal écrits.
Par conséquent
.B Nmap ne devrait jamais être utilisé contre des systèmes qui ont une mission
critique à moins que vous ne soyez prêt à souffrir d'une éventuelle
interruption de service. Nous reconnaissons ici que \fbnmap\fR
peut crasher vos systèmes et réseaux mais nous ne sommes pas responsables
des dégâts que Nmap pourrait provoquer.
.Sp
En raison du léger risque de crashs et parce que quelques personnes
mal intentionnées utilisent nmap pour les reconnaissances préliminaires à une
attaque, certains administrateurs deviennent furieux et se plaignent quand leurs
systèmes sont scannés. C'est pourquoi il est plus sage de demander la permission
avant de lancer l'analyse d'un réseau.
.Sp
Nmap ne devrait jamais être lancé avec des privilèges (par exemple suid root)
pour des raisons de sécurité.
.Sp
Toutes les versions de Nmap postérieures à la 2.0 sont compatibles
an 2000. Il n'y a aucune raison de penser que les versions antérieures ont des
problèmes, mais nous ne les avons pas testées.
.SH TRADUCTION
Sébastien Blanchet, 2002 <sebastien.blanchet AT free.fr>
.SH RELECTURE
Gérard Delafond

View file

@ -1,991 +0,0 @@
.\" This definition swiped from the gcc(1) man page
.de Sp
.if n .sp
.if t .sp 0.4
..
.TH NMAP 1
.SH NAME
nmap - Auswertungstool fuer Netzwerke und Security Scanner
.SH SYNTAX
.B nmap
[Scan-Typ(en)] [Optionen] <Host oder Netz #1 ... [#N]>
.SH BESCHREIBUNG
.I Nmap
wurde entwickelt, um Systemadministratoren und kuriosen Individuen die
Moeglichkeit zu geben, ansprechbare Systeme und die durch sie bereitgestellten
Dienste in grossen Netzwerken zu identifizieren.
.I nmap
unterstuetzt eine Vielzahl verschiedener Scanning-Techniken, wie zum Beispiel
UDP, TCP connect(), TCP SYN (half open), FTP-Proxy (bounce attack),
Reverse-ident, ICMP (Ping-Suchlauf), FIN, ACK-Suchlauf, Xmas-Tree,
SYN-Suchlauf, IP-Protocol und Null-Scan.
Siehe Absatz
.I Scan-Typen
fuer mehr Informationen. Ebenso ermoeglicht nmap eine Vielzahl von
zusaetzlichen Moeglichkeiten, wie das Erkennen von Betriebssystemen mittels
TCP/IP-Fingerprinting, Stealth-Scanning, dynamische Verzoegerungen und
Uebertragungswiederholungs-Berechnungen, paralleles Scanning, Entdecken
abgeschalteter Systeme mittels parallelem Scanning, Decoy-Scanning, entdecken
von Port-Filtering, direktes RPC-Scanning (ohne Portmapper), fragmentiertes
Scanning sowie flexible Ziel und Port Spezifizierung.
.PP
Ein Grossteil der Arbeit wurde in die Moeglichkeiten fuer non-root Benutzer
investiert. Leider benoetigen viele exotische Techniken (z.B. die Kernel-nahen
raw sockets) root-Privilegien. Aus diesem Grund sollte nmap stets als root
genutzt werden, sofern dies moeglich ist (natuerlich kein setuid root).
.PP
Das Resultat eines nmap-Durchlaufs ist normalerweise eine Liste saemtlicher
interessanter Ports der gescannten Geraete (falls vorhanden). Sofern eine
Zuweisung stattfinden kann, benennt nmap die well-known Ports direkt mit ihrem
Service-Namen, Portnummer, Status und Protokoll. Der Status ist
entweder 'open', 'filtered' oder 'unfiltered'. Open (dt. offen) bedeutet, dass
das Zielsystem auf diesem Port Verbindungen anzunehmen in der Lage ist.
Filtered (dt. gefiltert) weist darauf hin, dass ein dediziertes
Firewall-System, TCP/IP-Filter oder Netzwerk-Element die Arbeit von nmap
behindert und somit keine verlaesslichen Rueckschluesse gemacht werden
koennen. Unfiltered (dt. ungefiltert) heisst, dass nmap den Port kennt, jedoch
beim Zugriff keinerlei Filter-Mechanismen ausgemacht werden konnten. Der
ungefilterte Status wird in den meisten aller Faelle vorhanden sein, weshalb
ein solcher nur immer dann ausgwiesen wird, wenn die meisten der gescannten
Ports gefiltert (engl. filtered) sind.
.PP
Jenachdem, welche Optionen angewandt wurden, ist nmap in der Lage Auskunft
ueber die folgenden Charakteristiken des Zielsystems zu geben: Genutztes
Betriebssystem, TCP-Sequenznummern, Benutzername der an die Ports gebundene
Software, DNS-Name, ob es sich um ein Smurf-System handelt und viele mehr.
.SH OPTIONEN
Das Zusammenspiel verschiedener Optionen ist immer dann moeglich, wenn dies
auch Sinn macht. Einige Parameter koennen nur in Verbindung mit spezifischen
Scan-Methoden genutzt werden.
.I nmap
versucht unlogische und nicht unterstuetzte Kombinationen von Parametern
abzufangen und den Benutzer entsprechend zu warnen.
.Sp
Falls Sie ungeduldig sind, koennen Sie den Abschnitt
.I Beispiele
ueberspringen. Darin werden typische Befehlseingaben gezeigt. Ebenso kann
.B nmap -h
ausgefuehrt werden, um eine kurze Optionsreferenz ausgeben zu lassen.
.TP
.B SCAN-TYPEN
.TP
.B -sS
TCP SYN-Scan: Diese Technik wird oft als "halb-offen" (engl. "half-open")
bezeichnet, da keine volle TCP-Verbindung zustande kommt. Der Scanner schickt
ein TCP-Datagramm mit gesetzter SYN-Flagge an das Zielsystem, so wie dies im
Rahmen des Drei-Wege-Handschlags von TCP normalerweise auch der Fall ist. Nun
wird auf eine positive Rueckmeldung des Zielsystems gewartet. Kommt ein Paket
mit gesetzter SYN/ACK-Flagge zurueck, so wird der Zielport als im Status
LISTENING (dt. abhoerend) identifiziert. Im Gegenzug deutet ein RST-Datangramm
auf einen geschlossenen Port (engl. closed) hin. Wird ein SYN/ACK-Datagramm
entgegengenommen, schickt nmap (bzw. der Betriebssystem-Kernel) automatisch
ein RST zurueck, um den Verbindungsaufbau zu abzubrechen. Der primaere Vorteil
dieser Vorgehensweise ist, dass viele Systeme solcherlei Zugriffe nicht
protokollieren (Die meisten Applikationen interessieren sich nur fuer
vollstaendig etablierte Verbindungen). Leider setzt diese Scan-Technik
root-Privilegien voraus, da eine Generierung verhaeltnismaessig exotischer
Paket-Sequenzen von Noeten ist. Dies ist die standardmaessige Scan-Methode
fuer priviligierte Benutzer.
.TP
.B -sT
TCP connect()-Scan: Dies ist die klassische Form des TCP-Portscannings. Der
connect()-System-Call, der das Betriebssystem zur Verfuegung stellt, wird
immer dann genutzt, wenn eine Verbindung zum Port eines Zielsystems
hergestellt werden soll. Befindet sich der Zielport im Status LISTENING, so
wird der connect()-Zugriff erfolgreich ausfallen. Der entscheidende Vorteil
dieser Methode ist, dass keine erweiterten Rechte zur Durchfuehrung
erforderlich sind. Jeder Benutzer der meisten UNIX-Systeme ist in der Lage
solcherlei Zugriffe durchzufuehren.
.Sp
Diese Scan-Technik ist einfach zu entdecken und wird mit groesster
Wahrscheinlichkeit in den Protokoll-Dateien des Zielsystems auftauchen. Dies
ist der standardmaessig aktivierte Scan-Typ fuer unprivilegierte Anwender.
.TP
.B -sF -sX -sN
Stealth FIN-, Xmas-Tree- oder Null-Scan-Modis: Es gibt Momente, wo SYN-Scans
nicht heimlich genug ausfallen. Einige Firewall-Systeme (z.B. Packet-Filter)
sind in der Lage verdaechtige SYN-Aktivitaeten zu erkennen; ebenso koennen
Programme wie Synlogger oder Courtney die SYN-Portscans als solche ausweisen.
Diese erweiterten Scan-Techniken koennen somit in manchen Faellen ungehindert
die gewuenschten Resultate liefern.
.Sp
Die Idee ist, dass geschlossene Ports auf solcherlei Zugriffe mit einem
RST-Datagramm antworten muessten, waehrend ansprechbare Ports die Anfragen
ignorieren sollten (siehe RFC 793, S. 64). Der FIN-Scan nutzt ein
TCP-Datagramm mit gesetzter FIN-Flagge, waehrend der Xmas-Tree-Scan die
TCP-Flaggen FIN, URG und PSH aktiviert. Der Null-Scan schaltet alle optionalen
Flags ab. Leider ignoriert einmal mehr Microsoft die gaengigen Standards und
reagiert auf die exotischen Scan-Techniken ganz unerwartet. Dies bedeutet,
dass diese Scanning-Methoden nicht gegen Windows 9x, ME, NT, 2000 und XP
funktionieren. Auf der anderen Seite ist dies natuerlich hervorragend, wenn es
um das Identifizieren der TCP/IP-Implementierung von Microsoft geht: Findet
einer dieser Scans einen offenen Port, so kann davon ausgegangen werden, dass
es sich beim Zielsystem nicht um ein Windows handelt - Im Gegenzug deuten
unrealistisch viele offene Ports auf eine Windows-Maschine hin. Es gilt sich
jedoch noch die Meinung einer klassischen Scan-Methode (z.B. SYN) einzuholen.
Es gibt noch einige andere Betriebssysteme, die sich aehnlich demjenigen von
Microsoft verhalten. Dies sind zum Beispiel Cisco, BSDI, HP/UX, MVS und IRIX.
All diese retournieren ein Reset, auch wenn es sich um einen ansprechbaren
Port handelt. Mittlerweile ist diese knifflige Unterscheidungs-Arbeit mittels
exotischer Scanning-Techniken eher weniger wichtig, da nmap eine erweiterte
Methode fuer das Erkennen des eingesetzten Betriebssystems mitbringt.
.TP
.B -sP
Ping-Scanning: Manchmal ist es lediglich gefragt, welche Hosts in einem
Netzwerk aktiv sind. nmap kann diese Frage beantworten, indem eine ICMP echo
request-Anfrage an jede IP-Adresse im spezifizierten Netzwerk geschickt wird.
Hosts, die mit einer ICMP echo reply antworten, koennen als aktiv ausgewiesen
werden. Viele gewissenhafte Firewall- und Systemadministratoren filtern bzw.
verwerfen unnoetigen ICMP-Verkehr. nmap greift sodann auf eine andere Technik
zurueck. Es wird ein TCP-Datagramm mit gesetzter ACK-Flagge an einen
potentiell offenen Port des Zielsystems geschickt (standardmaessig TCP-Port
80). Wird ein RST zurueckgeschickt, so ist das Zielsystem vorhanden und
ansprechbar. Eine dritte Technik greift auf ein SYN-Datagramm zurueck, das auf
ein RST oder SYN/ACK wartet. Alle non-root Benutzer fuehren einen
connect()-Zugriff durch.
.Sp
Standardmaessig (bei root-Benutzern) fuehrt nmap beides - ICMP- und
ACK-Technik - parallel durch. Dies kann durch das Heranziehen der spaeter noch
detaillierter beschriebenen Option
.B -P
geaendert werden.
.Sp
Wichtig ist zu wissen, dass der Ping-Zugriff standardmaessig stets erfolgt.
Abhaengig der Erreichbarkeit eines Systems wird ein solches dann gescannt.
Benutzen Sie diese Option lediglich dann, wenn es um das Durchfuehren eines
Ping-Suchlaufs (
.B ohne
Portscan) geht.
.TP
.B -sU
UDP-Scans: Diese Methode wird stets dann herangezogen, wenn es um das
Identifizieren der offenen UDP-Ports (siehe RFC 768) eines Systems geht. Diese
Technik basiert darauf, dass ein UDP-Datagramm mit 0 Byte an Nutzdaten an
jeden Port des Zielsystems geschickt wird. Erhalten wir eine ICMP port
unreachable-Nachricht, so ist der Zielport geschlossen. Andererseits handelt
es sich um einen offenen Port.
.Sp
Einige Leute denken, dass UDP-Scanning sinnlos ist. Ich moechte in diesem
Zusammenhang auf die Luecke in Solaris' rpcbind hinweisen. rpcbind kann an
einem undokumentierten UDP-Port ueber 32770 gefunden werden. Bei diesem
Angriff und der vorangehenden Auswertung ist es sodann zu einem hohen Grad
irrelevant, ob Port 111 durch eine Firewall blockiert wird oder nicht. Ebenso
existiert das populaere, von cDc entwickelte Backdoor namens Back Orifice, das
durch einen frei waehlbaren UDP-Port Windows-Maschinen kontrollieren laesst.
Und nicht zu vergessen die vielen potentiell verwundbaren Dienste, die auf UDP
zurueckgreifen: SNMP, TFTP, NFS, etc.
.Sp
Traurigerweise ist UDP-Scanning in den meisten Faellen schmerzhaft langsam,
seitdem viele Betriebssystem-Entwickler der Empfehlung von RFC 1812 (Absatz
4.3.2.8) nachgekommen sind, die Anzahl ausgehender ICMP-Fehlernachrichten zu
limitieren. Zum Beispiel definiert der Linux-Kernel (in net/ipv4/icmp.h) die
Anzahl ausgehender ICMP destination unreachable-Fehlermeldungen auf 80 fuer 4
Sekunden, mit einer 1/4 Sekunde Zusatz fuer jeden Uebertritt. Solaris weist
einiges striktere Limitierungen auf (2 Nachrichten pro Sekunde), weshalb ein
UDP-Portscan gegen ein Solaris-System sehr lange dauert.
.I nmap
ist in der Lage solcherlei Limitierungen zu erkennen und mit einem dynamischen
Verlangsamen der Geschwindigkeit zu reagieren. Dies verhindert das Verstopfen
des Netzwerks mit unnoetigen Paketen, die sowieso vom Zielsystem ignoriert
werden wuerden.
.Sp
Einmal mehr typisch, ignoriert Microsoft die Empfehlungen des RFCs, weshalb
eine Einschraenkung ausgehender ICMP-Fehlermeldungen gaenzlich bei der
TCP/IP-Implementierung auf Windows 9x und NT fehlt. Das scannen saemtlicher
UDP-Ports auf einer Windows-Maschine ist somit kein groesseres Problem.
.TP
.B -sO
IP protocol-Scans: Diese Methode kommt dann zum Tragen, wenn herausgefunden
werden will, welche IP-Protokolle vom Zielsystem unterstuetzt werden. Diese
Technik basiert darauf, dass fuer jedes IP-Protokoll ein RAW IP-Paket mit
fehlendem Protokoll-Header an das Zielsystem geschickt wird. Erhalten wir eine
ICMP protocol unreachable-Fehlermeldung, so koennen wir davon ausgehen, dass
das besagte Protokoll nicht unterstuetzt wird. Faellt das Resultat anders aus,
kann mit einer Protokoll-Unterstuetzung gerechnet werden. Es ist wichtig zu
bemerken, dass einige Betriebssysteme (z.B. AIX, HP-UX und Digital UNIX) und
Firewall-Loesungen auf das Versenden der ICMP protocol
unreachable-Fehlermeldungen gaenzlich verzichten. Das Resultat eines solchen
Verhaltens ist die durch nmap generierte Ausgabe, dass saemtliche Protokolle
"offen" sind.
.Sp
Aufgrund dessen, dass diese Scan-Methode in ihren Grundzuegen auf den
Prinzipien des UDP-Portscannings aufbaut, spielt die Rate der potentiell
generierten ICMP-Fehlermeldungen eine beachtliche Wichtigkeit. Da das
IP-Protokoll Feld nur 8 Bits hat, muessen lediglich 256 Protokolle gescannt
werden, was sich in einem angemessenen Zeitrahmen erledigen laesst.
.TP
.B -sI <Zombie-Host[:Zielport]>
Idlescan: Diese erweiterte Scan-Technik ermoeglicht ein blindes Scannen der
TCP-Port eines Ziels (dies bedeutet, dass keinerlei Pakete mit der richtigen
IP-Absenderadresse verschickt werden). Stattdessen wird eine einzigartige
Attacke angewandt, die die Berechenbarkeit der IP Fragmentation ID eines
Zombie-Hosts ausnutzt. Intrusion Detection-Systeme werden den Scan-Versuch
dem spezifizierte Zombie-System zuschreiben (welches ansprechbar sein und
bestimmte Kriterien erfuellen muss). Ich habe eine Publikation zu diesem
Thema verfasst, die sich unter http://www.insecure.org/nmap/idlescan.html
findet.
.Sp
Neben der vollkommenen Sicherheit, nicht direkt erkannt werden zu koennen,
ermoeglicht dieser Scan-Typ das Erkennen von IP-basierenden
Vertrauensbeziehungen zwischen Geraeten. Das Port-Listing zeigt die offenen
Ports
.I aus der Sicht des Zombie-Systems.
Es ist sodann Moeglich das effektive Zielsystem durch verschiedene Zombies
scannen zu lassen, die eine bestehende Vertrauensbeziehung haben (via Router-
oder Packetfilter-Regeln). Ganz offensichtlich ist dies eine gewichtige
Information, wenn es um das Priorisieren von Angriffszielen geht. Andererseits
muessten Penetration Tester zuerst muehsam ein System kompromittieren, bis
verlaesslich gesagt werden kann, ob ueberhaupt die erforderliche
Vertrauensbeziehung besteht.
.Sp
Durch einen Doppelpunkt laesst sich die Portnummer des Zombiesystems
definieren. Ohne diese Angabe waehlt nmap den Standardport, der auch bei
TCP-Pings Verwendung findet (TCP-Port 80).
.TP
.B -sA
ACK-Scan: Auf diese erweiterte Scan-Technik wird normalerweise immer dann
zurueckgegriffen, wenn es um das Identifizieren eines Firewall-Regelwerks
geht. Zusaetzlich kann diese Methode eine Determinierung des Vorhandenseins
einer Stateful Inspection, die eingehende SYN-Pakete blockt, ermoeglichen.
.Sp
Dieser Scan-Typ schickt ein ACK-Paket (mit zufaellig gewaehlten
Bestaetigungs-/Sequenznummern) an den spezifizierten Zielport. Kommt ein RST
zurueck, wird der besagte Port als "unfiltered" (dt. ungefiltert) eingestuft.
Erhalten wir keine Rueckantwort (oder kommt ein ICMP unreachable zurueck), so
weist nmap den Port als "filtered" (dt. gefiltert) aus. Wichtig ist, dass
.I nmap
normalerweise keine "unfiltered" ausgibt. So sind
.B keine
Ports in der Ausgabe ein Indiz dafuer, dass alle Zugriffe durchgekommen sind
(und ein RST verursacht haben). Dieser Scan wird die Ports nie in einem
"open" (dt. offenen) Status zeigen.
.TP
.B -sW
Window-Scan: Diese erweiterte Scan-Technik ist dem ACK-Scan sehr aehnlich.
Ausser, dass hiermit manchmal auch offene, ungefilterte und gefilterte Ports
durch eine Anomalie in der durch die Betriebssysteme gewaehlten TCP window
size entdeckt werden koennen. Systeme, die gegen diese Attacke verwundbar sind,
sind einige Versionen von AIX, Amiga, BeOS, BSDI, Cray, Tru64 UNIX, DG/UX,
OpenVMS, Digital UNIX, FreeBSD, HP-UX, OS/2, IRIX, MacOS, NetBSD, OpenBSD,
OpenStep, QNX, Rhapsody, SunOS 4.x, Ultrix, VAX and VxWorks. Siehe das Archiv
der nmap-Hackers Mailingliste fuer eine vollstaendige Auflistung.
.TP
.B -sR
RPC-Scan: Diese Methode arbeitet in Kombination mit den meisten moeglichen
Scan-Typen von nmap zusammen. Jeder als offen identifizierte TCP- und UDP-Port
wird mit einer Vielzahl von SunRPC-Nullkommandos ueberflutet, um eine
Identifizierung von RPC-Ports vorzunehmen. Falls ein solcher gefunden wurde,
wird der Programmname und die Version ausgelesen, sofern diese Information zur
Verfuegung gestellt wird. Diese Vorgehensweise ist ebenso mit dem Heranziehen
von 'rpcinfo -p' moeglich; besonders dann, wenn des Zielsystems Portmapper
hinter einer restriktiven Firewall steht oder durch einen TCP-Wrapper
geschuetzt wird. Decoy-Scans arbeiten zur Zeit nicht mit RPC-Scans zusammen.
Irgendwann wird vielleicht Decoy-Scanning im Zusammenhang mit UDP-RPC-Scans
moeglich sein.
.TP
.B -sL
List-Scan: Diese simple Methode generiert eine Liste aller IP-Adressen und
Hostnamen, ohne die Zielsysteme direkt anzusprechen (Ping oder Portscan).
Eine Namensaufloesung ueber DNS findet stets statt, sofern dies nicht durch
das Heranziehen von -n unterbunden wird.
.TP
.B -b <FTP-Relay Host>
FTP-Bounce Attacke: Ein interessantes "Feature" des File Transport Protocols
(RFC 959) ist die Unterstuetzung von "Proxy"-FTP-Verbindungen. Mit anderen
Worten ist es moeglich, sich von boese.com auf ziel.com zu verbinden und
eine Datei ueberall hin zu schicken. Nun, dies hat wohl ausgezeichnet
funktioniert, als 1985 das besagte RFC geschrieben wurde. In der heutigen
Zeit ist es nicht mehr ohne weiteres Moeglich, sich auf fremde FTP-Server zu
verbinden und nach Belieben Dateien zu versenden. *Hobbit* schrieb 1995
folgendes zu dieser Schwachstelle: "[This protocol flaw] can be used to post
virtually untraceable mail and news, hammer on servers at various sites, fill
up disks, try to hop firewalls, and generally be annoying and hard to track
down at the same time." Bei dieser Scanning-Methode wird ein als Proxy
fungierender FTP-Server genutzt, um die offenen Ports eines Zielsystems
ausfindig zu machen. Beispielsweise kann dadurch zu einem hinter einer
Firewall positionierten FTP-Server verbunden werden, um danach interne, durch
das Firewall-Element gegen externe Zugriffe geschuetzte Ports (z.B. die
NetBIOS-Ports) anzusprechen. Falls auf dem FTP-Server ein Verzeichnis
existiert, bei dem sowohl Lese- als auch Schreibrechte vorhanden sind (z.B.
/incoming), kann eine semi-manuelle Uebergabe von Daten an die Zielports
durchgefuehrt werden (nmap nimmt einem diese Arbeit nicht ab).
.Sp
Das mit der Option '-b' uebergebene Argument, spezifiziert den als Proxy
gewollten Host, wobei die standard URL-Notation gilt. Das Format lautet
.I Benutzername:Passwort@Server:Port.
Alles, ausser
.I Server
ist optional. Wie eine Determinierung der gegen diese Zugriffsform verwundbare
Server vorgenommen werden kann, kann in meinem Artikel in
.I Phrack
51 nachgelesen werden. Eine aktualisierte Version ist auf der
.I nmap
Webseite (http://www.insecure.org/nmap) verfuegbar.
.TP
.B GENERELLE OPTIONEN
Keine der folgenden Optionen ist erforderlich. Einige von ihnen koennen jedoch
nuetzlich sein.
.TP
.B -P0
Verhindert das Pingen eines Hosts, bevor er gescannt wird. Dies ermoeglicht
das Scannen von Netzwerken, die keine ICMP echo requests (oder responses)
aufgrund einer restriktiv konfigurierten Firewall zulassen. microsoft.com ist
ein Beispiel fuer ein solches Netzwerk, in dem diese Funktion stets genutzt
werden sollte. Gebrauchen Sie
.B -P0
oder
.B -PT80
wenn ein Portscan gegen microsoft.com durchgefuehrt werden soll.
.TP
.B -PT
Benutzt einen TCP-Ping, um die Erreichbarkeit eines Hosts zu verifizieren.
Anstatt ICMP echo request-Abfragen zu verschicken und auf die entsprechenden
ICMP echo reply-Rueckantworten zu warten, wird auf ein TCP-Datagramm mit
gesetzter ACK-Flagge gesetzt. Ansprechbare Systeme sollten mit einem RST
antworten. Diese Funktion ist immer dann anzuwenden, wenn Systeme oder
Netzwerke gescannt werden sollen, die keine Erreichbarkeitsueberpruefung
mittels ICMP zulassen und trotzdem zuerst die Erreichbarkeit identifiziert
werden soll. Bei non-root Benutzern wird connect() angewandt. Um den Zielport
des Zugriffs zu spezifizieren, kann -PT<Portnummer> herangezogen werden. Der
Standardport ist einmal mehr TCP/80 (HTTP), da dieser eher selten durch einen
Filter gedeckt wird.
.TP
.B -PS
Diese Option benutzt fuer root-Benutzer SYN (Verbindungsanforderungen) anstatt
ACK-Pakete. Ansprechbare Hosts sollten mit einem RST (oder in seltenen Faellen
mit einem SYN/ACK) antworten. Das Setzen des Zielports kann auf die selbe Art
wie beim zuvor erlaeuterten -PT umgesetzt werden.
.TP
.B -PI
Diese Option nutzt einen klassischen Ping (ICMP echo request), um die
Erreichbarkeit von Systemen und Broadcast-Adressen von Subnetzen zu
identifizieren. Letztere sind extern erreichbare IP-Adressen, die eine
Umwandlung zu einem internen Broadcast des Subnetzes durchfuehren. Solcherlei
sollten verhindert werden, denn sie sind Voraussetzung fuer eine Reihe von
Denial of Service-Attacken (Smurf ist die bekannteste Variante).
.TP
.B -PP
Benutzt eine ICMP timestamp-Anfrage (Typ 13, Code 0), um ansprechbare Hosts zu
finden.
.TP
.B -PM
Das Gleiche wie
.B -PI
und
.B -PP
, ausser, dass eine ICMP address mask request (Typ 17, Code 0) zum Tragen kommt.
.TP
.B -PB
Dies ist der standardmaessig gewaehlte Ping-Typus. Er benutzt beide Techniken,
ACK (
.B -PT
) und ICMP echo requests (
.B -PI
), die jeweils parallel durchgefuehrt werden. Auf diese Weise koennen
Firewall-Elemente ausgetrickst werden, die eine der beiden Protokolle (nicht
beide) filtern. Der Zielport fuer den TCP-Zugriff kann auf die gleiche Weise
gesetzt werden, wie im zuvor erklaerten -PT.
.TP
.B -O
Diese Option aktiviert das Identifizieren des am Zielsystem eingesetzten
Betriebssystems anhand des TCP/IP-Fingerabdrucks (engl. TCP/IP fingerprint).
Es wird eine Anzahl spezifischer Tests umgesetzt, die das typische Verhalten
der jeweiligen TCP/IP-Implementierungen erkennen koennen sollen. Die
gegebenen Informationen stellen quasi einen 'Fingerabdruck' dar, der mit der
Datenbank der bekannten Betriebssystem-Fingerabdrucke (die
nmap-os-fingerprints Datei) verglichen wird.
.Sp
Falls nmap nicht in der Lage ist, eine mehr oder weniger eindeutige
Identifikation des am Zielsystem eingesetzten Betriebssystems vorzunehmen und
die gegebenen Bedingungen gut sind (mindestens ein ansprechbarer Port), gibt
nmap eine URL aus, bei der neu gefundene Fingerprints eingesendet werden
koennen. Dies setzt natuerlich voraus, dass Sie sich eindeutig im Klaren
darueber sind, um was fuer ein Betriebssystem es sich handelt. Durch diesen
Schritt koennen Sie aktiv an der Erweiterung der Datenbank mithelfen, wodurch
sie attraktiver fuer saemtliche Benutzer wird. Falls Sie beim Einsenden des
neuen Fingerabdrucks die IP-Adresse des Zielsystems mitangeben, muessen Sie
damit rechnen, dass es von uns zu Ueberpruefungszwecken gescannt wird.
.Sp
Die Option -O aktiviert ebenso einige weitere Tests. Einer dieser ist das
Messen der "Uptime". Hierzu wird das Timestamp-Feature von TCP genutzt (RFC
1323), um erkennen zu koennen, wann das Zielsystem das letzte mal neu
gestartet wurde. Diese Funktionalitaet wird natuerlich nur dann genutzt werden
koennen, wenn das Zielsystem diese Information auch entsprechend bereitstellt.
.Sp
Ein anderer Check, der durch die Option -O aktiviert wird, ist die
Klassifizierung der Berechenbarkeit der TCP-Sequenznummer des Zielsystems.
Das Ergebnis dieses Tests sagt aus, wie schwer es ist, eine bestehende
Verbindung des Zielsystems zu uebernehmen. Dies ist dann nuetzlich, wenn
auf IP-Adressen basierende Vertrauensbeziehungen (z.B. rlogin und
Firewall-Filter) missbraucht oder die Quelle eines Angriffs versteckt werden
sollen. Die mitgelieferte Difficulty-Number ist statistisch berechnet und kann
jeweils leicht abweichen. Zusaetzlich wird in knappen Worten (z.B. "worthy
challenge" or "trivial joke") der Zustand beschrieben. All dies wird nur dann
ausgegeben, wenn der Parameter -v mitangegeben wurde.
.Sp
Wenn die Option -O zusammen mit dem Verbose-Modus (-v) genutzt wird, wird
ebenso die Sequenz-Generierung der IPID ausgewiesen. Die meisten Geraete
werden als "incremental" klassifiziert, was bedeutet, dass sie fuer jedes
verschickte Paket eine Inkrementierung des ID-Felds im IP-Header vornehmen.
Ein solches Verhalten macht sie verwundbar gegen eine Reihe verschiedener
Auswertungs- und Spoofing-Attacken.
.TP
.B -6
Diese Option aktiviert die IPv6-Unterstuetzung. Saemtliche Ziele muessen mit
IPv6 zurecht kommen, sofern diese Option genutzt werden soll. Das
Spezifizieren der Ziele kann ganz normal ueber den DNS-Namen (AAAA record)
oder IPv6-Adresse (z.B. 3ffe:501:4819:2000:210:f3ff:fe03:4d0) geschehen.
Momentan sind TCP connect()- und Ping-Scans von nmap unterstuetzt. Falls UDP-
oder andere Scan-Typen genutzt werden sollen, lohnt sich ein Blick auf
http://nmap6.sourceforge.net/ .
.TP
.B -I
Hiermit wird das TCP reverse ident-Scanning aktiviert. Wie Dave Goldsmith in
einem Bugtraq-Posting aus dem Jahre 1996 publiziert hat, ermoeglicht das
ident-Protokoll (RFC 1413) das Identifizieren des Besitzers eines
TCP-Dienstes. So kann zum Beispiel eine Verbindung zum HTTP-Port des
Zielsystems hergestellt werden, um danach mittels ident herauszufinden, ob
der Webserver als root laeuft. Dies kann nur mit der Hilfe eines full-connect
TCP-Portscans (-sT) geschehen. Wenn
.B -I
aktiviert wird, wird der identd des Zielsystems fuer jeden als offen
identifizierten Port abgefragt. Logischerweise funktioniert diese ganze
Prozedur nicht, wenn das Zielsystem keinen identd aktiv hat.
.TP
.B -f
Diese Option erreicht, dass der durchgefuehrte SYN-, FIN-, Xmas- oder
Null-Scan mit fragmentierten IP-Paketen arbeitet. Die Idee ist, dass der
TCP-Header ueber mehrere Pakete verteilt werden soll, wodurch eine
Inspizierung durch Firewall- oder Intrusion Detection-Systeme erschwert wird.
Bei dieser Funktion ist Vorsicht geboten, denn viele der verbreiteten
Netzwerkanwendungen kommen mit derlei Datenverkehr nicht klar. Beispielsweise
erhielt ich bei meinem liebsten Sniffer ein segemtation fault, nachdem das
erste 36-byte Fragment eingelesen wurde. Danach kam gar ein 24-byte Paket!
Waehrend diese Methode keinen Erfolg bei Elementen verspricht, die eine
Warteschlange fuer IP-Fragmente haben (wie dies mittels der Option
CONFIG_IP_ALWAYS_DEFRAG unter Linux normalerweise der Fall ist), koennen
andere Umgebungen den enormen Aufwand fuer eine solche Analyse nicht tragen,
verzichten darauf und koennen deshalb ausgetrickst werden.
.Sp
Es bleibt zu bemerken, dass diese Option nicht auf allen Betriebssystemen
einwandfrei genutzt werden kann. Es arbeitet ohne Zwischenfaelle auf meinem
Linux, FreeBSD und OpenBSD; einige Leute berichten gar, dass es auch auf
anderen *NIX funktioniert.
.TP
.B -v
Verbose-Modus: Diese, eine sehr zu empfehlende Option, ermoeglicht eine
erweiterte Ausgabe von Informationen. Eine doppelte Nutzung ergibt einen
doppelt so grossen Effekt. Ebenso kann
.B -d
einige Male aktiviert werden, falls Sie wirklich vor einem ueberlasteten
Bildschirm verrueckt werden wollen!
.TP
.B -h
Diese handliche Funktion zeigt eine Kurzreferenz der nmap-Parameter. Wie Sie
vielleicht gemerkt haben, handelt es sich bei dieser man-Page nicht unbedingt
um eine 'handliche Kurzreferenz' :)
.TP
.B -oN <Protokoll-Dateiname>
Dies protokolliert die Resultate des Scans in einem normalen, fuer
.B Menschen lesbaren
Format in eine durch ein Argument spezifizierte Datei.
.TP
.B -oX <Protokoll-Dateiname>
Dies protokolliert die Resultate des Scans als
.B XML
in die durch ein Argument spezifizierte Datei. Dadurch koennen andere
Programme unkompliziert die durch nmap generierten Informationen auswerten und
verarbeiten. Durch das Argument '-' (ohne Anfuehrungszeichen) kann die
Ausgabe auf stdout (fuer Pipeline-Verarbeitung, etc.) umgeleitet werden. In
diesem Fall wird die normale Bildschirmausgabe unterdrueckt. Achtung vor
Fehlermeldungen (diese werden nach wie vor nach stderr geschickt). Ebenso ist
wichtig, dass '-v' in den meisten Faellen einige zusaetzliche Informationen
gewaehrleisten koennen wird. Die Dokumententypendefinition (engl. Document
Type Definition, abk. DTD), die fuer die XML-Ausgabe genutzt wird, steht unter
http://www.insecure.org/nmap/data/nmap.dtd bereit.
.TP
.B -oG <Protokoll-Dateiname>
Dies protokolliert die Resultate des Scans in eine
.B grepbare
Form in eine durch ein Argument spezifizierte Datei. Dadurch wird ein simples
Format angestrebt, welches alle Informationen auf einer Zeile ausgibt, weshalb
ganz einfach ein grep fuer Ports, OS-Informationen oder IP-Adressen umgesetzt
werden kann. Dieses einfache Format stellt meistens nicht so viele
Informationen bereit, wie dies bei anderen Ausgabevarianten der Fall ist.
Diese Form war die urspruenglich, fuer die Verarbeitung durch externe Programme
vorgehesene Dokumentierungs-Ausgabe. Mittlerweile ist jedoch XML empfohlen
(-oX). Einmal mehr kann die Angabe von '-' (ohne Anfuehrungszeichen) eine
Ausgabe auf stdout erzwingen (fuer Pipeline-Verarbeitung, etc.). Auch hier
wird die normale Ausgabe unterdrueckt. Ebenso werden Fehlermeldungen wie
ueblich auf stderr ausgegeben. Und '-v' wird in den meisten Faellen einige
zusaetzliche Informationen gewaehrleisten koennen.
.TP
.B -oA <Basisdateiname>
Dies veranlasst nmap in der Form ALLER wichtigen Formate (normal, grepbar und
XML) zu protokollieren. Sie geben den Dateinamen an, wobei nmap die
Erweiterungen in Form von basis.nmap, basis.gnmap und basis.xml automatisch
anfuegen wird.
.TP
.B -oS <Protokoll-Dateiname>
Dies protokolliert die Resultate der Scans in einem fuer
.B s|<ripT kiDd|3
lesbaren Format in eine durch ein Argument spezifizierte Datei. Durch die
Angabe des Arguments '-' (ohne Anfuehrungszeichen) kann die Ausgabe auf
stdout umgeleitet werden.
.TP
.B --resume <Protokoll-Dateiname>
Ein Netzwerk-Scan, der durch das Druecken von Control-C unterbrochen wurde,
kann durch diese Option reaktiviert werden. Der Protokoll-Dateiname muss
entweder eine normale (-oN) oder durch Maschinen verarbeitbare (-oM)
Scan-Protokoll-Datei sein. Die Angabe abweichender oder zusaetzlicher Optionen
ist nicht moeglich - Sie werden vom abgebrochenen Scan uebernommen. nmap wird
mit der zuletzt in der Protokoll-Datei erfolgreich gescannt vermerkten
Maschine starten.
.TP
.B --append_output
Weist nmap an, die Scan-Resultate an die spezifizierten Protokoll-Datei
anzuhaengen, anstatt die besagten Dateien zu ueberschreiben.
.TP
.B -iL <Eingabe-Dateiname>
Liest die Ziel-Spezifizierung ZUERST von der angegebenen Datei ein, und erst
danach von der Kommandozeileneingabe. Die Datei sollte eine Liste von Hosts
oder Netzwerken enthalten, die jeweils durch ein Leer-, Tabulator- oder
Neuezeile-Zeichen getrennt sind. Benutzen Sie einen Bindestrich (-) als
.I Eingabe-Dateiname
, falls Sie wollen, dass nmap die Zielspezifizierungen von stdin liest (wie
im Zusammenhang mit einer Pipe). Siehe den Absatz
.I Ziel-Definition
fuer zusaetzliche Informationen zu der gueltigen Ausdrucksweise.
.TP
.B -iR
Diese Option weist nmap an, zufaellig generierte Hosts zu scannen :). Dies hat
kein Ende. Eine solche Funktion ist zum Beispiel fuer eine statistische
Auswertung innerhalb des Internets nuetzlich. Falls Sie einmal wirklich sehr
gelangweilt sein sollten, so versuchen Sie
.I nmap -sS -iR -p 80
um Webserver-Systeme zu finden.
.TP
.B -p <Port-Bereich>
Diese Option spezifiziert, welche Ports gescannt werden sollen. Zum Beispiel
wird '-p 23' lediglich einen Zugriff auf den Port 23 (Telnet) der Zielsysteme
durchfuehren. '-p 20-30,139,60000-' scannt die Ports zwischen 20 und 30,
Port 139 und alle Ports groesser als 60000. Standardmaessig werden saemtliche
well-known Ports zwischen 1 und 1024 sowie alle in der services-Datei von nmap
gelisteten Dienste gescannt. Fuer einen IP-Protokoll-Scan (-sO) kann mit
dieser Option die zu scannende Protokoll-Nummer (0-255) angegeben werden.
.Sp
Werden gleichzeitig TCP- und UDP-Ports gescannt, so kann das jeweilige
Protokoll durch ein vorangestelltes "T:" oder "U:" angewaehlt werden. Die
mitgegebenen Ports gelten so lange fuer das spezifizierte
Uebertragungsprotokoll, bis ein anderes angegeben wird. Zum Beispiel werden
mit dem Argument "-p U:53,111,137,T:21-25,80,139,8080" die UDP-Ports 53, 111
und 137 sowie die TCP-Ports 21 bis 25, 80, 139 und 8080 gescannt. Wichtig ist,
dass bei einem gleichzeitigen TCP- und UDP-Scan neben der Angabe von -sU
mindestens eine TCP-Scan-Variante mitangegeben werden muss (zum Beispiel -sS,
-sF oder -sT). Wird bei der Wahl der Zielports auf das spezifizieren eines
Protokolls verzichtet, bezieht sich die Option auf saemtliche
Uebertragungsprotokolle.
.TP
.B -F
Schneller Scan-Modus (engl. Fast scan mode): Dies gibt an, dass Sie lediglich
die in der services-Datei von nmap gelisteten Dienste scannen wollen (oder bei
-sO die Protokolle der protocols-Datei). Selbstverstaendlich ist dies viel
schneller, als saemtliche 65535 Ports eines Hosts zu ueberpruefen.
.TP
.B -D <Decoy1 [,Decoy2][,ME],...>
Veranlasst einen sogenannten Decoy-Scan (dt. Lockvolgel). Bei diesem sieht es
so aus, als wuerde eine Reihe zusaetzlicher Hosts die Zielumgebung scannen.
Ein Intrusion Detection-System wird zwischen 5 und 10 Portscans verschiedener
IP-Adressen protokollieren, wobei ohne weiteres nicht genau festgestellt
werden kann, welches System den Scan wirklich durchfuehrt. Waehrend diese
Methode durch Router Path Traceing, Response-Dropping und andere "aktive"
Mechanismen niedergeschlagen werden kann, ist es doch eine extrem effektive
Technik, um die eigene IP-Adresse zu verstecken.
.Sp
Die jeweiligen Lockvoegel koennen durch ein Komma getrennt werden. Optional
kann durch die Angabe von 'ME' (dt. mich) die eigene Position in der
Zugriffsreihenfolge gewaehlt werden. Falls 'ME' in die sechste oder noch eine
spaetere Position gesetzt wird, sind einige Portscan-Detektoren (z.B. Solar
Designers scanlogd) nicht in der Lage, die richtige IP-Adresse anzuzeigen.
Falls Sie 'ME' nicht mitangeben, wird nmap eine zufaellige Position bestimmen.
.Sp
Achtung, die als Decoys angegebenen Hosts sollten vom Zielsystem erreichbar
sein. Andernfalls ist es durchaus moeglich, dass dieses durch einen SYN-Flood
in die Knie gezwungen wird. Zudem ist es relativ einfach zu erkennen, welches
System den Scan durchfuehrt, wenn nur dieses eine System wirklich im Netzwerk
aktiv ist. Es lohnt sich IP-Adressen anstatt Hostnamen bei der Spezifizierung
der Lockvogel-Systeme anzugeben (so ist keine Namensaufloesung noetig und die
Protokoll-Eintraege in den Nameservern bleibt aus).
.Sp
Ebenso weisen einige (dumme) "Portscan-Detektoren" Firewalling-Funktionalitaet
auf, und sie unterbinden die Verbindungsmoeglichkeit jeglichen Systems, das
einen Portscan durchfuehrt. So kann es durchaus sein, dass die
Verbindungsmoeglichkeit des Zielsystems zu den Lockvoegeln verhindert wird.
Dies ist dann problematisch, wenn es sich um ein wichtiges System, wie zum
Beispiel das Standard-Gateway, handelt. Also, es gilt vorsichtig im Umgang
mit dieser Option zu sein. Die Moral dieser Geschichte ist, dass
Portscan-Detektoren mit automatisierter Strike-Back Funktionalitaet keine gute
Idee sind - Hinter jedem Portscan koennte sich ein Lockvogel verbergen!
.Sp
Die Lockvoegel werden im initialen Ping-Scan (ICMP, SYN oder ACK) und waehrend
der eigentlichen Portscan-Phase verwendet. Ebenso finden sie beim Durchfuehren
einer Betriebssystem-Erkennung (
.B -O
) Verwendung.
.Sp
Es bleibt zu sagen, dass zu viele Lockvoegel einen Scan verlangsamen und
ineffizienter machen koennen. Ebenso filtern einige ISPs gespoofte Pakete
heraus, obwohl dies zur Zeit die wenigsten machen.
.TP
.B -S <IP-Adresse>
Unter bestimmten Umstaenden ist
.I nmap
nicht in der Lage, Ihre Quell-IP-Adresse zu identifizieren (
.I nmap
wird Ihnen dies mitteilen). In einer solchen Situation kann mit der Hilfe der
Option -S die IP-Adresse (der gewuenschten Schnittstelle) festgelegt werden.
.Sp
Eine andere Moeglichkeit dieser Option ist die Quelle des Scans zu spoofen, so
dass das Zielsystem glaubt, dass
.B jemand anderes
die Zugriffe durchfuehrt. Stellen Sie sich vor, dass eine Firma ploetzlich von
ihrem Konkurrenten einen Scan verzeichnet! Dies ist nicht der Hauptnutzen
dieser Option. Ich denke lediglich, dass diese Theorie einen guten Grund
bereitstellt, nicht sofort jeden als Scanner zu beschimpfen, nur weil es
scheint, dass von ihm ein Scan gestartet wurde.
.TP
.B -e <Schnittstelle>
Weist nmap an, ueber welche Schnittstelle die Daten verschickt und empfangen
werden sollen. nmap sollte in der Lage sein diesen Umstand von sich aus zu
erkennen. Falls dem nicht so ist, kann diese Option herangezogen werden.
.TP
.B -g <Portnummer>
Definiert den Quellport fuer die Scans. Einige naive
Firewall-Implementierungen machen bei DNS (53) und FTP-DATA (20) eine Ausnahme
und lassen solcherlei Verbindung entgegen der Bestimmungen im Regelwerk zu.
Obschon dieser Umstand ganz einfach durch Angreifer ausgenutzt werden kann, um
sich als FTP- oder DNS-System maskierend einen Vorteil zu verschaffen. Fuer
einen UDP-Scan sollte 53 als erstes ausprobiert werden. Bei einem TCP-Scan
bieten sich 20 und 53 an. Achtung, es handelt sich bei dieser Option lediglich
um eine Anfrage, die nicht zwingend in jeder Situation von nmap umgesetzt
werden will und kann. Zum Beispiel ist eine ISN-Analyse nicht von System:Port
zu System:Port moeglich, so dass nmap eine dynamische Portzuweisung
durchfuehrt, auch wenn anderes durch -g angegeben wurde.
.Sp
Seien Sie gewarnt, dass diese Option bei einigen Scan-Varianten
Performance-Einbussen mit sich bringt.
.TP
.B --data_length <Anzahl>
Normalerweise verschickt nmap moeglichst kleine Pakete, die lediglich aus dem
Header bestehen. So weisen TCP-Datagramme im Normalfall eine Laenge von 40 und
ICMP echo request-Anfragen 28 Bytes auf. Diese Option weist nmap an, die
verschickten Pakete um Null-Bytes zu verlaengern. Pakete zur Erkennung des
Betriebssystens (-O) sind nicht betroffen. Ganz im Gegensatz zu
Ping-Zugriffen und Portscan-Paketen. Dies verlangsamt natuerlich die Zugriffe
unter Umstaenden - Aber ebenso kann es die Unauffaelligkeit des Scans
erhoehen.
.TP
.B -n
Sagt nmap, dass
.B NIE
reverse DNS-Aufloesungen von als aktiv identifizierten IP-Adressen
durchgefuehrt werden sollen. Da DNS oft langsam ist, kann diese Option die
Zugriffe beschleunigen.
.TP
.B -R
Sagt nmap, dass
.B IMMER
reverse DNS-Aufloesungen von als Ziel spezifizierten IP-Adressen durchgefuehrt
werden sollen. Dies wird im Normalfall nur immer dann durchgefuehrt, wenn ein
Zielsystem als aktiv identifiziert werden konnte.
.TP
.B -r
Sagt nmap, dass
.B KEINE
zufaellige Wahl beim Scannen der Ports gewuenscht ist.
.TP
.B --ttl <time to live>
Setzt den "Time to live" Wert im IPv4 Header.
.TP
.B --randomize_hosts (dt. zufaellige Reihenfolge der Hosts)
Sagt nmap, dass bei einer Gruppe von bis zu 2048 Zielen eine zufaellige
Reihenfolge gewaehlt werden soll, bevor sie gescannt werden. Dies kann den
Scanvorgang fuer viele Netzwerk-Monitoring-Systeme schwieriger zu entdecken
machen; ganz besonders dann, wenn langsame Timing-Optionen angewandt werden
(siehe unten).
.TP
.B -M <Maximale Sockets>
Setzt die maximale Anzahl der Sockets bei einem parallel durchgefuehrten TCP
connect()-Scan fest. Dies ist zum Beispiel in Situationen nuetzlich, wenn der
Scanvorgang kuenstlich verlangsamt werden soll, damit das Zielsystem nicht
unter der Last der Zugriffe zusammenbricht. Eine andere Herangehensweise ist
durch -sS gegeben, die durch die Geraete oft einfacher zu handhaben ist.
.TP
.B TIMING-OPTIONEN
Normalerweise macht nmap hervorragende Arbeit, um waehrend eines Scans das
Maximum an Performance herauszuholen, ohne Fehlermeldungen zu Hosts oder Ports
zu provozieren. Trotzdem kann es Situationen geben, in denen das Timing von
nmap nicht dem von Ihnen gewuenschten entspricht. Die folgenden Optionen
ermoeglichen eine feine Skalierbarkeit der Kontrolle bezueglich des
Scan-Timings:
.TP
.B -T <Paranoid|Sneaky|Polite|Normal|Aggressive|Insane>
Diese vordefinierten Timing-Richtlinien erlauben Ihnen nmap Ihre Prioritaeten
mitzuteilen. Der
.B Paranoid
-Modus scannt
.B sehr
langsam, in der Hoffnung, nicht von Intrusion Detection-Systemen entdeckt zu
werden. Die Scans werden in Serie geschaltet (kein paralleles Scanning) und im
Normalfall wird bis zu 5 Minuten zwischen dem Versand der Pakete gewartet.
.B Sneaky
(dt. schleichend) ist aehnlich, ausser, dass lediglich 15 Sekunden zwischen
dem Paket-Versand gewartet wird.
.B Polite
(dt. hoeflich) wird dann relevant, wenn die Netzwerkbelastung niedrig gehalten
werden will. Zum Beispiel, um Abstuerze von Systemen zu vermeiden. Die
Zugriffe werden wiederum in Serie geschaltet und zwischen den Zugriffen wird
.B mindestens
0.4 Sekunden gewartet.
.B Normal
spiegelt das normale Verhalten von nmap wieder, was einen Kompromiss zwischen
maximaler Geschwindigkeit bei absoluter Zuverlaessigkeit darstellt.
.B Aggressive
(dt. aggressiv) fuegt eine Wartezeit von 5 Minuten zwischen den einzelnen
Hosts hinzu. Es wird jedoch nie laenger als 1.25 Sekunden auf Antworten
gewartet.
.B Insane
(dt. geisteskrank) ist lediglich in sehr schnellen Netzwerken moeglich. Oder
ueberall dort, wo auf die Zuverlaessigkeit des Resultat nicht sonderlich viel
gegeben wird. Zwischen den einzelnen Systemen wird 75 und zwischen den
Zugriffen 0.3 Sekunden gewartet. Dies lohnt sich zum Beispiel fuer einen
schnellen Netzwerk-Suchlauf :). Die einzelnen Modi koennen ebenso durch eine
Nummer (0-5) referenziert werden. Zum Beispiel gibt '-T 0' den
Paranoid-Modus an und '-T 5' steht fuer Insane.
.Sp
Diese spezifischen Timing-Modi sollten NICHT zusammen mit den nun folgend
vorgestellten Timing-Optionen verwendet werden.
.TP
.B --host_timeout <Millisekunden>
Spezifiziert den Zeitraum, der nmap gegeben wird, um ein einzelnes System zu
scannen, bevor sich einer neuen IP-Adresse gewidmet wird. Der Standardwert hat
kein Timeout fuer Hosts.
.TP
.B --max_rtt_timeout <Millisekunden>
Spezifiziert den Zeitraum, der nmap gegeben wird, um eine Antwort zu warten,
bevor eine Uebertragunswiederholung eingeleitet wird oder das Timeout in Kraft
tritt. Der Standardwert ist auf 9000 gesetzt.
.TP
.B --min_rtt_timeout <Millisekunden>
Antwortet ein Host sehr schnell auf unsere Anfragen, wird nmap das Zeitlimit
fuer zukuenftige Zugriffe auf das besagte Zielsystem verkleinern. Dies bringt
einen Geschwindigkeitsvorteil mit sich, wobei jedoch auch Pakete verloren
gehen koennen, falls ploetzlich ein Antworten in der vorhergesehenen
Zeitspanne nicht mehr moeglich sein sollte. Mit dieser Option kann nmap
angewiesen werden, dass immer mindestens ein bestimmter Zeitwert gewartet
werden soll, bevor der Vorgang abgebrochen wird.
.TP
.B --initial_rtt_timeout <Millisekunden>
Spezifiziert das Timetout fuer den initialen Zugriff. Dies ist normalerweise
nur dann sinnvoll, wenn durch Firewall-Systeme geschuetzte Hosts mit der
Option -P0 gescannt werden sollen. Normalerweise ist nmap in der Lage den
RTT-Wert anhand des Ping-Zugriffs und der ersten Auswertungen optimal
festzulegen. Der Standardwert lautet 6000.
.TP
.B --max_parallelism <Anzahl>
Spezifiziert die maximale Anzahl parallel von nmap durchfuehrbaren Zugriffe.
Das Setzen dieser Option heisst fuer nmap, dass nie mehr als 1 Port auf einmal
gescannt werden soll. Ebenso sind andere Scan-Typen betroffen, die
normalerweise parallel durchgefuehrt werden koennen (z.B. Ping-Suchlauf,
RPC-Scan, etc.).
.TP
.B --min_parallelism <Anzahl>
Weist nmap an, beim Scan eine gewisse Anzahl von Ports parallel zu scannen.
Dies kann unter Umstaenden den Auswertungs-Vorgang von Firewall-Systemen
beschleunigen. Aber seien Sie vorsichtig: Die Resultate werden umso
unzuverlaessiger, desto hoeher die Anzahl paralleler Zugriffe gesetzt wird.
.TP
.B --scan_delay <Millisekunden>
Spezifiziert das
.B Minimum
der Zeit, die nmap zwischen den jeweiligen Zugriffen warten muss. Dies ist
sehr nuetzlich, um das Datenaufkommen in Netzwerken zu reduzieren oder durch
den langsameren Scanvorgang vor IDS-Tresholds verborgen zu bleiben.
.TP
.B --packet_trace
Sagt nmap, dass saemtliche verschickten und empfangenen Pakete in einem
tcpdump-aehnlichen Format dargestellt werden sollen. Dies ist ganz besonders
fuer Debugging nuetzlich. Ausserdem kann so viel ueber die Funktionsweise
gelernt werden.
.SH ZIEL-SPEZIFIKATION
Alles, das nmap nicht als Option mitgegeben wird (oder ein Argument einer
Option darstellt) wird als Ziel-Spezifikation angesehen. Die einfachste Form
dessen, ist das Auflisten von einzelnen Hostnamen oder IP-Adressen in der
Kommandozeile. Falls Sie ein Subnetz scannen wollen, so koennen Sie
.B '/Maske'
am Hostnamen oder der IP-Adresse anfuegen. Die
.B Maske
muss einen Wert zwischen 0 (das ganze Internet scannen) und 32 (den einzelnen
Host scannen) aufweisen. Benutzen Sie /24 fuer das Scannen eines Klasse
C-Netzwerks und /16 fuer ein Klasse B-Netzwerk.
.Sp
nmap greift zudem auf eine sehr maechtige Notation zurueck, die eine sehr
komfortable Spezifikation von IP-Adressbereichen zulaesst. So kann das Klasse
B-Netzwerk 192.168.*.* mit der Angabe von '192.168.*.*'
oder '192.168.0-255.0-255' oder '192.168.1-50,51-255.1,2,3,4,5-255' gescannt
werden. Und selbstverstaendlich ist auch die verbreitete Netzmasken-Notation
zulaessig: '192.168.0.0/16'. All diese Eingaben fuehren zum gleichen Ziel.
Falls Sie das Asteriks-Zeichen (dt. Stern, '*') benutzen wollen, denken Sie
daran, dass einige Shells das Escapen mittels Backslashes oder das
Auskommentieren mittels Gaensefuesschen verlangen.
.Sp
Eine andere Moeglichkeit ist genau durch das umgekehrte Herangehen gegeben.
Anstatt ein ganzes Klasse B-Netzwerk zu scannen, kann mit der Angabe
von '*.*.5.6-7' jede IP-Adresse gescannt werden, die auf .5.6 oder .5.7 endet.
Fuer zusaetzliche Informationen, konsultieren Sie den Abschnitt
.I Beispiele
.SH BEISPIELE
Hier folgen nun einige Beispiele fuer das Nutzen von nmap. Diese reichen von
einfachen ueber normale bis hin zu komplexen Ansaetzen. Es werden existente
IP-Adressen und Domainnamen verwendet, um die Beispiele konkreter zu
gestalten. Anstatt ihrer Stelle sollten Sie Adressen und Namen
.B Ihres eigenen Netzwerks
benutzen. Ich bin der Meinung, dass Portscanning fremder Netzwerke nicht
illegal ist; ebenso sollten Portscans nicht als Angriffe gewertet werden. Ich
habe tausende Maschinen gescannt und bisher erst eine Rueckmeldung erfahren.
Jedoch bin ich kein Anwalt und einige (langweilige) Leute koennten durch
mittels
.I nmap
generierter Zugriffe nervoes werden. Holen Sie sich zuerst eine Erlaubnis fuer
Ihre Aktivitaeten ein oder tragen Sie die Risiken selbst.
.Sp
.B nmap -v ziel.beispiel.com
.Sp
Diese Option scannt alle reservierten TCP-Ports am Zielsystem mit dem Namen
ziel.beispiel.com. Das -v aktiviert den Verbose-Modus.
.Sp
.B nmap -sS -O ziel.beispiel.com/24
.Sp
Hier wird ein stealth SYN-Scan gegen jede der 255 Maschinen des Klasse
C-Netzwerks von ziel.beispiel.com gestartet. Ebenso wird versucht das
Betriebssystem der aktiven Systeme zu ermitteln. Dieser Vorgang erfordert
root-Privilegien aufgrund des SYN-Scans und der Betriebssystemerkennung.
.Sp
.B nmap -sX -p 22,53,110,143,4564 "198.116.*.1-127"
.Sp
Startet einen Xmas-Tree-Scan auf die erste Haelfte der 255 moeglichen 8
Bit Subnetze des Klasse B-Adressraums von 198.116. Wir ueberpruefen, ob am
Zielsystem SSHD, DNS, POP3D, IMAPD oder der Port 4564 aktiv ist. Wichtig ist,
dass Xmas-Scans nicht gegen Microsoft-Geraete funktionieren, da einige
Abweichungen bei der Implementierung des TCP-Stacks gemacht wurden. Das gleiche
gilt fuer Cisco-, IRIX-, HP/UX- und BSDI-Maschinen.
.Sp
.B nmap -v --randomize_hosts -p 80 '*.*.2.3-5'
.Sp
Manchmal ist es nicht erforderlich einen IP-Adressbereich zu scannen. So kann
es durchaus sein, dass in einer Situation das Absuchen spezieller Geraete
noetig wird. Dieses Kommando findet saemtliche Webserver, die eine IP-Adresse
aufweisen, die auf .2.3, .2.4 oder .2.5 endet. Falls Sie root sind, so kommt
eventuell ein Hinzufuegen von -sS in Frage. Ebenso koennten mehr interessante
Systeme gefunden werden, wenn bei 127 gestartet wird (IMHO). In diesem Fall
koennen die durch die Sterne gegebenen Platzhalter durch '127-222' ersetzt
werden.
.Sp
.B host -l firma.com | cut '-d ' -f 4 | ./nmap -v -iL -
.Sp
Fuehrt einen DNS-Zonetransfer durch, um saemtliche Hosts von firma.com zu
finden. Die Ausgabe der IP-Adressen wird sodann fuer die weitere Verarbeitung
zu
.I nmap
umgeleitet. Die dokumentierte Kommandofolge funktioniert nur auf Geraeten mit
GNU/Linux. Vielleicht muessen Sie auf anderen Betriebssystemen andere Kommandos
und Optionen heranziehen.
.SH FEHLER
Fehler? Was fuer Fehler? Senden Sie sie mir, falls sie solche finden.
Entsprechende Patches waeren auch gleich nett :) Denken Sie ausserdem daran,
neue OS-Fingerabdruecke einzusenden, damit die Datenbank wachsen kann. nmap
gibt eine URL zur Uebermittlung des unbekannten Fingerabdrucks aus.
.SH AUTOR
.Sp
Fyodor
.I <fyodor@insecure.org>
.SH UEBERSETZUNG
.Sp
Marc Ruef
.I <marc.ruef@computec.ch>
.Sp
http://www.computec.ch
.Sp
Wettingen, Oktober 2002
.SH DISTRIBUTION
Die neueste Version von
.I nmap
kann jeweils von
.I http://www.insecure.org/nmap/
bezogen werden.
.Sp
.I nmap
is (C) 1995-2002 by Insecure.Com LLC
.Sp
Dieses Programm gilt als freie Software; Sie koennen sie unter den
Lizenzbestimmungen der GNU General Public License, wie sie von der Free
Software Foundation in der Version 2 publiziert wurde, weitergeben und/oder
veraendern. Dies weist Ihnen das Recht zu, die Software unter den gegebenen
Bestimmungen zu nutzen, modifizieren und weiterzugeben. Falls Sie diese
Lizenzbestimmungen nicht akzeptieren wollen, ist Insecure.Org unter Umstaenden
in der Lage, eine alternative Lizenzbestimmung auszuhandeln (kontaktieren Sie
fyodor@insecure.org).
.Sp
Der Quelltext dieser Software wird aus diesem Grund zur Verfuegung gestellt,
weil wir glauben, dass die Benutzer ein Recht darauf haben zu wissen, was die
von ihnen eingesetzten Programme machen. Dies ermoeglicht zudem das
Ueberpruefen der Software auf etwaige Sicherheitsschwachstellen (bisher wurden
keine gefunden).
.Sp
Der Quelltext ermoeglicht zudem das Portieren von nmap auf neue Plattformen,
das Beheben von Fehlern und Hinzufuegen neuer Funktionalitaeten. Ich darf Sie
bitten entsprechende Aenderungen an fyodor@insecure.org zu schicken, um eine
etwaige Zusammenarbeit zu besprechen. Durch das Senden von Neuerungen an
Fyodor oder einem der Mitglieder der Entwickler-Meilingliste erlauben Sie die
unlimitierte, nicht-exklusive Weiterverwendung, Modifizierung und
Relizensierung. Dies ist insofern wichtig, da einige andere Free Software
Projekte (zum Beispiel KDE und NASM) sich mit unnoetigen Lizenzproblemen
konfrontiert sahen. nmap wird stets als open-source zur Verfuegung stehen.
Falls Sie sich an andere Lizenzbestimmungen halten moechten, so vermerken Sie
dies doch bitte beim Einsenden Ihres Materials.
.Sp
Dieses Programm wurde in der Hoffnung entwickelt, dass es nuetzlich ist;
jedoch
.B OHNE JEGLICHE GARANTIE.
Siehe die GNU General Public License fuer zusaetzliche Informationen (sie ist
in der Datei namens COPYING, die mit
.I nmap
mitgeliefert wird, enthalten).
.Sp
Es muss zusaetzlich erwaehnt werden, dass nmap in der Lage ist, schlecht
geschriebene Anwendungen, TCP/IP-Stacks und Betriebssysteme abstuerzen zu
lassen.
.B nmap sollte nie auf mission-critical Systeme angewandt werden
, ausser, wenn ein entsprechender Ausfall (engl. downtime) verkraftet werden
kann. Wir bestaetigen hiermit, dass nmap unter Umstaenden Systeme und Netzwerke
negativ beeinflussen kann. Wir tragen keine Verantwortung fuer Probleme, die
beim Nutzen von nmap entstehen koennen.
.Sp
Aufgrund dessen, dass das Risiko eines Absturzes besteht und einige Black Hats
nmap fuer das Auswerten von Angriffszielen missbrauchen, koennen einige
Administratoren allergisch auf das Scannen ihrer Systeme reagieren. Somit ist
es stets empfehlenswert, die Erlaubnis fuer das Scannen eines Netzwerks
einzuholen.
.Sp
nmap sollte aus Sicherheitsgruenden nie mit erweiterten Privilegien (z.B. suid
root) gestartet werden.
.Sp
Dieses Produkt beinhaltet Software-Teile, die von der Apache Software
Foundation (http://www.apache.org/) entwickelt wurden. Die
.I Libpcap
portable Bibliothek wird als Teil von nmap mitgeliefert. Libpcap wurde
urspruenglich durch Van Jacobson, Craig Leres und Steven McCanne,
alle vom Lawrence Berkeley National Laboratory, Universitaet von Kalifornien,
Berkeley, CA, entwickelt. Zur Zeit wird sie von http://www.tcpdump.org
betreut.

View file

@ -1,887 +0,0 @@
.\" This definition swiped from the gcc(1) man page
.\" Traslated in Italian by deneb <deneb@penguin.it>
.\" Wen Aug 30 2000
.de Sp
.if n .sp
.if t .sp 0.4
..
.TH NMAP 1
.SH NOME
nmap \- Utility di esplorazione per le rete e security scanner
.SH SINTASSI
.B nmap
[Tipi Scan] [Opzioni] <host o rete #1 ... [#N]>
.SH DESCRIZIONI
.I Nmap
è progettato per permettere agli ammistratori di sistema e
alle persone curiose lo scan di grandi reti al fine di
determinare quali host sono attivi e quali servizi offrono.
.I nmap
supporta un grande numero di tecniche per lo scanning come
ad esempio: UDP, TCP connect(), TCP SYN (semi aperto),
ftp proxy (bounce attack), Reverse-ident, ICMP (ping sweep),
FIN, ACK sweep, Xmas Tree, SYN sweep, e scan Null.
Vedete la sezione
.I Tipi di scan
per ulteriori informazioni.
nmap offre anche varie caratteristiche avanzate come per esempio
il rilevamento del S.O. via TCP/IP fingerprinting, lo scan stealth
(invisibile), ritardo dinamico e i calcoli delle ritrasmissioni,
lo scan parallelo, il rilevamento degli host non attivi mediante
i ping paralleli, lo scan mediante decoy, il rilevamento del
filtraggio delle porte, lo scan RPC diretto (non-portmapper),
lo scan di frammentazione, la specifica flessibile della
destinazione e delle porte.
.PP
Sforzi significativi sono stati impiegati nel rendere decenti
le performance per gli utenti non root. Sfortunatamente,
molte interfacce del kernel critiche (come ad esempio i
socket raw) richiedono i privilegi di root.
nmap dovrebbe essere eseguito da root ogni volta che è
possibile.
.PP
Il risultato di un'esecuzione di nmap è di solito una lista
di porte interessanti sulla/e macchina/e, che sono state
sottoposte allo scan (se ve ne sono). Nmap da sempre
il nome del servizio "ben noto" (se noto), il numero, lo
stato, e il protocollo. Lo stato può essere 'open' (aperto),
'filtered' (filtrato), o 'unfiltered' (non-filtrato).
Open significa che la macchina destinazione accetterà (
mediante accept()) le connessioni su quella porta. Filtered
significa che un firewall, filtro, o un altro ostacolo di
rete sta coprendo la porta e impedendo a nmap di determinare
se la porta è aperta. Unfiltered significa che nmap ha
riconosciuto la porta come chiusa e nessun firewall/filtro
sembra aver interferito con il tentativo di nmap di
rilevare se la porta fosse aperta o chiusa.
Le porte unfiltered (non-filtrate) sono il caso più comune e
sono mostrate solo quando la maggior parte delle porte
esaminate sono nello stato filtered (filtrate).
.PP
A seconda delle opzioni usate, nmap può riportare le seguenti
caratteristiche dell'host remoto: S.O. in uso, sequenziabilità
TCP, nomi gli utenti che hanno eseguito i programmi che sono
associati ad una data porta, il nome del DNS, se l'host è un
indirizzo smurf, e poco altro.
.SH OPZIONI
Le opzioni che assieme hanno senso possono essere generalmente
combinate. Alcune opzioni sono specifiche a date modalità di scan.
.I nmap
prova a rilevare e avvisare l'utente su combinazioni psicotiche o
non supportate.
.Sp
Se siete impazienti, potete passare direttamente alla sezioni di
.I esempi
posta alla fine, che dimostra l'utilizzo comune. Potete anche
eseguire
.B nmap -h
per ottenere una pagina di riferimento rapido, che elenca tutte
le opzioni.
.TP
.B TIPI DI SCAN
.TP
.B \-sT
Scan TCP connect(): Questa è la forma base dello scan TCP. La
chiamata di sistema connect() fornita dal vostro sistema
operativo è usata per aprire una connessione ad ogni porta
interessante sulla macchina. Se la porta è in ascolto, la
connect() avrà luogo, altrimenti la porta non è raggiungibile.
Ogni utente sulla maggior parte dei sistemi UNIX è libero
di usare questa chiamata.
.Sp
Questo genere di scan è facilmente rilevabile in quanto
i log dell'host destinazione mostreranno un gruppo di connessioni
e messaggi di errore per i servizi che accettano la connessione
mediante accept() solo per chiuderla immediatamente dopo.
.TP
.B \-sS
Scan TCP SYN: Questa tecnica è spesso chiamata scan "semi-aperto",
perchè non aprite una completa connessione TCP. Mandate un pacchetto
SYN, come se aveste intenzione di aprire una vera connessione,
e aspettate la risposta. Un SYN|ACK come risposta indica che
la porta è in ascolto. Un RST è indicativa di una porta
non in ascolto. Se viene ricevuto un SYN|ACK come risposta
, viene mandato immediatamente un RST per chiudere la connessione
( allo stato attuale il kernel del vostro S.O. lo fa per noi).
Il vantaggio primario di questa tecnica di scanning è che pochi
siti la loggeranno.
Sfortunatamente avete bisogno dei privilegi di root per
poter creare questi appositi pacchetti SYN.
.TP
.B \-sF \-sX \-sN
Le modalità di scan Stealth FIN, Xmas Tree, o Null:
Ci sono delle volte che anche lo scan SYN non è
abbastanza anonimo. Alcuni firewall e packet filter
controllano i SYN per le porte riservate, e programmi come
Synlogger e Courtney sono disponibili per rilevare
questi scan. Questi scan avanzati, d'altra parte, possono
essere in grado di passare attraverso i firewall, packet
filter e/o programmi loggers indisturbati.
.Sp
L'idea è che le porte chiuse devono rispondere al vostro
pacchetto di prova con un RST, mentre le porte aperte devono
ignorare il pacchetto in questione (vedere RFC 793 pagina 64).
Lo scan FIN usa (sorpresa) un semplice pacchetto FIN come prova,
mentre lo scan Xmas attiva i flag FIN, URG, e PUSH.
Lo scan Null disattiva tutti i flag. Sfortunatamente Microsoft
(come sua consuetudine) ha deciso di ignorare completamente lo
standard e fare le cose a modo suo. Così questo tipo di scan
non funziona contro i sistemi in cui gira Windows95/NT. Se
prendiamo la cosa dal punto di vista positivo, questo fatto
è un buon modo per distinguere tra le due piattaforme.
Se lo scan trova porte aperte, sapete che la macchina non è
un computer con Windows. Se uno scan -sF,-sX, o -sN mostra
tutte le porte chiuse, ma uno scan SYN (-sS) vi fa vedere
porte aperte, probabilmente state guardando una macchina
Windows. Questo ora è meno utile in quanto nmap ha un
proprio un rilevamento di S.O. integrato. Ci sono anche
alcuni altri sistemi che violano lo standard nella stessa
maniera di Windows. Questi includono Cisco, BSDI, HP/UX, MVS,
e IRIX.
Tutti i sistemi operativi soprastanti mandano resets da
porte aperte quando invece dovrebbero solo ignorare il
pacchetto.
.TP
.B \-sP
Ping scanning:
Alcune volte volete solo sapere quali host sulla rete sono
attivi. Nmap può scoprire questo mandando pacchetti
ICMP echo request ad ogni indirizzo IP sulla rete che voi
specificate. Gli host che rispondono sono attivi. Sfortunatamente,
alcuni siti come ad esempio microsoft.com bloccano i pacchetti
echo-request. Così nmap può mandare anche un pacchetto ack TCP (per
default) alla porta 80. Se ottenenete indietro un RST, la macchina
è attiva. Una terza tecnica comporta il mandare un pacchetto
SYN e aspettare un RST o un SYN/ACK. Per gli uttenti non-root,
viene usato il metodo connect().
.Sp
Di default (per gli utenti root), nmap usa le tecniche sia ICMP
che ACK in parallelo. Potete cambiare questo comportamento con
l'opzione
.B \-P
descritta successivamente.
.Sp
Notate che il pinging comunque viene fatto di default, e solo gli
host che rispondono vengono sottoposti a scan. Usate questa opzione
solo se desiderate fare un ping sweep
.B senza
fare dei reali portscan.
.TP
.B \-sU
Scan UDP: Questo metodo viene usato per determinare quali porte UDP
(User Datagram Protocol, RFC 768) sono aprte su un host. La tecnica
è mandare paccheti udp di 0 byte ad ogni porta sulla macchina
destinazione. Se riceviamo un messaggio ICMP port unreachable, allora
la porta è chiusa. Altrimenti presumiamo che essa sia aperta.
.Sp
Alcune persone pensano che lo scan UDP sia inutile. Di solito ricordo
loro il bug recente di rcpbind in Solaris. Rpcbind può essere trovato
nascosto su una porta UDP non documentata a patto che essa sia maggiore
di 32770. Cosi' non ha importanza se la 111 è bloccata dal firewall.
Ma, potete trovare quali porte alte maggiori della 30.000 siano in ascolto?
Con uno scanner UDP potete!
Esiste anche il programma backdoor Back Orifice del cDc, che
si nasconde su una porta UDP configurabile sulle macchine Windows.
Per non parlare i vari servizi comunemente vulnerabili che utilizzano
UDP come ad esempio snmp, tftp, NFS, ecc.
.Sp
Sfortunatamente lo scan UDP è alcune volte spaventosamente lento
in quanto molti host implementano la proposta di limitare il tasso
dei messaggi di errore ICMP fornita dalla RFC 1812 (sezione 4.3.2.8).
Per esempio, il kernel di Linux (in net/ipv4/icmp.h) limita la generazione
dei messaggi di destination unreachable ad 80 per 4 secondi, con una
penalità di 1/4 di secondo se questo limite viene sorpassato.
Solaris ha limiti più stretti (circa 2 messaggi per secondo)
e cosi si impiega più tempo per lo scan.
.I nmap
rileva questo tasso limitando e rallentando lo scan di conseguenza,
piuttosto che flooddare la rete con pacchetti inutili che saranno
ignorati dalla macchina destinazione.
.Sp
Come è tipico, Microsoft ha ignorato la proposta della RFC e
non sembra aver imposto nessun tasso di limitazione sulle macchine
Win95 e NT. Così possiamo fare lo scan di tutte le 65K porte di una
macchina Windows
.B molto
velocemente.
.TP
.B \-sA
Scan ACK: Questo metodo avanzato viene usato solitamente per scoprire
gli insiemi delle regole dei firewall. In particolare, può aiutare
determinare se un firewall sia stateful o solo un
semplice filtro di pacchetti che blocca i pacchetti SYN in entrata.
.Sp
Questo tipo di scan manda un pacchetto ACK
(con acknowledgement/sequence numbers apparentemente casuali)
alle porte specificate.
Se si ha come ritorno un RST, le porta viene classificata come
"unfiltered" (non-filtrata). Se non si ritorno ( o se si ha come
ritorno un pacchetto ICMP
unreachable), la porta viene classificata come
"filtered" (filtrata). Notate che di solito
.I nmap
non stampa le porte "unfiltered",
così se
.B non
otteniamo nessuna porta mostrata nell'output è di solito un
segno che tutte le prove sono state portate a termine ( e hanno
restituito dei RST). Questo scan ovviamente non mostrerà mai
porte nello stato "open" (aperto).
.TP
.B \-sW
Scan window: Questo scan avanzato è molto simile allo scan ACK,
eccetto che alcune volte può rilevare sia le port aperte che
filtrate/non filtrate a causa di un'anomalia nel TCP window size
reporting di alcuni sistemi operativi. I sistemi vulnerabili a
questo problema includono almeno alcune versioni di AIX, Amiga,
BeOS, BSDI, Cray, Tru64 UNIX, DG/UX, OpenVMS, Digital
UNIX, FreeBSD, HP-UX, OS/2, IRIX, MacOS, NetBSD, OpenBSD,
OpenStep, QNX, Rhapsody, SunOS 4.X, Ultrix, VAX, e
VxWorks. Vedere l'archivio della mailing list
.I nmap-hackers
per un'elenco completo.
.TP
.B \-sR
Scan RPC. Questo metodo funziona in combinazione con i diversi
metodi di port scan di Nmap. Esso prende tutte le porte TCP/UDP
trovate aperte e poi le flodda con comandi NULL del programma
SunRPC nel tentativo di determinare se sono porte RCP, e se
le sono, quale programma e numero di versione esse servono.
In questo modo potete effettivamente ottenere le stesse informazioni
di 'rcpinfo -p' anche se il portmapper di destinazione è dietro
un firewall (o protetto da TCP wrappers). I decoy non funzionano
allo stato attuale con lo scan RPC, in un qualche momento posso
aggiungere il supporto per i decoy negli scan RPC UDP.
.TP
.B \-b <ftp relay host>
FTP bounce attack: Una "caratteristica" interessante del protocollo
ftp (RFC 959) è il supporto per le connessioni ftp "proxy".
In altre parole, io dovrei essere in grado di connettemi da evil.com
al server FTP di target.com e richiedere che tale server mandi un
file OVUNQUE su internet! Ora questo poteva andare bene nel 1985
quando la RFC fu scritta. Ma nell'Internet di oggi non possiamo avere
persone che fanno l'hijacking dei server ftp e che richiedono che i dati
siano spediti a punti arbitrari su Internet. Come *Hobbit* scrisse
nel 1995, questo punto debole nel protocollo "può essere usato per
postare mail e news virtualmente irritracciabili, riempire i dischi,
provare a scavalcare i firewall, e generalmente è fastidioso e difficile
da rintracciare allo stesso tempo."
Noi sfrutteremo questo problema per (sorpesa,sopresa) fare lo scan delle
porte TCP da un server ftp "proxy". Cosi potrete collegarvi a un
server ftp dietro un firewall, e poi dare lo scan di porte che
sono molto probabilmente bloccate (la 139 è una porta buona).
Se il server ftp permette la lettura da e la scrittura a
qualche directory (come ad esempio /incoming), potete mandare
dati arbitrari porte che trovate aperte (anche se
nmap non fa questo per voi).
.Sp
L'argomento passato all'opzione 'b' è l'host che volete
usare come proxy, in una notazione standard URL. Il formato è:
.I username:password@server:porta.
Tutto tranne il
.I server
è opzionale. Per determinare quali server siano vulenrabili a
questo attacco, potete vedere il mio articolo in
.I Phrack
51. E una versione aggiornata è disponibili all'URL di
.I nmap
(http://www.insecure.org/nmap)
.TP
.B OPZIONI GENERALI
Nessuna di queste opzioni è richiesta ma alcune possono essere abbastanza utili
.TP
.B \-P0
Non provare e fare il ping degli host completo prima di fare
lo scan degli stessi. Queso permette lo scan di reti che non
permettono ICMP echo request (o risposte) attraverso il loro
firewall.
microsoft.com è un esempio di tale rete, così dovreste sempre
usare
.B \-P0
o
.B \-PT80
quando fate il portscan di microsoft.com
.TP
.B \-PT
Usate il "ping" TCP per determinare quali host sono attivi.
Invece di mandare pacchetti ICMP echo request e aspettare una
risposta, mandiamo pacchetti TCP ACK attraverso la rete
destinazione (o a una macchina singola) e poi aspettiamo
le risposte per ottenere informazioni sull'host. Gli host
che sono attivi dovrebbero rispondere con un RST. Questa
opzione preserva l'efficenza dell'esaminare solo host che
sono attivi permettendovi anche di fare lo scan di reti/host
che bloccno i pacchetti ping. Per gli utenti non root, usiamo
la funzione connect(). Per impostare la porta di destinazione
dei pacchetti di prova usiamo -PT<numero porta>. La porta di
default è la 80, in quanto questa porta spesso non è filtrata.
.TP
.B \-PS
Questa opzione usa dei pacchetti SYN (richiesta di connessione)
invece dei pacchetti ACK per gli utenti root. Gli host che sono
attivi dovrebbero rispondere con un RST (o, raramente con un SYN|ACK).
.TP
.B \-PI
Questa opzione usa un vero pacchetto ping (ICMP echo request).
Esso trova gli host che sono attivi e cerca anche nella vostra
rete indirizzi broadcast orientati alla sottorete. Questi sono
indirizzi IP che sono esternamente raggiungibili e traduce a
un broadcast di pacchetti in entrata a una sottorete di computer.
Questi dovrebbero essere eliminati se scoperti in quanto permettono
numerosi attacchi denial of service (Smurf è il più comune).
.TP
.B \-PB
Questo è il tipo di ping di default. Esso usa gli sweep ACK (
.B \-PT
) e ICMP (
.B \-PI
) in parallelo. In questo modo potete rilevare i firewall che filtrano
uno dei due (ma non entrambe).
.TP
.B \-O
Questa opzione attiva l'identificazione dell'host remoto via
TCP/IP fingerprinting. In altre parole, usa un'insieme di
tecniche per rilevare le sottigliezze nello strato sottostante
dello stack di rete del sistema operativo del computer sottoposto
a scan. Usa questa informazione per creare una 'impronta'
.I (fingerprint)
che viene confrontata con il suo database di impronte note relative
ai vari S.O. (il file nmap-os-fingerprints) per decidere a quale
tipo di sistema state facendo lo scan.
.Sp
Se trovate una macchina che è mal diagnosticata e ha almeno
una porta aperta, sarebbe utile se voi mi madate via mail i
dettagli (per esempio il S.O pippo versione numero è stato rilevato
come S.O. pluto versione numero1). Se trovate una macchina
con almeno una porta aperta con almeno una porta aperta per
quale nmap dice 'unknown operating system' (sistema operativo
sconosciuto), allora sarebbe utile se mi mandaste l'indirizzo IP
assieme con il nome del S.O. e il numero di versione. Se non
potete mandarmi l'indirizzo IP, la cosa migliore da fare è
di eseguire nmap con l'opzione
.B \-d
e mandarmi le tre fingerprint che dovreste ottenere assieme
al nome del S.O. e il numero di versione. Facendo questo
voi contribuite all'elenco dei sistemi operativi conosciuti ad
nmap e così tale elenco sarà più accurato per tutti.
.TP
.B \-I
Questa opzione abilita lo scanning TCP reverse ident. Come
notato da Dave Goldsmith in un post del 1996 a BugTraq, il
protocollo ident (rfc 1413) permette di scoprire il nome
dell'utente appartenente ad ogni processo connesso via TCP,
anche se il processo non ha iniziato una connessione. Così
potete, per esempio collegarvi alla porta http e poi usare
identd per scoprire se il server è in esecuzione con i
diritti di root. Questo scan può essere fatto solo con una
connessione TCP completa alla porta destinazione (per esempio
con l'opzione -sT). Quando viene usata l'opzione
.B \-I
l'identd dell'host remoto viene interrogato per ogni porta
aperta. Ovviamente questo scan non funziona se nell'host
non è in esecuzione identd.
.TP
.B \-f
Questa opzione provoca gli scan SYN, FIN, XMAS, o NULL
ad usare minuscoli pacchetti IP frammentati. L'idea è di
suddividere l'header TCP in diversi pacchetti per rendere
più difficile ai filtri di pacchetti (packet filters),
ai sistemi di rilevamento delle intrusioni (IDS), e
altre seccature rilevare quello che state facendo.
State attenti con questa opzione! Alcuni programmi hanno
problemi nella gestione di questi pacchetti minuscoli.
Il mio sniffer preferito è andato in segmentation fault
immediatamente dopo aver ricevuto il primo frammento
di 36-byte. Dopo quello ne viene mandato un'altro da
24 byte! Sebbene questo metodo non passerà i filtri di
pacchetto e firewall che mettono in coda tutti i frammenti
IP (come l'opzione CONFIG_IP_ALWAYS_DEFRAG nel kernel Linux),
alcune reti non possono permettersi l'abbattimento
delle prestazioni che questa opzioni causa e così la lasciano
disabilitata.
.Sp
Notate che non ho ancora questa opzione funzionante su tutti
i sistemi. Funziona bene per le mie mcchine Linux, FreeBSD, e
OpenBSD e alcune persone hanno r con altre varianti *NIX.
.TP
.B \-v
Modalità verbose. Questa è un'opzione altamente raccomandata
e da molte più informazioni su quello che sta accadendo.
Potete usarla due volte per ottendere maggiori effetti. Usate
.B \-d
un paio di volte se volete realmente impazzire con lo scrolling dello
schermo!
.TP
.B \-h
Questa comoda opzione mostra una schermata di riferimento
rapido sulle opzioni di utilizzo di nmap. Come potete aver notato,
questa man page non è esattamente un 'riferimento rapido' :)
.TP
.B \-oN <nomefiledilog>
Questa opzione logga i risultati dei vostri scan nella normale forma
.B chiaramente leggibile
nel file che specificate come argomento.
.TP
.B \-oM <nomefiledilog>
Questa opzione logga i risultati dei vostri scan nella forma
.B analizzabile dalla macchina
nel file che specificate come argomento. Potete dare l'argomento
\'-\' (senza apici) per inviare l'output allo stdout
(per fare shell pipe, ecc.). In questo caso l'output normale
sarà sopresso. Controllate i messaggi di errore se usate
quest'ultima possibilità (essi andranno ancora allo stderr).
Notate anche che \'-v\' farà in modo che informazioni extra
vengano stampate.
.TP
.B \-oS <nomefiledilog>
QuEsT0 l0gGa | rIsUlTaT| d3i v0sTr| Scanz iN
UnA f0rMa
.B s|<ipT kiDd|3
n3L fiL3 sPec\|fiCaT0 C0mE arGuMEnT0!
P0t3t3 Dar3 L'Arg0M3nt0 \'-\' (s3Nza Virg0L3Tt3)
p3R mAnDAr3 L'0uTput n3ll0 stDouT!@!!
.TP
.B \--resume <nomefiledilog>
Uno scan di rete che è stato cancellato a causa di un control-C,
problemi di rete, ecc. può essere riprestinto usando questa opzione.
Il nomefiledilog deve essere o un log normale (-oN) o un log
analizzabile dalla macchina (-oM) dello scan interrotto.
Nessun'altra opzione deve essere data (le opzioni saranno le stesse
dello scan interrotto).
Nmap inizierà a fare lo scan sulla macchina posta dopo l'ultima
macchina di cui è stato fatto lo scan nel file di log.
.TP
.B \-iL <nomedelfilediinput>
Legge le specifiche della destinazione da un file specificato
PIUTTOSTO che da linea di comando. Il file dovrebbe contenere
una lista di host o espressioni di rete separate da spazi,
caratteri di tabulazione, o newline. Usate una linea trattegiata
(-) come
.I nomedelfilediinput
se volte che nmap legga le espressioni dell'host dallo stdin
(come alla fine di una pipe). Vedere la sezione
.I specifica della destinazione
per ulteriori informazioni sulle espressioni con le quali
potete riempire il file.
.TP
.B \-iR
Questa opzioni dicono ad Nmap di generare i propri host da
esaminare prendendo semplicemente numeri casuali :). Non
terminerà main. Questa opzione può essere utile per campionamenti
statistici di Internet per stimare diverse cose. Se siete
veramente annoiati, provate
.I nmap \-sS \-iR \-p 80
per trovare dei web server da guardare.
.TP
.B \-p <intervallo di porte>
Questa opzione specifica quali porte volete specificare. Per
esempio con '-p 23' Nmap proverà la porta 23 del/degli host
destinazione.
Con \'\-p 20-30,139,60000-\' Nmap farà lo scan delle porte
tra 20 e 30, la porta 139, e tutte le porte maggiori di 60000.
Di default Nmap fa lo scan sia di tutte le porte tra 1 e 1024
che di ogni porta elencata nel file services fornito con nmap.
.TP
.B \-F Modalità di scan veloce.
Specifica che desiderate esaminare solo le porte elencate nel
file servizi fornito con nmap. Questo tipo di scan è ovviamente
più veloce di fare lo scan di tutte le 65535 porte di un host.
.TP
.B \-D <decoy1 [,decoy2][,ME],...>
Causa lo svolgimento di uno scan decoy, che fa in modo che
all'host remoto posto sotto scan appaiano anche lo/gli host che
specificate come decoy (esche). Così i loro IDS potrebbero
riportare 5-10 port scan da un unico indirizzo IP, ma non sanno
quale IP stava effettuando lo scn e quali sono innocenti decoy.
Sebbene questo scan possa essere sconfitto attraverso il
router path tracing, il response-dropping e altri meccanismi "attivi",
è generalmente una tecnica estremamente efficace per nascondere il
vostro indirizzo IP.
.Sp
Separate ciascun host decoy con virgole, e potete opzionalmente
usare 'ME' come uno dei decoy per rappresentare la posizione
nella quale volete il vostro indirizzo IP venga usato.
Se mettete 'ME' nella sesta posizione o oltre, per alcuni
rilevatori di portscan comuni (come ad esempio l'eccellente
scanlogd di Solar Designer) è molto poco probabile che
mostrino il vostro indirizzo IP. Se non usate 'ME', nmap
lo porrà in una posizione casuale.
.Sp
Notate che gli host che usate come decoy dovrebbero essere
attivi o potreste accidentalmente fare il SYN flood delle
destinazioni. Dovrebbe essere anche abbastanza semplice
determinare quale host è sottoposto a scan se uno solo è
allo stato attuale attivo sulla rete. Potreste voler usare
gli indirizzi IP invece dei nomi (in questo modo le rete dei
decoy non vi vedono nei log dei loro nameserver).
.Sp
Notate anche che alcuni "rilevatori di port scan" (stupidi)
firewalleranno/negheranno il routing agli host che provano
a fare il portscan. Così potreste inavvertitamente causare
alla macchina sottoposta a scan la perdita di connettività
con le macchine decoy che state usando,
Questo potrebbe causare alle macchine target maggiori problemi
se il decoy, è diciamo, il suo gateway internet o anche "localhost".
Così potreste voler essere prundenti con questa opzione.
La vera morale della storia è che i rilevatori dei portscan
spoofabili non dovrebbero agire contro la macchina che a loro
sembra stia eseguendo lo scan. Potrebbe essere solo un decoy!
.Sp
I decoy sono usati sia nello scan ping iniziale (usando ICMP,
SYN, ACK, o altro) e durante la fase attuale fase di port
scanning. I decoy sono anche usate durante il rilevamento
remoto del S.O. (
.B \-O
).
.Sp
Vale la pena notare che usare troppi decoy può rallentare il
vostro scan e renderlo potenzialmente anche meno accurato.
Inoltre, alcuni ISP filtreranno i vostri pacchetti spoofati,
sebbene molti (attualmente la maggior parte) non
restringono i pacchetti IP spoffati completamente.
.TP
.B \-S <Indirizzo_IP>
In alcune circostanze,
.I nmap
può non essere in grado di determinare il vostro indirizzo sorgente (
.I nmap
vi informerà se questo è il caso). In questa situazione, usate
\-S con il vostro indirizzo IP (dell'interfaccia mediante la quale
desiderate mandare i pacchetti).
.Sp
Un'altro possibile uso di questo flag è di spooffare lo scan
per fare in modo che le destinazioni pensino che
.B qualcun altro
le stia scannando.
Immaginate una società sulla quale un'altra rivale fa ripetutamente
dei port scan!. Questo non è un utilizzo supportato ( o lo scopo
principale) di questo flag. Ho già pensato che questo flag
avanza una interessante possibilità di cui le persone dovrebbero
essere consapevoli prima che vadano accusando altri di fare
lo portscanning contro di loro.
.B \-e
sarebbe generalmente richiesta per questo tipo di utilizzo.
.TP
.B \-e <interfaccia
Dice ad nmap su quale interfaccia mandare e ricevere i pacchetti.
Nmap dovrebbe essere ingrado di rilevare tale interfaccia, ma
questa opzione permette di dirgliela se non è in grado.
.TP
.B \-g <numeroporta>
Imposta il numero di porta sorgente usata negli scan. Molti
firewall nativi e installzioni di filtri di pacchetti fanno
un'eccezione nel loro insieme di regole per permettere ai
pacchetti DNS (53) o FTP-DATA (20) di passare attraverso e
stabilire una connessione. Ovviamente questo sovverte i
vantaggi di sicurezza di un firewall in quanto gli intrusi
possono mascherarsi come FTP o DNS modificando la loro porta
sorgente.
Ovviamente per uno scan UDP dovreste prima provare uno scan UDP
e gli scan TCP dovrebbero trovare 20 prima di 53.
Notate che questa è solo una richiesta -- nmap la onorerà solo
se è in grado di farlo. Per esempio, non potete fare il campionamento
TCP ISN da un host:porta a un'altro host:porta, così
nmap cambia la porta sorgente anche se avete usato -g.
.Sp
Rendetevi conto che usando questa opzione v'è una lieve
penalità nelle prestazione, perchè alcune volte io memorizzo
informazioni utili nel numero della porta sorgente.
.TP
.B \-r
Dice ad Nmap
.B DI NON
rendere casuale l'ordine nel quale le porte sono esaminate.
.TP
.B \-\-randomize_hosts
Dice ad Nmap di mescolare ciascun gruppo di host, fino a 2048
host prima di farne lo scanner. Questo può renedere gli scan
meno ovvi ai diversi sistemi di monitoraggio della rete,
specialmente quando lo combinare con opzioni di timing
lente (vedere sotto).
.TP
.B \-M <max sockets>
Imposta il numero massimo di socket che saranno usati in
parallelo per uno scan TCP connect() (lo scan di default).
Questa opzione è utile per rallentare di poco lo scan e evitare
il crash delle macchine remote. Un'altro approccio è usare
\-sS, opzione che è generalmente più semplice da gestire le
le macchine.
.TP
.B OPZIONI DI TIMING
Generalmente Nmap fa un ottimo lavoro nell'adattarsi alle
caratteristiche di rete a run-time e fare lo scan tanto veloce
quanto possibile minimizando le possibilità che degli host/ delle
porte rimangano non rilevate. Comunque, possono esservi casi lo
stesso in qui l politica di timing impostata di default possa
non incontrare i vostri obiettivi. Le seguenti opzioni forniscono
un buon livello di controllo sul timing di uno scan:
.TP
.B -T <Paranoid|Sneaky|Polite|Normal|Aggressive|Insane>
Queste sono possibili politiche di timing per esprimere
convenientemente le vostre priorità ad Nmap.
La modalità
.B Paranoid
fa gli scan
.B molto
lentamente nella speranza di evitare il rilevamento dai sistemi IDS.
Essa serializza tutti gli scan (nessuno scanning parallelo) e
generalmente aspetta almeno 5 minuti tra i pacchetti mandati.
.B Sneaky
è simile, eccetto che aspetta solo 15 secondi tra i pacchetti mandati.
.B Polite
è stato pensata per facilitare il carico sulla reta e ridurre le
possibilità di mandare in crash le macchine. Serializza le prove
e aspetta
.B almeno
0.4 secondi tra esse.
.B Normal
è il comportamento di default di Nmap, che prova a fare gli scan
tanto velocemente quanto gli è possibile senza sovracaricare la
rete o mancare degli host/delle porte.
La modalità
.B Aggressive
aggiunge un timeout di 5 minuti per host e non aspetta mai
più di 1.25 secondi per le risposte di prova.
.B Insane
è solo adatto per reti molto veloci o dove non vi importa
la perdità di alcune informazioni. Manda in time out gli
host in 75 secondi e aspetta solo 0.3 per le prove individuali.
Pero non permette sweep di rete molto veloci :). Potete anche
fare riferimento a questi numeri. Per esempio, \'-T
0\' vi da la modalità Paranoid e \'-T 5\' è la modalità Insane.
.Sp
Queste possibili modalità di timing NON dovrebbe essere usata con
i controlli a basso livello dati sotto.
.TP
.B --host_timeout <millisecondi>
Specifica la quantità di tempo, permessa ad Nmap per
fare lo scan di un singolo host prima di terminare lo
scan su quel dato IP. La modalità di timing impostata
per default non ha host timeout.
.TP
.B --max_rtt_timeout <millisecondi>
Specifica la somma massima di tempo permessa ad Nmap per
aspettare un risultato di una prova prima di ritrasmettere
o mandare in time-out quella prova particolare. La modalità
di default imposta questo limite a circa 9000 ms.
.TP
.B --min_rtt_timeout <millisecondi>
Quando gli host destinazione iniziano a stabilire un pattern
di risposta molto velocemente, Nmap diminuirà la somma di tempo
data per prova. Questo velocizza lo scan, ma può condurre a
pacchetti mancati quando una risposta impiega di più del solito.
Con questo parametro potete garantire che Nmap aspetterà
al meno la data quantità di tempo prima di terminare una prova.
.TP
.B --initial_rtt_timeout <millisecondi>
Specifica il timeout iniziale di prova. Questo è generalmente
utile solo quando fate lo scan di host firewallati con -P0.
Normalmente Nmap può ottenere buone stime RTT dal ping e dalle
prime prove. La modalità di default usa 6000.
.TP
.B --max_parallelism <numero>
Specifica il massimo numero di scan da svolgere
in parallelo, che è permesso a Nmap. Se impostate questo a 1
Nmap non proverà mai ad esaminare più di una porta alla volta.
Questa opzione ha effetto anche sugli altri scan paralleli come
i ping sweep, lo scan RPC, ecc.
.TP
.B --scan_delay <millisecondi>
Specifica la quantità di tempo
.B minima
nella quale Nmap deve aspettare tra le prove. Questa opzione
è utile principalmente per ridurre il carico di rete o per
rallentare il metodo di scan per penetrare furtivamente
sotto le soglie degli IDS.
.SH SPECIFICA DELLA DESTINAZIONE
Tutto ciò che non è un'opzione (o un argomenti di un'opzione)
viene trattato in nmap come specifica dell'host destinazione.
Il caso più semplice è elencare hostname singoli o indirizzi IP
sulla linea di comando. Se volete fare lo scan di una sottorete
di indirizzi IP, potete aggiungere
.B '/mask'
al nome host
o all'indirizzo IP
.B mask
deve essere compreso tra 0 (fai lo scan dell'intera internet)
e 32 (fai lo scan del singolo host specificato). Usate /24 per
fare lo scan di un indirizzo di classe 'C' e /16 per fare lo scan
di un indirizzo di classe 'B'.
.Sp
Nmap ha anche un notazione più potente che vi permette di
specificare un indirizzo IP usando liste/intervalli per ogni
elemento. Cosi potete fare lo scan dell'intera rete classe 'B'
128.210.*.* specificando '128.210.*.*' o '128.210.0-255.0-255' o
anche '128.210.1-50,51-255.1,2,3,4,5-255'. E certamente potete
usare la notazione maschera: '128.210.0.0/16'. Queste sono tutte
equivalenti. Se usate asterischi ('*'), ricordatevi che la maggior
parte delle shell vi richiedono che voi ne facciate l'escape con
le backslashes o li proteggiate con gli apici.
.Sp
Un'altra cosa interessante da fare è quantizzare Internet
in un'altro modo. Invece di fare lo scan di tutti gli host
in una classe 'B', fate lo scan '*.*.5.6-7' per esaminare
ogni indirizzo IP che finisce in .5.6 o .5.7. Decidete i
voi i vostri numeri. Per ulteriori informazioni sulla
specifica degli host su cui fare lo scan, vedere la sezione
.I esempi
.SH ESEMPI
Ecco qui vi sono alcuni esempi di utilizzo per nmap, da quelli
semplici e normali a quelli più complessi/esoterici. Notate che
numeri attuali e alcuni nomi di dominio attuali sono stati usati
per rendere le cose più concrete. Al loro posto dovreste sostituire
gli indirizzi/nome della
.B vostra rete.
Non penso che fare il portscanning di altre reti sia illegale;
i portscan non dovrebbero essere interpretati dagli altri
come un attacco. Ho fatto lo scan di centinaia di migliaia
di macchine e ho ricevuto solo una lamentela. Ma non sono un
avvocato e alcune persone (anali) protrebbero essere infastidite
dalle prove con
.I nmap.
Ottete il permesso prima o usatelo a vostro rischio.
.Sp
.B nmap -v destinazione.esempio.com
.Sp
Questa opzione fa lo scan di tutte le porte riservate TCP sulla
macchina destinazione.esempio.com. Il \-v significa aabilita
la modalità verbose.
.Sp
.B nmap -sS -O destinazione.esempio.com/24
.Sp
Lancia uno scan SYN invisibile (stealth) contro ogni macchina
che è attiva compresa nelle 255 macchine della classe 'C' dove
destinazione.esempio.com risiede. Prova anche a determinare
quale sistema opertivo è in esecuzione su ciascun host
che è attivo.
Questo scan richiede i privilegi di root a causa dello scan
SYN ed del rilevamento del S.O.
.Sp
.B nmap -sX -p 22,53,110,143,4564 "128.210.*.1-127"
.Sp
Manda uno scan Xmas tree alla prima meta di ciascuno delle
possibili sottoreti a 8 bit nello spazio di indirizzo classe
'B' 128.210.
Stiamo testando se i sistemi hanno in esecuzione sshd, DNS,
pop3d, imapd, o la porta 4564 aperta.
Notate che lo scan Xmas non funziona sulle macchine Microsoft
a causa del loro stack TCP deficente.
Lo stesso vale per le macchine CISCO, IRIX, HP/UX, e BSDI.
.Sp
.B nmap -v --randomize_hosts -p 80 '*.*.2.3-5'
.Sp
Piuttosto che concentrarsi su un'intervallo IP specifico,
alcune volte è interessante suddividere in parti l'intera Internet
e fare lo scan di una piccola parte. Questo comando trova
tutti i server web sulle macchine con gli indirizzi IP che
terminano in .2.3, .2.4, o .2.5. Se siete root potrete allo
stesso modo aggiungere -sS. Potrete anche trovare macchine
più interessanti che iniziano con 127. cosi potreste voler usare
'127-222' invece dei primi asterischi perche quella sezione ha
una maggior densità di macchine interessanti (IMHO).
.Sp
.B host -l company.com | cut '-d ' -f 4 | ./nmap -v -iL -
.Sp
Fa un DNS zone tranfer per trovare gli host in company.com
e poi da in pasto gli indirizzi IP a
.I nmap.
I comandi sopra visti sono per la mia macchina GNU/Linux.
Potreste aver bisogno di diversi comandi/opzioni su altri
sistemi operativi.
.SH BUGS
Bugs? Che bugs? Mandatemeli se li trovate. Anche patch sono
gradite :) Ricordate anche di mandare i fingerprint per i nuovi
S.O. così possiamo far crescere il database. Nmap vi darà una
URL di submission quando è stata trovata un'appropriata fingerprint.
.SH AUTORE
.Sp
Fyodor
.I <fyodor@insecure.org>
.SH DISTRIBUZIONE
La più recente distribuzione di nmap
.I nmap
puo' essere ottenuta al
.I http://www.insecure.org/nmap/
.Sp
.I nmap
is (C) 1997,1998,1999,2000 by Fyodor (fyodor@insecure.org)
.Sp
.I libpcap
viene anche distribuita assieme ad nmap. Il suo copyright
è detenuto da Van Jacobson, Craig Leres and Steven McCanne,
tutti del Lawrence Berkeley National Laboratory, Università
della California, Berkeley, CA.
La versione distributa con nmap può essere stata modificata
i sorgenti originali sono disponibili al
ftp://ftp.ee.lbl.gov/libpcap.tar.Z .
.Sp
Questo programma è software libero; potete ridistribuirlo e/o
modificarlo rispettando i termini della GNU General Public
License com pubblicata dalla Free Software Foundation;
Versione 2. Questa garantisce i vostri diritti di usare, modificare
e ridistribuire Nmap sotto certe condizioni. Se questa licenza
è per voi inaccettabile, Insecure.Org può essere in grado di
vendervi licenze alternative (contattate fyodor@insecure.org).
.Sp
Il sorgente viene fornito con questo software perchè crediamo
che gli utenti abbiano il diritto di sapere cosa esattamente
un programma ha intenzione di fare prima di eseguirlo.
Questo potrebbe anche permettevi di correggere di testare il
software per buchi alla sicurezza (non ne sono stati trovati
da molto).
.Sp
Il codice sorgente vi permette anche di fare il port di nmap
a nuove architetture, fissare i bug, e aggiungere nuove
caratteristiche. Siete fortemente incoraggiati di mandare i
vostri cambi a Fyodor per la possibile inclusione nella
distribuzione principale di Nmap. Mandando questi cambi
a Fyodor, o a nmap-hackers, si assume che voi stiate offrendo
a Fyodor il diritto illimitato, non esclusivo di riusare,
di modificare, e porre sotto nuova licenza il codice.
Se desiderate specificare condizioni speciali per la licenza
dei vostri contributi, dichiarateli prima sul contributo stesso.
.Sp
Questo programma è distribuito nella speranza che sia utile, ma
.B SENZA ALCUNA GARANZIA;
senza anche l'implicita garanzia di
.B COMMERCIABILITA'
o
.B ADEGUATEZZA AD UNO SCOPO PARTICOLARE.
Vedere la GNU Public License per ulteriori dettagli (essa è nel file
COPYING della distribuzione di
.I nmap
).
.Sp
Si dovrebbe notare che Nmap può mandare in crash determinate
applicazioni mal progettate, stack TCP/IP, e anche
sistemi operativi.
.B Nmap non dovrebbe mai essere eseguito contro sistemi,
che hanno compiti critici (detti anche mission critical systems)
a meno che non siate preparati a tollerare
il tempo in cui essi siano disattivi.
Qui riconosciamo che Nmap può mandare in crash i vostri sistemi o
reti e non ci assumiamo nessuna responabilità per ogni danno o
problema che Nmap potrebbe causare.
.Sp
Tutte le versioni di Nmap a partire dalla 2.0 inclusa
non presentano problemi in tutti i loro aspetti
con il bug dell'anno 2000 (Y2K bug).
Non esiste nessuna ragione di credere che le versioni
precedenti alla 2.0 siano suscettibili a tale problema,
ma non sono state testate.

View file

@ -1,389 +0,0 @@
.\" This definition swiped from the gcc(1) man page
.de Sp
.if n .sp
.if t .sp 0.4
..
.TH NMAP 1
.SH VÂRDS
nmap \- Network exploration tool and security scanner
.SH NOSAUKUMS
.B nmap
[skançðanas metode(s)] [opcijas] <host vai tîkls#1...[#N]>
.SH APRAKSTS
.I Ar Nmap var skançt neierobeþotu daudzumu un lielumu tîklus, noteikt to droðîbas pakâpi, apzinât atvçrtos portus, arî atbilstoðo servisu esamîbu. Ðî uzdevuma îstenoðanai Nmap izmanto daudz daþâdas skançðanas metodes, piemçram UDP, TCP connect(), TCP SYN, FTP proxy (skançðana caur ftp), Reverse-ident, ICMP (ping) FIN, ACK, Xmas tree, SYN, NULL metodes. Tuvâk tâs apskatîtas nodaïâ "Skançðanas opcijas".
.I Nmap satur daudz daþâdas papildus iespçjas, konkrçtâk: datora operçtâjsistçmas noteikðana (tâlâk tekstâ OS) izmantojot TCP/IP steka sniegto informâciju, "neredzamo" skançðanu, dinamiski ìenerçtas aiztures un atkârtota pakeðu pârraidîðana, paralçlâ skançðana, neaktîva host`a noteikðana izmantojot paralçlo ping pieprasîjumu, skançðana no neeksistçjoðiem hostiem, noteikt pakeðu filtru esamîbu, tieðâ (neizmantojot portmapper) RPC skançðana, skançðana izmantojot IP-fragmentâciju.
.I Kaut arî Nmap ir maksimâli optimizçts priekð parastiem lietotâjiem, daudzas iespçjas ir atïautas tikai root lietotâjam. Ieteicam Nmap laist ar root tiesîbâm.
.PP
Nmap rezultâti tiek izvadîti kâ interesçjoðo portu saraksts uz skançtâ kompjûtera, protokola tips, servisa nosaukums. Portiem klât ir apzîmçjumi "atvçrts" (open), "filtrçts" (filtered), "nefiltrçts" (unfiltered). "atvçrts" nozîmç, ka ðim portam var pieslçgties, "filtrçts" - ugunsmûris (firewall) pakeðu filtrs , vai kâds cits apstâklis neïauj Nmap noteikt, vai ports ir atvçrts vai nç, "nefiltrçts" - ports ir aizvçrts, lai gan nekas netraucçja Nmap to skançt.
.PP
Atkarîbâ no dotajâm komandâm, Nmap spçj noteikt ðâdas skançjamâ host`a îpaðîbas: lietotâja OS, TCP ISN ìenerçðanas metodi, lietotâja vârdu (username) kam "pieder" noteikts serviss, DNS nosaukumu u.t.t.
.SH OPCIJAS
Vairumu opciju ir iespçjams kombinçt savâ starpâ.Vienas opcijas paredzçtas priekð skançðanas metoþu izvçlçs, citas savukârt atbild par daþâdu papildus iespçju izmantoðanu, vai arî atbild par daþâdiem skançðanas parametriem. Palaiþot programmu Nmap ar opciju '-h' vienmçr ir iespçjams iegût informâciju par visâm tâs iespçjâm.
.TP
.B SKANÇÐANAS VEIDI
.TP
.B \-sS
(scan SYN) - Izmantot TCP SYN metodi. Ðo metodi sauc par "pusatverto" skançðanu, jo pilnîgs savienojums ar attâlinâtâ datora portu nenotiek. Nmap nosûta SYN paketi, itkâ pieprasot nodibinât savienojumu un gaida attâlinâtâs sistçmas atbildi. Atbildot sistçma nosûta paketi ar SYN|ACK maríçjumu (flag), ka ir gatava nodibinât savienojumu. Kad Nmap saòem SYN|ACK paketi, atpakaï nekavçjoties tiek nosûtîta RST pakete liekot saprast attâlinâtajai sistçmai, ka nevçlas nodibinât vçl neveikto savienojumu. Ne visas sistçmas fiksç ðâda tipa skançðanu. Lietotâjam vajadzîgas root tiesîbas, lai varçtu izveidot SYN paketes.
.Sp
Lai paâtrinâtu skançðanu, skançjot lielus tîklus, kopâ ar opciju '-sS' var lietot saîsinâjumu, kurð atïauj pieprasît norâdîto portu visâm aktîvajâm sistçmâm jûsu skançtajâ diapazonâ daudz âtrâk, nekâ izmantojot tikai '-p' opciju. To var izdarît ar saîsinâjuma -PS palîdzîbu. Piemçram, ja ir nepiecieðamîba noteik, cik sistçmas noteiktâ diapazonâ ir atvçruðas 25 portu jums ieteicams lietot ðo saîsinâjumu. (piem):
nmap -n -sS -p25 -PS25 24.0.0.0/8
.TP
.B \-sT
(scan TCP) - izmanto TCP connect() metodi. Ðî ir visizplatîtâkâ TCP portu skançðanas metode. Funkcija connect(), ir iekïauta jebkurâ OS, tâdejâdi atïaujot îstenot savienojumus ar vienalga kâdu attâlinâtâs sistçmas portu. Ja skançjamais ports uz attâlinâtâs sistçmas bûs pieejams, tad funkcija connect() noritçs veiksmîgi, pretçjâ gadîjumâ ports skaitâs slçgts, vai arî aizsargâts ar ugunsmûri, vai ko tamlîdzîgu.
.Sp
Lai izmantotu ðo skançðanas metodi, lietotâjam nav vajadzîgas t.s. priviliìçtâs tiesîbas. Ðâdu skançðanu ïoti viegli konstatç skançjamâ datorâ îpâðnieks, jo viss tiek akurâti ierakstîts log failâ.
.TP
.B \-sF \-sX \-sN
(scan FIN, scan Xmas, scan NULL) - "neredzamâ" FIN, Xmas Tree un NULL skançðana. Ðo metodi lieto, ja SYN skançðana kâdu iemeslu dçï nav iespçjama. Piemçram daþi ugunsmûri filtrç SYN paketes, kas tiek nosûtîtas uz viòu aizsargâtajiem portiem, un tâdas programmas kâ Synlogger spçjîgas fiksçt SYN skançðanas mçìinâjumu.
.Sp
Dotâs skançðanas laikâ notiek sekojoðais. FIN skançðanu veic ar FIN paketçm. Xmas Tree izmanto FIN|URG|PSH paketes, NULL skançðanas gadîjumâ tiek nosûtîtas nemaríçtas paketes. Vadoties pçc RFC 973 rakstîtâ, skançjamâs sistçmas OS ir jâatbild uz ðâda veida paketçm, no slçgtiem portiem ar RST paketi, tajâ paðâ laikâ atvçrtie porti ðo nemaríçto paketi ignorç.
Kâ vienmçr Microsoft Windows izstrâdâtâji nerçíinâs ar pieòemto standartu, tâdçï ði skançðanas metode bûs neefektîva skançjot jebkuru sistçmu, kas izmanto Microsoft veidotâs OS. Ja FIN skançðanas rezultâtâ, tiek izmests atvçrto portu saraksts, tad attâlinâtâs sistçmas OS nav Windows. Ja visas ðîs metodes izmet paziòojumu, ka visi porti slçgti, turpretîm SYN skançðana atklâj atvçrtus portus, tad visticamâk attâlinâtâs sistçmas OS ir Windows. Jâpiebilst, ka Windows nav vienîgâ OS, kura satur ðo nepilnîbu. Pie ðâda tipa OS var pieskaitît arî Cisco, BSDI, IRIX, HP/UX un MVS. Visas ðis OS neatbild nemaríçtâm paketçm.
.TP
.B \-sP
scan Ping) - ping "skançðana". Daþreiz ir nepiecieðamîba uzzinât tikai aktîvo hostu adreses. Nmap to spçj izdarît, nosûtot ICMP ECHO pieprasîjumu katrai ip adresei norâdîtajâ diapazonâ. Hosts, kas atbild uz ðo pieprasîjumu ir aktîvs, t.i. ir pieslçgts tîklam.
.Sp
Daþi hosti (piemçram microsoft.com) bloíç ECHO pieprasîjumus, tâdçï Nmap papildus nosûta TCP ACK paketi uz 80 portu (noklusçti). Ja hosts atbild ar RST paketi, tad viòð ir aktîvs. Treðâ metode izmanto SYN paketi, par atbildi gaidot RST vai SYN|ACK paketi. Lietotâjiem, kuriem nav root privilçìijas tiek izmantota connect() metode.
.Sp
Lietotâjiem ar root privilçìijâm Nmap noklusçti lieto abas metodes - ICMP un ACK. Ðo iestâdijumu var mainît izmantojot opciju .B \-P
, kur aprakstîta zemâk. Ping skançðana tiek lietota vienmçr un tikai aktîvâs sistçmas tiek skançtas, tâdçï ðo skançðanas metodi izmatojiet tikai ta, ja vçlaties uzzinât aktîvo sistçmu daudzumu, ne veikt to portu skançðanu.
.TP
.B \-sU
(scan UDP) - Ðî skançðanas metode ïauj noteikt kâdi UDP porti (RFC 768) ir atvçrti uz attâlinâtâs sistçmas. Uz katru skançjamâs sistçmas portu tiek nosûtîta UDP pakete, kas nesatur datus. Ja sistçma atbild ar ICMP paziòojumu "port unreachable" tad ports ir aizvçrts, pretçjâ gadîjumâ tas tiek uzskatîts par atvçrtu. Daþi uzskata, ka skançt UDP portus nav nekâdas jçgas. Ðinî gadîjumâ atgâdinu par "slavenîbu" ieguvuðo gïuku iekð dçmona rpcbind OS Solaris. Ðis dçmons grieþas uz jebkura no nedokumentçtajiem UDP portiem, kas ir lielâki par 32770.
.Sp
Par noþçloðanu jâatdzîst, ka UDP skançðana velkas lçni, jo gandrîz visas OS seko RFC 1812 (sadaïa 4.3.2.8) rekomendâcijâm iegroþot ICMP "port unreachable" ìenerçðanas âtrumu. Piemçram Linux kernelis (katalogs net/ipv4/icmp.h) ierobeþo ðâda tipa paziòojumu ìenerçðanu lîdz 80, 4 sekundçs ar 1/4 sekundes novçloðanu, ja ðî robeþa tiek pârsniegta. OS Solaris ir vçl striktâki ierobeþojumi (2 ziòojumi sekundç), tâdçï sistçmu skançðana kuras grieþas uz OS Solaris ir vçl lçnâka.
.Sp
Nmap nosaka ðo ierobeþojumu parametrus un atbilstoði tiem samazina ìenerçjamos pieprasîjumus, tâdejâdi atturoties no tîkla piemçsloðanas ar nevajadzîgâm paketçm, kuras ignorç attâlinâtâ sistçma. Kâ jau ierasts kompânija Microsoft ignorç visas rekomendâcijas un neizmanto savâs OS nekâdus ierobeþojumus. Tâdejâdi jûs varat ïoti âtri noskançt visus 65535 UDP portus sistçmai, kas grieþas zem OS Windows.
.TP
.B \-sO
(scan Open protocol) - Dotâ metode tiek izmantota, lai noteiktu IP protokolus, kurus uztur attâlinâtâ sistçma. Attâlinâtajai sistçmai tiek sûtîtas IP paketes, kurâm nav nekâda maríçjuma. Tâs tiek sûtîtas katram protokolam. Ja par atbildi tiek saòemts paziòojums "protocol ureachable", tad doto protokolu attâlinâtâ sistçma neuztur. Pretçjâ gadîjumâ Nmap uzskata, ka protokols tiek uzturçts.
.Sp
Daþas OS (AIX, HP-UX, Digital UNIX) kâ arî ugunsmûris var bloíçt ziòojumus "protocol ureachable", tâ rezultâtâ visi protokoli tiks uzskatîti par uzturçtiem.
Par cik aprakstîtâ metode ir lîdzîga UDP skançðanas metodei, tad ICMP ìenerçðanas ierobeþojumu noteikðana paliek spçkâ, taèu tâdçï ka IP paketes "header" sastâv tikai no 8 bitiem visus 256 protokolus izdodas noskançt pieòemamâ âtrumâ.
.TP
.B \-sA
(scan ACK) - ACK skançðanas metode. Ðî papildus metode ïauj noteikt ugunmûra konfigurâciju (rulesets). Izmantojot ðo metodi var noteikt, vai attâlinâtâ sistçma ir aizsargâta ar ugunsmûri vai tikai ar pakeðu filtru, kurð bloíç ienâkoðâs SYN paketes.
.Sp
Skançjamajai sistçmai tiek nosûtîta ACK pakete (ar gadîjuma skaitïu acknowledgement number un sequence number). Ja par atbildi tiek saòemta RST pakete, ports tiek uzskatîts par nefiltrçtu. Ja atbilde nepienâk (vai arî pienâk ICMP "port unreachable") tad ports tiek uzskatîts par filtrçtu.
.Sp
Jâpiebilst, ka Nmap nerâda "nefiltrçtos" portus, tâpçc, ja skançjot attâlinâtu sistçmu jums neatklâj nevienu atvçrtu portu, tas nozîmç ka porti skaitâs nefiltrçti. Ðî metode nekad rezultâtos nerâdîs portus kuri skaitâs atvçrti.
.TP
.B \-sW
(scan Window) - Izmanto TCP Window metodi. Ðî metode lîdzinâs ACK skançðanai, izòemot to, ka daþreiz ar ðîs metodes palîdzîbu var noteikt kâ atvçrtos, tâ filtrçtos/nefiltrçtos portus. To iespçjams izdarît, pârbaudot Initial Window datus TCP paketç, kurus nosûta attâlinâtâ sistçma par atbildi tai nosûtitajai paketei, kuru tâ nepareizi apstrâdâ.
Sistçmas kurâs ir ðî kïuda: vairâkas AIX versijas, Amiga, BeOS, BSDI, Cray, Tru64 UNIX, DG/UX, OpenVMS, Digital UNIX, FreeBSD, HP-UX, OS/2, IRIX, MacOS, NetBSD, OpenBSD, OpenStep, QNX, Rhapsody, SunOS 4.X, Ultrix, VAX un VxWorks. Tuvâku informâciju var iegût aplûkojot Nmap-hackers listes arhîvus.
.TP
.B \-sR
(scan RPC) - Izmantot RPC skançðanas metodi. Ðo metodi izmanto kopâ ar citâm. Tâ palîdz noteikt, kâda programma apkalpo RPC portu un tâs versiju. Lai to noteiktu, visi TCP/UDP porti tiek flûdoti ar SunRPC NULL pieprasîjumiem pçc tam nosakot programmu kas apkalpo RPC portu(s). Izmantojot ðo metodi jûs viegli iegûstat tâdu paðu informâciju kâ palaiþot komandu 'rpcinfo -p', arî tâdâ gadîjumâ, ja attâlinâtâs sistçmas portmapper ir aizsargâts ar ugunsmûri vai TCP_wrapper.
.TP
.B \-sL
(scan List) - Iegût skançjamo adreðu sarakstu. Ðî opcija ïauj jums aplûkot adreðu sarakstu, kuras TIKS skançtas ar Nmap palîdzîbu. Noklusçti tiek noteikti to DNS nosaukumi. Ðo iespçju var aizliegt izmantojot -n opciju.
.TP
.B \-b <ftp relay host>
(bounce scan) - Izmantot "ftp bounce attack" uzbrukumu. Ði interesantâ FTP protokola iespçja tuvâk aprakstîta RFC 959. No hosta source.com var nodibinât savienpjumu ar target.com ftp serveri un nosûtît failus, kas tur atrodas uz vienalga kâdu adresi. Ðis uzbrukums tika atklâts 1985 gadâ, kad tika uzrakstîts augðminçtais RFC. Nmap izmanto ðo kïûdu lai skançtu portus no "uzticamâ" ftp servera.
.Sp
Iespçjams pieslçgties ftp serverim, kuru apsargâ ugunsmûris un noskançt pârçjos aizsargâtos portus. Ja ftp serveris atïauj lasît un rakstît datus kâdâ katalogâ (piemçram /incoming), jûs varat nosûtît jebkâdus datus uz ðo portu. Opcija '-b', norâda ftp servera adresi, kurð tiek izmantots kâ "uzticamais" serveris. URL formâts:
.I login:parole@serveris:ports
Adrese nepiecieðama obligâti, pârçjo var neievadît.
.TP
.B PAPILDUS IESPÇjAS
Ðîs opcijas nav nepiecieðams lietot obligâti, taèu daþreiz tâs var bût diezgan noderîgas.
.TP
.B \-P0
(Ping 0) - Nepingot attâlinâto sistçmu pirms skançðanas. Ðî opcija atïauj skançt tîklus kuri neatïauj ICMP ECHO pieprasîjumus, vai atbildes uz tiem. piemçram microsoft.com. Var izmantot .B \-P0
vai
.B \-PT80
kad skançjat tâdu tiklu.
.TP
.B \-PT
(Ping TCP) - Izmantot TCP "ping". ICMP ECHO vietâ Nmap nosûta TCP ACK paketi skançjamajai sistçmai un gaida tâs atbildi. Ja sistçma ir "aktîva" tâ atbild ar RST paketi. Lietotâju, kuriem nav root privilçìijas tiek izmantota connect() funkcija. Ðî opcija jums ïauj noteikt attâlinâtâs sistçmas stâvokli pat tâdâ gadîjumâ , ja ICMP pieprasîjumu tiek aizliegti ar ugunsmûra palîdzîbu. Lai norâdîtu kuram attâlinâtâs sistçmas portam sûtît pieprasîjumu izmantojiet opciju '-PT <porta_nummurs>'. Noklusçti pieprasîjums tiek sûtîts uz 80 portu, jo tas praktiski nekad netiek filtrçts.
.TP
.B \-PS
(Ping SYN) - opcija, kas arîdzan tiek izmantota ping pieprasîðanai. Ðinî gadîjumâ ACK paketes vietâ tiek sûtîta SYN pakete. Aktîvâs sistçmas atbild ar RST paketi (retâk ar SYN|ACK).
.TP
.B \-PI
(Ping ICMP) - Ðî opcija ping pieprasîðanai izmanto normâlu ping paketi (ICMP ECHO). Opcija tiek izmantota, lai meklçtu aktîvas sistçmas, kâ arî nepareizi konfigurçtas sistçmas, kuras atïauj veikt DoS uzbrukumus citâm sistçmâm (piemçram Smurf).
.TP
.B \-PP
Izmanto ICMP timestamp pieprasîjuma paketi, lai atrastu aktîvus hostus.
.TP
.B \-PM
Lidzîga kâ -PI un -PP, vienîgâ atðíirîba ir netmask pieprasîjums.
.TP
.B \-PB
(Ping Both) - Vienlaicîgi izmantot ACK un ICMP pieprasîjumu.
.TP
.B \-O
(Operating system detection) - Ðî opcija ïauj noteikt attâlinâtâs sistçmas OS izmantojot t.s. TCP/IP steka "pirkstu nospiedumus". Citiem vârdiem skaidrojot, Nmap nosûta pieprasîjumus uz attâlinâto sistçmu un saòemot atbildi salîdzina to ar savu datubâzi, kura glabâjas failâ Nmap-os-fingerprinting. Ja Nmap nespçj noteikt attâlinâtâs sistçmas OS jums tiek piedâvâts nosûtît rezultâtus Nmap autoram, ja jûs zinât attâlinâtâs sistçmas OS un esat pârliecinâts, ka Nmap nespçja to atpazît.
.TP
.B \-I
(Ident scan) - Izmanto reverse-ident skançðanu. Ident protokols (RFC 1413) atïauj uzzinât tâ lietotâja vârdu (username), kuram pieder process, kurð izmanto TCP, pat tâdâ gadîjumâ ja ðis process nenodibina savienojumu. Piemçram var pieslçgties http portam un izmantojot ident uzzinât vai serveris grieþas zem root lietotâja. Tas ir iespçjams tikai nodibinot "pilnîgu" TCP savienojumu ar skançjamâs sistçmas portu (t.i. nepiecieðams izmantot arî opciju '-sT'). Nmap pieprasa ident`am informâciju par katru atvçrto portu. Protams ðî metode nestrâdâs ja skançjamâ sistçma neuztur ident.
.TP
.B \-f
(use fragmentation) - ðî opcija izmantojama kopâ ar SYN, FIN, Xmas vai NULL skançðanas metodçm un norâda uz vajadzîbu izmantot IP fragmentâciju ar mazizmçra fragmentiem. Skançðanas laikâ TCP header tiek sadalîta pa vairâkâm paketçm, tâdejâdi apgrûtinot pakeðu filtriem, IDS, un tamlîdzîgâm aizsardzîbas metodçm noteikt ko tu vçlies darît. Lietojiet ðo opciju piesardzîgi. Daþas programmas uzkarâs cenðoties savâkt kopâ tik sîkus fragmentus.
.TP
.B \-v
(verbose output) - Ðo opciju ir ieteicams lietot, jo tâ sniedz vairâk informâciju par to kas paðreiz notiek. Nmap atskaitâs detalizçtâk par to ko viòð paðreiz dara. Priekð lielâka efekta ieteicams to lietot divreiz. Kopâ ar '-d' opciju var iegût visdetalizçtako informâciju.
.TP
.B \-h
(show help) - izmet Nmap help`u.
.TP
.B \-oN <logfilename>
(output Normal) - ieraksta skançðanas rezultâtus lasîðanai çrtâ formâ norâdîtâjâ failâ.
.TP
.B \-oX <logfilename>
(output XML) - ðî opcija ieraksta saòemtos datus XML formâ.
.TP
.B \-oG <logfilename>
(output grepable) - ðî opcija ieraksta saòemtos datus norâdîtajâ failâ vienâ rindiòâ.
.TP
.B \-oA <basefilename>
output All) - liek Nmap logot rezultâtus izmantojot visas logoðanas metodes (normal, grepable, un XML).
.TP
.B \-oS <logfilename>
thIs l0gz th3 r3suLtS of YouR ScanZ iN a
.B s|<ipT kiDd|3
f0rM iNto THe fiL3 U sPec\|fy 4s an arGuMEnT! U kAn gIv3
the 4rgument \'-\' (wItHOUt qUOteZ) to sh00t output iNT0
stDouT!@!!
.TP
.B \--resume <logfilename>
ja kâda iemesla dçï esat bijis spiests pârtraukt skançðanu nospieþot <Ctrl C>, jûs varat izmantot ðo opciju, ja skançðanas rezultâti ierakstîti izmantojot opcijas '-oM' vai '-oN'. lai atjaunotu skançðanu no tâs vietas, kur pârtraucât. Vairâk nekâdas papildus opcijas lietot nav nepiecieðams.
.TP
.B \--append_output
liek Nmap rakstît rezultâtus tâlâk tajâ paðâ failâ, kurð izmantots iepriekð.
.TP
.B \-iL <inputfilename>
(input List) - lasît adreses no norâdîtâ faila. Adresçm failâ jâbur atdalîtâm ar tukðumu, ar tab, vai ar <CR><LF> kombinâciju (katrs hosts jaunâ rindâ).
.TP
.B \-iR
(input Random) - lietojot ðo opciju Nmap skançs gadîjuma izvçlçtas adreses. Ðis process vilksies tik ilgi, kamçr jûs to neapturçsiet. Ðî opcija ir noderîga, lai veiktu Internet statistiku.
.TP
.B \-p <port ranges>
(ports) - ðî opcija norâda Nmap, kâdus portus nepiecieðams skançt. Piem. opcija '-p23' liek tam skançt skançs tikai 23 portu. Ja norâdîs ko lîdzîgu ðai opcijai '-p 20-30,139,60000-', Nmap skançs portus no 20 lîdz 30 ieskaitot, 139 portu un visus portus, kas lielâki par 60000. Noklusçti Nmap skanç portus no 1 lîdz 1024.
.Sp
Skançjot TCP un UDP portus tu vari norâdît '-p U:53,11,137,T:21-25,139,8080'. Lai skançtu ðâdi tev nepiecieðams norâdît vismaz vienu TCP skançðanas tipu (piem. -sS, -sF, vai -sT). Ja netiek norâdîts protokols, tad dotie porti tiek skançti visos protokolos.
.TP
.B \-F (Fast scan) -
norâda skançt tikai tos portus kas norâdîti servisu failâ (iekïauts kopâ ar Nmap).
.TP
.B \-D <decoy1 [,decoy2][,ME],...>
use Decoy hosts). - Ðajâ reþîmâ Nmap liek attâlinâtajai sistçmai domât, ka tâ tiek skançta no vairâkiem hostiem.Tâdejâdi ir grûtâk noteikt, no kurienes reâli tiek skançts. Ðî ir ïoti efektîga metodç, lai slçptu savu IP adresi skançjot.
.Sp
Jûs varat norâdît savu IP adresi kâ 'ME' Tâ norâda, kad tiks lietota tava IP adrese. Piemçram, ja tu to ieraksti kâ sesto vai vçl tâlâk, tad daudzi skançðanas detektori uz attâlinâtâs sistçmas var vispâr neielogot tavu IP adresi. Jâpiebilst, ka norâdîtajiem attâlinâtajiem hostiem ir jâbût pieslçgtiem pie tîkla, pretçjâ gadîjumâ jûs varat pârslogot skançjamo sistçmu ar SYN paketçm. Jâpiebilst, ka pastâv iespçja tâdejâdi noteikt tavu IP adresi, ja tevis norâdîtie attâlinâtie hosti reâli neeksistçs.
.Sp
Ja tu norâdi daudzus attâlinâtus hostus, tas var ievçrojami palçlinât skançðanas âtrumu. Ðo iespçju var izmantot jebkurâ skançðanas veidâ. Daþi provaideri var filtrçt jûsu paketes, tâdejâdi ði opcija var nedot jums vçlamos rezultâtus.
.TP
.B \-S <IP_Address>
(set Source) - Ja Nmap nespçj patstâvîgi noteikt jûsu hosta ip adresi (viòð par to jûs brîdinâs), jums ir nepiecieðams to viòam norâdît. Vçl viens pielietojums ðai opcijai var bût - izlikties, ka skançðana notiek no citas IP adreses. Ðinî gadîjumâ jûs nevarat iegût rezultâtus, taèu attâlinâtâ sistçma domâs, ka skanç no tevis norâdîtâs adreses. Ðai gasîjumâ nepiecieðams lietot opciju '-S' kopâ ar '-e'.
.TP
.B \-e <interface>
(interface) - norâda Nmap, kâds interfeiss tiks izmantots lai saòemtu/sûtîtu paketes. Nmap parasti pats nosaka, kâds interfeiss tiek lietots.
.TP
.B \-g <portnumber>
norâda porta numuru uz tava datora, kuru Nmap izmatos skançðanai. Daudzi pakeðu filtri vai ugunsmûri laiþ cauri DNS paketes (53 ports)un FTP-DATA (20 ports) tâdejâdi atïaujot nodibinâts savienojumu ar attâlinâtu aizsargâtu sistçmu. Skançjot UDP portus Nmap no sâkuma izmçìina 53 portu, pçctam 20 poru. Skançjot TCP portus - otrâdâk.
.TP
.B \--data_length <number>
Parasti Nmap sûta maziòas paketes, kuras satur tikai header informâciju. Ðî opcija atïauj tâs palielinât tâdejâdi palçlinot skançðanas âtrumu, taèu samazinot iespçju ka jûsu skançðanu kâds pamanîs.
.TP
.B \-n
norâda, lai Nmap nekad nenoteiktu DNS IP adresçm, kuras tas atrod. Ðî opcija var paâtrinât skançðanu.
.TP
.B \-R
norâda, lai Nmap vienmçr noteiktu atrasto IP adreðu DNS.
.TP
.B \-r
(randomize off) - Nmap skanç visus portus noteiktâ secîbâ katrai skançjamai sistçmai.
.TP
.B \-\-randomize_hosts
Norâda lai Nmap skanç attâlinâto sistçmu portus neregulâri. Piem. vienai sistçmai tas noskanç 23 portu otrai sistçmai noskanç 665 portu, tad atkal pirmajai sistçmai 45 utt. Tâdejâdi ir iespçjams skançt 2048 sistçmas vienlaicîgi.
.TP
.B \-M <max sockets>
(Max sockets) - norâda maksimâlo soketu skaitu, kas tiks izmantots paralçli skançjot ar TCP connect() metodi. Tâdejâdi var izvairîties no attâlinâto sistçmu nokârðanas. Var izmantot arî '-sS' opciju, jo SYN paketes jebkura OS "pacieð" vieglâk.
.TP
.B LAIKA IESTÂDÎÐANA
Parasti Nmap automâtiski nosaka kâdâ laika intervâlâ tiks sûtîtas paketes un notiks skançðana. Ðîs opcijas paredzçtu, gan lai palielinâtu skançðanas âtrumu, gan lai samazinâtu kïudas, gan lai palçlinâtu âtrumu un samazinâtu iespçju attâlinâtâs sistçmas administrâtorâm fiksçt skançðanas mçìinâjumu.
.TP
.B -T <Paranoid|Sneaky|Polite|Normal|Aggressive|Insane> (Timing options) - Ðî opcija tiek izmantota, lai regulçtu skançðanas âtrumu.
.B Paranoid reþîms tiek izmantots tad, ja ir liela iespçjamîba, ka uz attâlinâtâs sistçmas ir uzstâdîts IDS. Ðinî gadîjumâ skançðana noris ïoti lçni. Paralçla skançðana netiek izmantota. Pakete tiek izsûtîtâ minimums ar 5 minûðu intervâlu.
.B Sneaky
reþîms ir lîdzîgs Paranoid reþîmam. Tas sûta paketes ar 15 sekunþu intervâlu.
.B Polite
reþîms tiek izmantots gadîjumos, kad ir vajadzîba samazinât tîkla noslogotîbu lîdz minimumam. Ðinî reþîmâ paketes tiek sûtîtas ar minimâlo intervâlu 0,4 sekundes.
.B Normal
reþîmu Nmap izmanto noklusçti. Ðinî reþîmâ tiek nodroðinâts maksimâlo iespçjamo âtrumu, tajâ paðâ laikâ nenoslogojot tîklu un cenðoties izvairîties no kïûdâm skançðanas gaitâ.
.B Aggressive
reþîmâ tiek uzstâdîts 5 minûðu skançðanas limits katram hostam, un Nmap nekad negaida ilgâk par 1,25 sekundi uz atbildi.
.B Insane
reþîms ir ieteicams tikai priekð ïoti âtriem tîkliem, vai arî tad ja tu vari samierinâties ar iespçjamâm kïûdâm skânçðanas norisç. Tiek uzstâdîts 75 sekunþu limits katram hostam un tiek gaidîts tikai 0.3 sekundes uz atbildi.
.Sp
Katram reþîmam ir piesaistîts nummurs. Piem. opcija '-T0' apzîmç paranoid reþîmu, bet '-T5' - Insane
.TP
.B --host_timeout <milliseconds>
Uzstâda laiku, norâdit Nmap cik ilgs laiks tiek atvçlçts priekð viena hosta pilnîgas noskançðanas. Noklusçti ðis parametrs netiek izmantost. Nmap sâk skançt nâkoðo hostu pçc tam, kad pabeidzis skançt iepriekðçjo.
.TP
.B --max_rtt_timeout <milliseconds>
(maximal round-trip time timeout) - Maksimâlais laiks, cik ilgi Nmap gaidîs uz nosûtîto pieprasîjuma atbildi, pçc tam nosûtot jaunu, vai pârtraucot gaidîðanu. Standartâ tas ir nostâdîts uz 9000 milisekundçm.
.TP
.B --min_rtt_timeout <milliseconds>
Minimâlais laiks, cik ilgi Nmap gadîs uz nosûtîtâ pieprasîjuma atbildi. Ðî opcija var paâtrinât skançðanas âtrumu, taèu var tika pazaudçtas paketes.
.TP
.B --initial_rtt_timeout <milliseconds>
Norâda vidçjo laiku, cik ilgi Nmap gaidîs nosûtîtâ pieprasîjuma atbildi. Parasti ðo opciju izmanto, kad tiek skançtas sistçmas kas tiek aizsargâtas ar ugunsmûri. Parasti Nmap ðo lielumu nosaka automâtiski pçc pirmo pâris pieprasîjumu noteikðanu. Standartâ tas ir 6000 milisekundes
.TP
.B --max_parallelism <number>
Uzstâda skaitu cik daudz paketes tiks sûtîtas paralçli. Ja ðis parametrs tiek norâdîts kâ 1 tad tas nozîmç, ka Nmap nekad neskançs vairâk par vienu portu reizç.
.TP
.B --scan_delay <milliseconds>
Norâda minimâlo laiku, cik ilgi Nmap gaidîs starp pieprasîjumu nosûtîðanu. Ðî opcija ïauj minimâli noslogot tîklu un/vai izvairîties no skançðanas pamanîðanas uz attâlinâtâs sistçmas.
.TP
.SH SKANÇJAMÂ MÇRÍA NORÂDÎÐANAS IESPÇJAS
Visu, kas nav opcijas vai to argumenti, Nmap pieòem kâ adresi vai attâlinâtâs sistçmas DNS. Viselementârâkais veids kâ norâdît skançjamo hostu, ir, norâdît to aiz opcijâm. Ja jûs vçlaties noskançt subnet`u, jums nepiecieðams norâdît parametru '/<mask>' pçc skançjamâs sistçmas DNS vai ip adreses. Subnet`a masku var norâdît ðâdos veidos:
.Sp
'/0' - skançt visu Internetu;
.Sp
'/16' - skançt B klases adreses;
.Sp
'/24' - skançt C klases adreses;
.Sp
'/32' - skançt tikai norâdîto hostu.
.TP
Nmap tâdâ paðâ veidâ atïauj norâdît ip adreses izmantojot sarakstu, vai arî diapazonu katram tâs elementam. Piem. ir vajadzîba noskançt B klases subnetu ar adresi 128.210.*.*. To iespçjams norâdît sekojoðos veidos:
.Sp
128.210.*.*
.Sp
128.210.0-255.0-255
.Sp
128.210.1-50,51-255.1,2,3,4,5-255
.Sp
128.210.0.0/16
.TP
Visas ðîs komandas ir vienâdas. Ja jûs izmantojat *, tad vairâkumâ shell`os nepiecieðams tâs atdalît ar ' vai apostrofu. Vçl viens piemçrs: Ja jûs norâdat adresi ðâdâ formâtâ '*.*.5.6-7' , tad Nmap noskançs visas ip adreses, kas beidzas ar .5.6 vai .5.7
.SH PIEMÇRI
.Sp
.B nmap -v target.example.com
.Sp
Norâda skançt visus atvçrtos portus hostam target.example.com. Opcija '-v' atïauj novçrot skançðanas procesu detalizçtâk.
.Sp
.B nmap -sS -O target.example.com/24
.Sp
Visi 255 kompji ar C klases adresçm, no kurâm viens ir target.example.com tiks noskançti izmantojot SYN skançðanas metodi. Vçl tiks noteikta OS kas grieþas uz ðîm sistçmâm. Lai izmantotu ðo metodi jums nepiecieðamas root tiesîbas.
.Sp
.B nmap -sX -p 22,53,110,143,4564 "198.116.*.1-127"
.Sp
Nmap skançs pirmo pusi ar adresçm (0-127) katrâ no 255 B klases subnet`iem ar Xmas skançðanas metodi ip zonâ 128.210.*.*. Ðajos hostos tiks konstatçta sshd (22 ports), DNS (53), pop3 (110), imapd (143) un 4564 portu pieejamîba. Vçlçtos pievçrst uzmanîbu faktam, ka Xmas skançðanas metodi nevar izmantot sistçmâm, kuras grieþas uz WinOS, CISCO, IRIX, HP/UX un BSDI.
.Sp
.B nmap -v --randomize_hosts -p 80 \'*.*.2.3-5\'
.Sp
Nmap meklçs visus kompjus ar IP adresçm, kuras beidzas ar .2.3, .2.4 un .2.5. Ja jums ir root tiesîbas, tad jûs varât pie reizes arî noskançt portus izmantojot opciju '-sS'. Jûs varat atrast daudz interesantas sistçmas skançjot diapazonu 127-222.*.*
.Sp
.B host -l company.com | cut \'-d \' -f 4 | ./nmap -v -iL -
.Sp
Atrast eksistçjoðus hostus domçnâ company.com, nodot Nmap to adreses. Ðî komanda strâdâ GNU/Linux OS. Ja izmantojat citu OS jums var bût vajadzîba rakstît to savâdâk.
.SH IESPÇJAMÂS KÏÛDAS
Ja jûs gadîjumâ konstatçjat kâdas kïûdas Nmap darbîbâ, lûdzu paziòojiet par to autoram
.SH AUTORS
.Sp
Fyodor
.I <fyodor@insecure.org>
.I http://www.insecure.org/nmap/
.Sp
.I nmap
is (C) 1995-2001 by Insecure.Com LLC
.Sp
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation;
Version 2. This guarantees your right to use, modify, and
redistribute Nmap under certain conditions. If this license
is unacceptable to you, Insecure.Org may be willing to sell
alternative licenses (contact fyodor@insecure.org).
.Sp
Source is provided to this software because we believe users
have a right to know exactly what a program is going to do
before they run it. This also allows you to audit the
software for security holes (none have been found so far).
.Sp
Source code also allows you to port Nmap to new platforms, fix bugs,
and add new features. You are highly encouraged to send your changes
to fyodor@insecure.org for possible incorporation into the main
distribution. By sending these changes to Fyodor or one the
insecure.org development mailing lists, it is assumed that you are
offering Fyodor the unlimited, non-exclusive right to reuse, modify,
and relicense the code. This is important because the inability to
relicense code has caused devastating problems for other Free Software
projects (such as KDE and NASM). Nmap will always be available Open
Source. If you wish to specify special license conditions of your
contributions, just say so when you send them.
.Sp
This program is distributed in the hope that it will be useful, but
.B WITHOUT ANY WARRANTY;
without even the implied warranty of
.B MERCHANTABILITY
or
.B FITNESS FOR A PARTICULAR PURPOSE.
See the GNU
General Public License for more details (it is in the COPYING file of
the
.I nmap
distribution).
.Sp
It should also be noted that Nmap has been known to crash
certain poorly written applications, TCP/IP stacks, and even
operating systems.
.B Nmap should never be run against mission critical systems
unless you are prepared to suffer downtime. We acknowledge
here that Nmap may crash your systems or networks and we
disclaim all liability for any damage or problems Nmap could
cause.
.Sp
Because of the slight risk of crashes and because a few black hats like
to use Nmap for reconnaissance prior to attacking systems, there are
administrators who become upset and may complain when their system is
scanned. Thus, it is often advisable to request permission before
doing even a light scan of a network.
.Sp
Nmap should never be run with privileges (eg suid root) for security
reasons.
.Sp
This product includes software developed by the Apache Software
Foundation (http://www.apache.org/). The
.I Libpcap
portable packet capture library is distributed along with nmap.
Libpcap was originally copyrighted by Van Jacobson, Craig Leres and
Steven McCanne, all of the Lawrence Berkeley National Laboratory,
University of California, Berkeley, CA. It is now maintained by
http://www.tcpdump.org .
.Sp
Latviski manuâli pârtulkojis m|sc (misc@inbox.lv)
(Var gadîties daþi gïuki tekstâ, taèu ko lai dara, ja latvieðu valodâ nav normâli datortermini.)

View file

@ -1,436 +0,0 @@
.\" Á Lietuviø kalbà iðvertë
.\" Aurimas Mikalauskas <inner@crazy.lt>
.\" 2001 03 17
.de Sp
.if n .sp
.if t .sp 0.4
..
.TH NMAP 1
.SH PAVADINIMAS
nmap \- tinklo tyrinëjimo árankis bei saugumo skeneris
.SH SINTAKSË
.B nmap
[skanavimo tipas(ai)] [opcijos] <hostas/tinklas #1 ... #n>
.SH APIBÛDINIMAS
.I nmap'as
yra sukurtas tam, kad leistø sistemø
administratoriams bei smalsiems individams skanuoti
didelius tinklus, siekiant nustatyti kokie hostai
yra veikiantys ir kokias paslaugas jie siûlo.
.I nmap'as
turi be galo daug skanavimo technologijø,
tai: UDP, TCP connect(), TCP SYN (pusiau atviras),
ftp proxy (bounce ataka), Reverse-ident,
ICMP(ping sweep), FIN, ACK sweep, Xmas Tree, SYN sweep,
bei Null skan'as.
.I Skanavimo Tipai
sekcijoje rasite apie tai smulkesnës informacijos.
nmap'as taip pat turi nemaþai paþangiø savybiø, tokiø
kaip nutolusio kompiuterio (toliau vadinamo 'remote')
(O)peracinës (S)istemos nustatymas per TCP/IP
fingerprintinima, stealth (vogtinis) skanavimas,
dinaminës pauzës ir retransimisijos skaièiavimai,
lygiagretusis skanavimas , nepasiekiamø host'ø nustatymas
skanuojant lygiagreèiu skanavimo metodu, decoy skanavimas,
filtruojamø portø nustatymas, tiesioginis RPC skanavimas,
fragmentinis skanavimas, bei labai lankstus taikinio
ir portø nurodymas.
.PP
nmap'o autorius stengiasi kaip galima daugiau ávairiø
nmap'o galimybiø suteikti ne tik root vartotojui, bet ir
paprastam sistemos vartotojui, deja daugëlis kritiniø
sistemos branduolio (kernel) interfeisø (tokiø kaip
"raw socket'ai") reikalauja root'o privilegijø, todël
nmap'as turëtø bûti naudojamas root'u kai tik ámanoma.
.PP
nmap'o naudojimo rezultatas daþniausiai bûna
paprasèiausias sàraðas ádomiø portø, rastø skanuojamoje
maðinoje(se). Nmap'as visada parodo kokià paslaugà (service)
teikia portas, jo numerá, bûsenà bei protokolà. Bûsanà
nusako vienas ið trijø þodþiø: "open", "filtered", "unfiltered".
"open" (atviras) reiðkia, kad taikinys leis prisijungti prie
ðito porto. "filtered" (filtruojamas) reiðkia, kad firewall'as
(ugnies siena), filtras ar dar kaþkoks ádomus árankis dengia
portà, dël to nmap'as tiklsiai negali nustatyti ar portas
atviras. "unfiltered" (nefiltruojamas) parodo, kad portas
yra tikrai "closed" (uþdarytas) ir nera dengiamas jokio
firewall'o/filtro. Nefiltruojamas portas yra gan áprastas
atvëjis ir yra rodomas tik tuo atveju, kai dauguma ið skanuotø
portø yra filtruojami.
.PP
Priklausomai nuo to, kokios opcijos naudojamos, nmap'as
taip pat gali parodyti ir nutolusio kompiuterio: (O)peracinæ
(S)istemà, TCP susekamumà, vartotoju vardus, kuriems priklauso
tam tikri procesai, DNS vardus ir dar vienà kità.
.SH OPCIJOS
Prasmingos opcijos visos gali bûti raðomos kartu (t.y. vienoje
eilutëje).
.I nmap'as
stengsis pasakyti, kokias klaidas esate padaræ
(aiðku jei esate :).
.Sp
Jei esate nekantrus, galite iðkarto ðoktelti á sekcijà
.I pavyzdþiai
gale dokumento, kur gan aiðkiai parodo naudojimà. Taip pat
galite paleisti
.B nmap -h
ir pamatysite pagrindines opcijas, su trumpais apraðymais.
.TP
.B SKANAVIMØ TIPAI
.TP
.B \-sT
paprasèiausias TCP connect() skanavimas. Jûs bandote prisijungti
prie kiekvieno porto ið eilës. Jei portas klausosi, nmap'as
prisijungia prie jo, taigi jei host'as logina, jis matys, kad
bandote jungtis. Ðis metodas yra tiksliausias, bet rekomenduoèiau
já naudoti tik tuo atveju, jei skanuojate savo ar draugo
kompiuterá, t.y. toká, dël kurio vëliau tikrai nesusilauksite
nemalonumø.
.TP
.B \-sS
TCP SYN skanavimas, kitaip dar daþnai vadinamas kaip
"pusiau-atviras" skanavimas, nes nëra padaromas TCP prisijungimas.
Jûs paprasèiausiai nusiunèiate TCP SYN paketukà kaip kad norëdamas
prisijungti ir laukiate atsakymo. Pakankamai neblogas metodas,
bet jei yra filtruojamø portø (pvz. pastatytas firewall'as) ir
host kompiuteris juos logina, - bûsite pastebëtas.
.TP
.B \-sF \-sX \-sN
Stealth FIN, Xmas Tree bei Null skanavimo reþimai. Tai yra ðiek
tiek saugesni skanavimo bûdai nei TCP SYN (pastebimumo
atþvilgiu), bet deja nei vienas ið jø neveikia M$ sistemoms.
Ið kitos pusës, tai nebloga priemonë, kurios pagalba galima
nustatyti ar tai M$ sistema ar ne, t.y. jei -sF -sX arba -sN
parodo, kad visi portai uþdaryti, o -sS rodo kelis atvirus
portus, taikinys greièiausiai windows dëþutë.
.TP
.B \-sP
Tai paprasèiausias ping'as, kuris parodo kurie hostai tinkle
yra gyvi. Atliekama paprasèiausiai siunèiant ICMP echo praðymà
(request). Deja kai kurie saitai (kaip mail.takas.lt) blokuoja
praðymus. Kad ið tikro ásitikinti, ar hostas negyvas, nmap'as
nusiunèia ir TCP ack paketukà á 80 (standartiðkai) portà. Jei
gauname atgal RST, reiðkia hostas gyvas. Pagal standartà
(r00t'ui) nmap'as naudoja abu ICMP bei ACK metodus. Pakankamai
efektyvu, nes vienu metu galite patikrinti #n hostø.
.TP
.B \-sU
UDP skanavimas. Naudojamas tam, kad nustatyti kokie UDP (User
Datagram Protocol, RFC 768) portai yra atviri.
.Sp
Kai kurie mano, kad UDP skanavimas yra beprasmiðkas, bet já
prisiminti verta vien dël vienos Solaris rcpbind skylës. Taip
pat yra cDc Back Orifice trojanas, kuris atsidaro UDP portà ant
window'sø. Gaila tik, kad UDP skanavimas kartais gali trukti
labai ilgai.
.TP
.B \-SO
IP protokolo skanavimas. Ðis metodas yra naudojamas tam, kad
nustatyti kokius protokolus naudoja jûsø taikinys. Technika
labai paprasta: siunèiami IP paketai be jokio protokolo header'io
á visus nurodytus protokolus. Jeigu pvz gauname "ICMP protocol
unreachible" (ICMP protoklolas nepasiekiamas) atsakymà, vadinasi
protokolas nenaudojamas, prieðingu atveju skaitoma, kad jis
atviras.
.TP
.B \-sA
ACK skanavimas: ðitas metodas paprastai yra naudojamas tam,
kad iðsiaiðkinti firewall'ø (ugnies sinø) taisykles. Jis gali
padëti nustatyti ar firewall'as tikras, ar paprasèiausias
paketø filtras, blokuojantis áplaukianèius SYN paketukus.
.TP
.B \-sW
Window skanavimas. Ðis skanavimo bûdas labai panaðus á ACK
skanà, skirtumas tik tas, kad ðis skanavimo metodas kartais
parodo ir atvirus portus (ACK jø nerodo).
.TP
.B \-sR
RPC skanavimas. Praskanavus parodoma kokia programa ir jos versija
laiko RPC portus atvirus.
.TP
.B \-b <ftp relay hostas>
Dar vienas pakankamai originalus skanavimo bûdas, t.y.
pasinaudojant ftp proxy serveriu. <ftp relay host'o> formatas
gali bûti useris:passwordas@serveris:portas . Viskas iðskyrus
serverá yra nebûtina.
.TP
.B BENDROSIOS OPCIJOS
Nei viena ið ðiø nëra bûtina, bet kai kurios gali bûti pakankamai
naudingos
.TP
.B \-P0
Skanuoti ið kart, nepabandþius ið pradþiø ping'int serverio.
Tai naudinga skanuojant tokius kaip mail.takas.lt, kurie
neatsakinëja á ICMP echo request'us. Tokiu atveju reikëtø
naudoti
.B \-P0
arba
.B \-PT80.
.TP
.B \-PT
Naudoti TCP "ping'à" vietoje standartinio ICMP ping'o. Naudinga
tokiais atvejais, kai serveris neatsakinëja i ICMO echo
request'us. Taip pat galima naudoti kartu su postu (-PT<portas>).
.TP
.B \-PS
Naudoja SYN (prisijungimo praðymà) vietoje ACP
.TP
.B \-PI
Paprastas ping'as + suranda subnet'o broadcast'u adresus tinkle.
.TP
.B \-PB
Standartinis ping'inimo metodas: naudoja ACP bei ICMP ping'us
kartu. Geriausia bûdas patikrinti firewall'us, kurie blokuoja
vienà ið jø.
.TP
.B \-O
Viena geriausiø nmap'o ypatybiø - serverio OS'o atpaþinimas
pagal jo fingerprint'us (jei atvirai, pats nelabai þinau kas
per biesas tie fingerprintai).
.TP
.B \-I
Ájungiamas TCP reverse ident skanavimas. Kaip 1996 Dave'as
Goldsmith'as pastebëjo, ident protokolas (rfc 1413) leidþia
pamatyti, kokiam useriui priklauso procesas, kuris naudoja
TCP susijungima. Taigi, tu gali pvz prisijungti prie 80 porto
ir tada pasinaudojes inentd'u, gali pamatyti ar http serveris
yra paleistas root'u ar kokiu kitu userium.
.TP
.B \-f
Skanuojant SYN (-sS) , FIN (-sF), XMAS (-sX) arba NULL (-sN)
metodu, naudojami labai maþyèiai sufragmentuoti IP paketai.
.TP
.B \-v
Verbose mode. Labai rekomenduojama opcija, ypaè jei norit geriau
suprasti kas èia dedasi. naudodamas ðià opcijà du kartus, efektas
bus dar geresnis. Gali naudoti ir dvigubà -d, efektas - nerealus.
Nepabandæs, nesuprasi.
.TP
.B \-h
Jei norite kad nedidelis langelis jums trumpai primintu kelias
pagrindines komandas, ði opcija - jums.
.TP
.B \-oN <logas>
Viskas, kas vyksta ekrane bus loginama á "logas" failà.
.TP
.B \-oX <logas>
Skanavimo rezultatai iðsaugomi XML formatu á failà, kurá nurodote
kaip argumentà ðiai opcijai.
.TP
.B \-oG <logas>
Ði opcija iðsaugo skanavimo rezultatus taip, kad jûs juos galetumëte
lengvai grepinti. Ðis gan primityvus formatas iðsaugo viskà vienoje
eilutëje.
.TP
.B \-oS <logas>
Loginama á failà "logas" "skipt kiddie" formatu.
.TP
.B \--resume <logas>
Skanavimas, kuris buvo nutrauktas su ^C, gali bûti pratæstas,
su sàlyga, kad viskas buvo loginama su -oN opcija.
Daugiau jokie parametrai negali bûti pateikti (jie bus tokie,
kokie buvo naudojami loginant). nmap'as pradës skanuoti nuo
sekanèios maðinos, po tos, kuri paskutinë buvo sëkmingai
nuskanuota..
.TP
.B \-iL <failas>
Nuskaito hostus (IP adresus) ið failo "failas". Hostai faile turi
bûti atskirti tarpais, TAB'ais arba atskirose linijose. deja
opcijø nurodyti jokiø negalite tame faile, uþtat yra galimybë jas
nurodyti komandinëje eilutëje.
.TP
.B \-iR
Ðita opcija priverèia nmap'à generuoti atsitiktinius hostus. Jei
kada neturësite kà veikti, pabandykite `nmap -sS -iR -p 80', kad
surastumëte keletà www serveriø.
.TP
.B \-p <portai>
Galite nurodyti kurá/kuriuos portus tikrinti. pvz. -p 110
patikrins ar hostas turi pop3 serverá, taip pat galite miðriai
nurodinëti portus:
-p 21,60-90,1243 -- 21, visi nuo 60 iki 90 bei 1243 portas
-p 1- -- visi portai nuo 1 iki 65535.
.TP
.B \-F
Greitasis metodas. Skanuoja tik tuos portus, kurie nurodyti nmap'o
services faile (pagal default'à - /usr/local/lib/nmap/nmap-services)
.TP
.B \-D <decoy1 [,decoy2][,decoyN][,ME]>
Decoy skanavimas priverèia skanuojamà host'à manyti, kad já vienu
metu skanuoja visi nurodyti decoy'iai. Hostø logai gali parodyti
5-10 skanavimø ið unikaliø IP adresø, bet kuris ið jø skanuoja
ið tikro jie pasakyti negalës.
.Sp
Atskirk kiekvienà decoy'á kableliais (be tarpo) ir gali tarp jø
áterpti 'ME' kaip vienà ið decoy'iø. nmap'as ten áterps tavo
adresà. Jei ðito nenurodysi, nmap'as atsitiktinai iðrinks tau
vietà. Tiesa, jei 'ME' áraðysi 6-oje ar dar vëlesnëje vietoje,
kai kurie skanavimø detektoriai (tokie kaip Solar Designer'io
nepakartojamas scanlog daemon'as) gali tavo IP iðviso neparodyti.
.Sp
Nepamirðk, kad hostai, kuruos naudosi kaip decoy'ius, turi bûti
gyvi, kitaip gali uþ-SYN-flood'inti taikiná, o be to labai
nesunku bus surasti skanuotojà, jei jis bus vienintelis gyvas
visame tinkle.
.Sp
Atkreipk dëmesá ir á tai, kad kai kurie (durnesni) portø
skanavimø detektoriai gali aplamai skanuojantiems host'ams
uþdrausti priëjimà. Ásivaizduok, kas gali nutikti, jei vienà
ið decoy'iø nurodytum "localhost'à" :)
.Sp
Decoy skanavimas gali bûti naudojamas kartu su ping (naudojant
ICMP, SYN, ACK, ar dar kà nors) arba tikru portø skanavimu bei
bandant surasti remote OS'à ( -O ).
.TP
.B \-S <IP_adresas>
Kartais nmap'as gali nerasti jûsø adreso. Tokiu atveju galite
naudoti -S opcijà su jûsø IP adresu bei interfeisu, kuriuo
siûsite paketus.
.TP
.B \-e <interfeisas>
Nurodo nmap'ui kokiu interfeisu siøsti paketus.
(lo, ppp0, eth0 ir etc.)
.TP
.B \-g <portas>
Nurodo ið kokio porto skanuoti. Daugelis firewall'ø bei filtrø
padaro iðimtis DNS (53) bei FTP-DATA (20) paketams.
.TP
.B \-n
Liepia nmap'ui net nemëginti rezolvinti ip adresø i jø vardus,
nes daþnai tai bûna labai lëtas procesas ir stabdo nmap'o darbà.
.TP
.B \-R
Prieðingai nei -n opcija, -R liepia nmap'ui visada pamëginti
iðrezolvinti ip adresà.
.TP
.B \-r
Nurodo nmap'ui portus skanuoti
.B NE
atsitiktine tvarka.
.TP
.B --randomize_hosts
Nmap'as atsitiktine tvarka iðmaiðo kiekvienà grupæ ið daugiau nei
2048 hostø prieð pradedant juos skanuoti. Tai ðiek tiek suklaidina
ávairius tinklo stebejimo árankius.
.TP
.B \-M <maximalus susijungimu skaicius>
Nustato naksimalø susijungimu skaièiø, kuris bus naudojamas
paralelëje su TCP(standartiðkai) skanavimu.
.TP
.B LAIKO APRIBOJIMAI
.TP
.B -T <Paranoid|Sneaky|Polite|Normal|Aggressive|Insane>
Paranoid - pats lëèiausias skanavimo bûdas, Insane - pats
greièiausias, deja ne toks tikslus, ypaè jei tinklas lëtas.
Vietoj þodþiø galite naudoti ir -T (0-5), kur 0 == Paranoid,
1 == Sneaky ir t.t.
.TP
.B --host_timeout <milisekundës>
Nurodo kiek laiko nmap'as gali skanuoti duotàjá IP. Laikas turi
bûti nemaþiau nei 200 milisekundþiø.
.TP
.B --max_rtt_timeout <milisekundës>
Kiek daugiausia laiko nmap'as gali laukti atsakymo ið skanuojamo
IP.
.TP
.B --scan_delay <milisekundës>
Nustato minimalø laiko tarpà, kuri nmap'as turi laukti tarp
bandymø. Tai naudingiausia siekiant sumaþinti tinklo apkrovimà.
.SH TAIKINIO NURODYMO BÛDAI
Viskas, kas nëra opcijos, nmap'e suprantama kaip taikinys.
Paprasèiausias bûdas yra nurodyti konkreèius IP arba hostus.
Jeigu norite nuskanuoti IP adresø subnet'à, galite pridëti
.B /maskæ
hostname'ui ar IP adresui.
.B Maskë
turi bûti tarp 0
(norint nuskanuoti visà internetà) ir 32 (norint nuskanuoti
konkretø host'à/IP. Naudok /24 'C' klasës adresø skanavimui
bei /16 'B' klasës adresø skanavimui.
.Sp
nmap'as taip pat turi gan patogià galimybæ nustatinëti IP
adresus sàraðais/atstumais. pvz. gali nuskanuoti 'B' klasæ
uþraðydamas 128.210.*.* arba 128.210.0-255.0-255 arba dar
128.210.0-50,51-255.1,2,3,4,5-255 . Manau kad tai pakankamai
patogu ir nesudëtinga.
.SH KELETAS PAVYZDÞIØ
.Sp
.B nmap -sX -e lo -P0 -S 127.0.0.3 localhost
.Sp
Pasinaudodamas Xmas Tree skanavimo metodu, apsimetinëdamas,
kad esu 127.0.0.3 Loopback protokolu skanuoju savo localhost'à
Ðtai kaip atrodo ipchains'ø log'as:
.Sp
Packet log: input DENY lo PROTO=6 127.0.0.3:37009 127.0.0.1:139
L=40 S=0x00 I=53682 F=0x0000 T=41 (#1)
.Sp
kaip matote, kernelis yra ásitikinæs, kad já skanuoja ið 127.0.0.3
o tai ir yra vienas svarbiausiø uþdaviniø - likti nematomiems :)
.Sp
.B nmap -sS -O target.example.com/24
.Sp
stealth SYN metodu nuskanuoja visas 255 maðinas, esanèias
target.example.com 'C' klasëje. Taip pat bando nustatyti
kiekvieno ið jø operacinæ sistemà.
.Sp
.B host -l company.com | cut '-d ' -f 4 | ./nmap -v -iL -
.Sp
suranda visus *.company.com hostus ir atiduoda juos nmap'ui,
kuris savo ruoþtu ásijungæs verbose mode visus juos nuskanuoja.
.Sp
.B nmap -sN -D microsoft.com,mail.takas.lt,ME -oN /root/crazy -p 1-1024 -O crazy.com
.Sp
skanauoja Null skanavimo reþimu, panaudoja du decoy adresus,
viskà logina á /root/crazy failà, skanuoja nuo 1 iki 1024 crazy.com
portus bei stengiasi atspëti crazy.com serverio operacinæ sistemà
.SH BUGAI
Vabalëliai? Kokie dar vabalëliai? Na.. jei rasit kokiø, bûtinai
siûskit autoriui: <fyodor@insecure.org> . Pachai taip pat labai
laukiami. Taip pat nepamirðkite siûsti OS'ø fingerprintus, kad
nmap'o autoriai galëtø plësti duom. bazæ. Apie tai smulkiau
galite rasti docs/nmap-fingerprinting-article.txt dokumente
arba nmap'o puslapyje: http://www.insecure.org/nmap
.SH AUTORIUS
.Sp
Fyodor
.I <fyodor@insecure.org>
.SH IÐVERTË
.Sp
Aurimas Mikalauskas
.I <inner@crazy.lt>
.Sp
.SH PLATINIMAS
.Sp
Naujausià
.I nmap'o
versijà visada galite rasti èia:
.Sp
.I http://www.insecure.org/nmap/
.Sp
.I nmap
is (C) 1997,1998,1999,2000 by Fyodor (fyodor@insecure.org)
.Sp
.I libpcap'as
yra taip pat platinamas kartu su nmap'u. Autorines
teises á já turi Van Jacobson, Craig Leres ir Steven McCanne,
visi ið Lawrence Berkeley nacionalinës Laboratorijos Kalifornijos
Universiteto, Berkeley, CA. Versija platinama su nmap'u gali
bûti perraðinëjama. Sourcus galit parsisiûsti ið
.I ftp://ftp.ee.lbl.gov/libpcap.tar.Z
.Sp
.SH PABAIGAI
Dþiaugiuosi, kad pagaliau pasiekëte galà. Dabar jau galite skaityti
save kvalifikuotu nmap'o guru.
.Sp
beje, jei norite kà nors pridëti ar pakeisti ðiame dokumente,
arba (neduok Dieve) radot kokiø tai bug'u, raðykit man adresu,
pateiktu sekcijoje
.B iðvertë.
Ðiaip ðitas manualas abejoju ar bus atnaujinamas,
bet paèià naujausià nmap-lt-HOWTO visada galite
rasti mano puslapyje:
.Sp
.I http://crazy.lt/~inner

View file

@ -1,8 +0,0 @@
Content-type: text/html
<HTML><HEAD><TITLE>man2html: bad invocation</TITLE></HEAD>
<BODY>
<H1>man2html: bad invocation</H1>
Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]
or: man2html -r [filename]
</BODY></HTML>

View file

@ -1,8 +0,0 @@
Content-type: text/html
<HTML><HEAD><TITLE>man2html: bad invocation</TITLE></HEAD>
<BODY>
<H1>man2html: bad invocation</H1>
Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]
or: man2html -r [filename]
</BODY></HTML>

View file

@ -1,8 +0,0 @@
Content-type: text/html
<HTML><HEAD><TITLE>man2html: bad invocation</TITLE></HEAD>
<BODY>
<H1>man2html: bad invocation</H1>
Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]
or: man2html -r [filename]
</BODY></HTML>

View file

@ -1,8 +0,0 @@
Content-type: text/html
<HTML><HEAD><TITLE>man2html: bad invocation</TITLE></HEAD>
<BODY>
<H1>man2html: bad invocation</H1>
Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]
or: man2html -r [filename]
</BODY></HTML>

View file

@ -1,8 +0,0 @@
Content-type: text/html
<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=windows-1257"><TITLE>man2html: bad invocation</TITLE></HEAD>
<BODY>
<H1>man2html: bad invocation</H1>
Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]
or: man2html -r [filename]
</BODY></HTML>

View file

@ -1,8 +0,0 @@
Content-type: text/html
<HTML><HEAD><TITLE>man2html: bad invocation</TITLE></HEAD>
<BODY>
<H1>man2html: bad invocation</H1>
Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]
or: man2html -r [filename]
</BODY></HTML>

View file

@ -1,8 +0,0 @@
Content-type: text/html
<HTML><HEAD><TITLE>man2html: bad invocation</TITLE></HEAD>
<BODY>
<H1>man2html: bad invocation</H1>
Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]
or: man2html -r [filename]
</BODY></HTML>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,412 +0,0 @@
.\"Traduzido para a lingua Portuguesa
.\"Antônio Pires de Castro Jr. <apcastro@ic.unicamp.br>
.\"<apcastro@cultura.com.br>, <apcastro@ondefor.com.br>
.\"em 17/10/2000
.\"This definition swiped from the gcc(1) man page
.de Sp
.if n .sp
.if t .sp 0.4
..
.TH NMAP 1
.SH NOME
nmap \- Ferramenta de exploração de rede e scanner de segurança.
.SH SYNOPSIS
.B nmap
[Tipo(s) de Scan] [Opções] <computador ou rede #1 ... [#N]>
.SH DESCRICAO
.I Nmap
é projetado para permitir aos administradores de sistemas e indivíduos curiosos explorar grandes redes para determinar quais computadores estão ativos e quais serviços são fornecidos.
.I Nmap
suporta um grande número de técnicas de scan, como: UDP, TCP connect(), TCP SYN (half open), ftp proxy (bounce attack), Reverse-ident, ICMP (ping sweep), FIN, ACK sweep, Xmas Tree, SYN sweep, IP Protocol, and Null scan. Veja as seções de
.I Tipos de Scan
para maiores detalhes. Nmap, também, oferece um número de avançadas características, como: detecção remota do SO via TCP/IP fingerprinting, stealth scanning, dynamic delay e retransmission calculations, scanning paralelo, detecção de hosts inativos através de pings paralelos, decoy scanning, detecção de portas filtradas, scanning direto de RPC (não-portmapper), fragmentation scanning e flexibilidade do alvo e especificação de porta.
.PP
Esforços significantes tem sido gastos na performance do nmap para usuários comuns, usuários não-root. Infelizmente, várias interfaces críticas do kernel (como os sockets raw) requerem privilégios de root. Nmap deve ser executado como root sempre que possível.
.PP
O resultado da execução do nmap é usualmente uma lista de portas
interessantes na(s) máquina(s) sendo explorada(s). Nmap sempre fornece o nome do serviço, o número, o estado, e o protocolo das portas "bem conhecidas". O estado pode ser tanto 'aberto' (open), 'filtrado'(filtered) ou não filtrado (unfiltered). Aberto significa que a máquina alvo aceitará (accept()) conexões na porta. Filtrado significa que o firewall, filtro ou outro obstáculo da rede está cobrindo a porta e prevenindo o nmap de determinar quando a porta está aberta. Não filtrado significa que a porta é conhecida pelo nmap para estar fechada e nenhum firewall/filtro parece estar interferindo com a tentativa de determina-lá pelo nmap. Portas não filtradas são um caso comum e são mostradas, somente, quando a maioria das portas exploradas estão no estado filtrado.
.PP
Dependendo da opção usada, o nmap pode, também, reportar as seguintes características do host remoto: SO em uso, sequenciabilidade do TCP, os nomes dos usuários executando os programas em determinadas portas, o nome DNS, quando um host tem um endereco de smurf, e várias outras.
.SH OPÇÕES
Opções que juntamente fazem sentido podem geralmente ser combinadas. Várias opções são específicas para certos modos de scan.
.I Nmap
tenta capturar e avisar o usuário sobre erros ou combinações não suportadas de opções.
.Sp
Se você está impaciente, você pode ir direto para a seção de
.I exemplos
no final, os quais demonstram o uso comum do nmap. Você pode, também, executar
.B nmap -h
para uma rápida página de referência, a qual lista todas as opções.
.TP
.B TIPOS DE SCAN
.TP
.B \-sT
TCP connect() scan: Esta é a mais básica forma de TCP scanning. A chamada de sistema, connect(), provida pelo seu sistema operacional é usada para abrir uma conexão para toda porta interessante na máquina. Se a porta está no estado listening, connect() irá ter sucesso, por outro lado a porta não será alcançada. Uma grande vantagem desta técnica é que você não precisa de nenhum privilégio especial. Qualquer usuário em UNIX está livre para usar esta chamada.
.Sp
Este tipo de scan é facilmente detectável pelo log do host alvo, o qual mostrará o grupo de conexões e mensagens de erro para os serviços os quais aceitam, accept(), a conexão somente para tê-la imediatamente desligada.
.TP
.B \-sS
TCP SYN scan: Esta técnica é muito conhecida como "half-open" scanning,
porque não abre uma conexão TCP completa. É enviado um pacote com o flag SYN
setado, como se fosse abrir uma conexão real e é esperado pela resposta. Uma
resposta SYN/ACK indica que a porta está no estado listening. O flag RST é
uma indicação de estado não listening. Se o flag SYN/ACK é recebido, o flag
RST é imediatamente enviado para encerrar a conexão (atualmente o núcleo do SO faz isso por nós). A principal vantagem desta técnica de scanning é que poucos sites irão registra-lá no arquivo de log. Desafortunadamente é necessário privilégios de super usuário (root) para construir estes pacotes SYN customizados.
.TP
.B \-sF \-sX \-sN
Modos Stealth FIN, Xmas Tree, ou Null scan: Algumas vezes nem mesmo a
técnica SYN scanning é clandestina suficiente. Vários firewalls e filtros de pacotes observam por SYNs para portas restritas, e programas como Synlogger e Courtney estão disponíveis para detectar este tipo de scan. Por outro lado, scans avançados (stealth FIN, Xmas Tree, ou Null scan), podem ser capazes de passar através destes filtros sem serem molestados.
.Sp
A idéia é que portas fechadas são exigidas por responder aos pacotes de teste com um RST, enquanto portas abertas precisam ignorar os pacotes em questão (veja RFC 793 pp 64). A técnica de scan FIN utiliza o limitado pacote FIN como teste, enquanto a técnica de scan Xmas Tree seta os flags FIN, URG e PUSH. A técnica de scan Null não seta nenhum flag. Desafortunadamente a Microsoft (como usual) decidiu completamente ignorar o padrão e faz as coisas do seu próprio jeito. Então este tipo de scan não funcionará contra sistemas executando Windows95/NT. Do lado positivo, está é uma ótima maneira de distinguir entre duas plataformas. Se o scan encontrar portas abertas, é possível saber que a máquina não utiliza o Windows. Se as técnicas de scan -sF, -sX ou -sN mostram todas as portas fechadas, mesmo assim a técnica de scan SYN (-sS) mostra portas sendo abertas, você poderá estar olhando para uma máquina Windows. Esta é a maneira menos usada pelo nmap para testar a detecção do SO. Exitem, também, alguns outros sistemas que são descobertos da mesma maneira que descobrimos o windows. Estes incluem Cisco, BSDI, HP/UX, MVS, and IRIX. Todos acima enviam resets (RST) de portas abertas quando estes devem, somente, descartar o pacote.
.TP
.B \-sP
Ping scanning: Algumas vezes você somente quer saber quais os hosts da rede
estão ativos. O Nmap pode fazer isso enviando um pacote de requisição ICMP
(ICMP echo request) para todo endereço IP especificado da rede. Os hosts que
respondem estão vivos. Desafortunadamente, vários sites, como a
microsoft.com, bloqueiam pacotes de requisição ICMP (echo request). Então, o
nmap pode, também, enviar um pacote ACK TCP para (por definição) a porta 80.
Se nós pegarmos o flag RST novamente, a máquina esta viva. A terceira técnica envolve o envio de pacotes SYN e a espera pelo pacote com o flag RST ou os flags SYN/ACK. O método connect() é usado por usuários comuns (não root).
.Sp
Por definição (para super usuários), o nmap usa tanto as técnicas do ICMP e a do flag ACK em paralelo. Você pode mudar as
.B \-P
opções descritas mais a frente.
.Sp
Note que o ping, por definição, é feito de qualquer forma, e somente os hosts que respondem são scanneados. Somente use esta opção se você desejar vasculhar
.B sem
fazer qualquer scan real de portas.
.TP
.B \-sU
UDP scans: Este método é usado para determinar quais portas UDP (User Datagram Protocol, RFC 768) estão abertas no host. A técnica implica em enviar 0 bytes de dados de pacotes UDP para cada porta da máquina alvo. Se nós recebermos uma mensagem de ICMP port unreachable (porta ICMP não alcançada), então a porta está fechada. Por outro lado nós assumimos que a porta está aberta.
.Sp
Várias pessoas pensam que a técnica UDP scanning é supérfluo. Eu, usualmente, lembro desta como uma recente falha no rpcbind do Solaris. O Rpcbind pode ser encontrado escondido em uma porta UDP não documentada em algum lugar acima de 32770. Então não importa que a porta 111 esteja bloqueada por um firewall. Porém, você pode encontrar quais as portas altas, maiores de 30.000, que estão no estado listening? Com o scanner UDP você pode! Existe, também, o programa cDc Back Orifice backdoor o qual se oculta em uma porta UDP configurável em máquinas Windows. Alguns serviços comumente vulneráveis que utilizam o UDP são: snmp, tftp, NFS, etc.
.Sp
Desafortunadamente UDP scanning é algumas vezes, dolorosamente, vagarosa desde que a maioria dos hosts implementam a sugestão da RFC 1812 (seção 4.3.2.8) de limitar a taxa de mensagens de erro ICMP. Por exemplo, o núcleo do Linux (em net/ipv4/icmp.h) limita a geração de mensagens de destination unreachable para 80 por 4 segundos, com 1/4 segundos de penalidade se esta for excedida. O Solaris tem um limite muito mais restrito (mais ou menos 2 mensagens por segundo) e assim gasta um tempo maior para realizar o scan.
.I Nmap
detecta esta taxa limitante e reduz conformemente, por outro lado inunda a rede com pacotes sem uso que irão ser ignorados pela máquina alvo.
.Sp
Como é típico, a Microsoft ignorou a sugestão da RFC e não parece ter feito nenhuma taxa limitante por completo no Win95 e no NT. Então é possível scannear,
.B rapidamente
, todas as portas de 64K das máquinas windows. Beleza!
.TP
.B \-sO
Scan do Protocolo IP: Este método é usado para determinar quais protocolos IPs são usados no host. A técnica consiste em enviar pacotes IP raw sem promover nenhum cabeçalho para cada protocolo específico na máquina alvo. Se nós recebermos uma mensagem do protocolo ICMP unreachable, então o protocolo não está sendo usado. Por outro lado nós assumimos que está aberto. Note que vários hosts (AIX, HP-UX, Digital UNIX) e firewalls podem não enviar mensagens de protocolo unreachable. Assim faz parecer que todos os protocolos estão "abertos".
.Sp
Isso porque a técnica implementada é muito similar ao scanning da porta UDP, onde a taxa limite de ICMP pode ser aplicada também. Porém o campo do protocolo IP tem somente 8 bits, então no máximo 256 protocolos podem ser testados, os quais devem ser possíveis de serem testados em tempo razoável.
.TP
.B \-sA
ACK scan: Este método avançado é usualmente usado para mapear o conjunto de regras de um firewall. Em particular, esta pode ajudar a determinar quando um firewall é stateful ou somente um filtro de pacotes simples que bloqueia pacotes SYN de chegada.
.Sp
Este tipo de scan envia pacotes com o flag ACK setado para uma porta específica. Se um RST voltar, a porta é classificada como "não filtrada". Se não voltar nada ou um ICMP unreachable voltar, a porta é classificada como "filtrada". Note que o
.I nmap
usualmente não imprime portas "não filtradas", obtendo, assim,
.B nenhuma
porta mostrada na saída é usualmente um sinal que todos os testes foram suscedidos (e retornado RSTs). Esta técnica de scan nunca irá, obviamente, mostrar portas no estado "aberto".
.TP
.B \-sW
Window scan: Este scan avançado é muito similar ao ACK scan, exceto que as vezes pode ser possível detectar portas abertas mesmo sendo filtradas, isso devido a anomalia do tamanho da janela TCP reportado por vários sistemas operacionais. Sistemas vulneráveis para isso incluem no mínimo várias versões do AIX, Amiga, BeOS, BSDI, Cray, Tru64 UNIX, DG/UX, OpenVMS, Digital UNIX, FreeBSD, HP-UX, OS/2, IRIX, MacOS, NetBSD, OpenBSD, OpenStep, QNX, Rhapsody, SunOS 4.X, Ultrix, VAX, and VxWorks. Vejam no arquivo, na lista de discussão nmap-hackers, a lista completa.
.TP
.B \-sR
RPC scan. Este método trabalha em combinação com várias técnicas de scan de portas do Nmap. Ele pega todas as portas TCP/UDP encontradas abertas e inunda elas com comandos NULL de programas SunRPC numa tentativa de determinar quando elas são portas RPC, e se são, qual programa e versão dos serviços. Com este método você pode efetivamente obter a mesma informação como se usasse 'rpcinfo -p' mesmo se o portmapper alvo estiver atrás de um firewall (ou protegido pelo TCP wrappers). Decoy não trabalha correntemente com RPC scan, em algum ponto eu posso adicionar o suporte decoy para UDP RPC scans.
.TP
.B \-b <ftp relay host>
FTP bounce attack: Uma interessante "característica" do protocolo ftp (RFC 959) é sustentada para conexões ftp "proxy". Em outras palavras, eu devo ser capaz de conectar do evil.com para um servidor FTP, target.com, e requerer que o servidor envie um arquivo para qualquer lugar na internet! Isto pode ter sido explorado bem em 1985 quando a RFC foi escrita. Porém na internet hoje, nós não podemos ter pessoas hijacking servidores ftp e requisitando que os dados sejam jogados para arbitrários pontos na internet. Como *Hobbit* escreveu em 1995, este protocolo torna inútil "pode ser usado para portar virtualmente não determináveis emails ou news, forjando em servidores vários sites, preenchendo discos, tentando saltar firewalls, e geralmente sendo aborrecido, ficando, assim, difícil seguir a pista ao mesmo tempo." O que nós iremos explorar disto é o scan de portas TCP do servidor "proxy" de ftp. Então você pode conectar a um servidor ftp atrás do firewall, e então scannear portas que estão mais provávelmente bloqueadas (139 é uma boa). Se o servidor ftp permitir ler de e escrever para algum diretório (como /incoming), você pode enviar dados arbitrários para portas que você achar abertas (nmap não faz isso por você).
.Sp
Os argumentos passados para a opção 'b' é o host que você quer usar como proxy, na notação de padrão URL. O formato é:
.I username:password@server:port.
Tudo, menos o
.I server
é opcional. Para determinar quais servidores são vulneráveis para este ataque, você pode ver meu artigo em
.I Phrack
51. A versão atualizada está disponível em
.I nmap
URL (http://www.insecure.org/nmap).
.TP
.B OPÇÕES GERAIS
Nenhuma destas são requeridas, porém algumas podem ser absolutamente proveitosas.
.TP
.B \-P0
Pinga os hosts antes de scanneá-los. Isto permite scannear as redes que não permitem ICMP echo requests (ou responses) através dos seus firewalls. microsoft.com é um exemplo desta rede, e então você deve sempre usar
.B \-P0
ou
.B \-PT80
quando portscanning microsoft.com.
.TP
.B \-PT
Use TCP "ping" para determinar quais hosts estão ativos. Ao invez de enviar pacotes ICMP echo request e esperar pelas respostas, nós enviamos pacotes TCP ACK por toda parte na rede alvo (ou para uma simples máquina) e então esperamos por respostas. Hosts que estão ativos devem responder com um RST. Esta opção preserva a eficiência de somente scannear hosts que estão ativos, enquanto ainda permite scannear redes/hosts que bloquearam pacotes ping. Para usuários não root, é usado o connect(). Para setar a porta destino dos pacotes de teste usem -PT<número da porta>. A porta default é 80, desde que está porta é muitas vezes não filtrada.
.TP
.B \-PS
Está opção usa pacotes com SYN (connection request) ao invez de pacotes com ACK para usuários root. Hosts que estão ativos devem responder com RST (ou, raramente, um SYN|ACK).
.TP
.B \-PI
Está opção usa um pacote ping verdadeiro (ICMP echo request). Esta encontra os hosts que estão ativos e também procura por um endereço de broadcast para a subrede da sua rede. Estes são endereços IPs que são externamente alcançáveis e traduzidos para broadcast de pacotes IP de chegada para uma subrede de computadores. Estes devem ser eliminados se encontrado, como ele permitem por numerosos ataques de negação de serviço (DoS) (Smurf é o mais comum).
.TP
.B \-PB
Este é o tipo de ping default. Ele usa tanto pacotes com ACK (
.B \-PT
) e pacotes ICMP (
.B \-PI
) sweeps em paralelo. Desta maneira você pode obter os firewalls que
filtram cada uma (porém não ambas).
.TP
.B \-O
Esta opção ativa a identificação de hosts remotos via TCP/IP fingerprinting. Em outras palavras, ela usa uma grande quantidade de técnicas para detectar sutilezas na pilha de rede do sistema operacional do computador que você está scanneando. Ele usa estas informações para criar a 'fingerprint' a qual é comparada com sua base de dados de conhecidos fingerprints de SOs (o arquivo nmap-os-fingerprints) para decidir qual o tipo de sistema que você está escanneando.
.Sp
Se o Nmap está desabilitado para resolver o SO da máquina, e as condições são boas (ex. ao menos uma porta aberta), Nmap irá prover a URL que você pode usar para submeter a fingerprint se você conhecer (com certeza) o SO sendo executado na máquina. Por fazer isso você contribui para o conjunto de sistemas operacionais conhecidos pelo nmap e então será mais correto para todos.
.Sp
A opção \-O também possibilita classificar e fazer o prognostico da
sequência TCP. Esta é uma medida que descreve aproximadamente qual a
dificuldade em estabelecer uma conexão TCP forjada contra um host remoto.
Esta é útil para explorar o IP de origem baseado na relação de confiança
(rlogin, firewall filters, etc) ou por esconder a origem do ataque. O número
difficulty mostrado é baseado em uma simples amostra estatística e pode
variar. Este número é geralmente melhor apresentado como uma frase em Inglês como "worthy challenge" ou "trivial joke".
.TP
.B \-I
Esta ativa o scanning do ident reverso TCP. Como notado por Dave Goldsmith em 1996 na mensagem para a Bugtraq, o protocolo ident (rfc 1413) permite revelar o username dos donos dos processos conectados via TCP, mesmo se estes processos não iniciaram a conexão. Então você pode, por exemplo, conectar a porta http e então usar o identd para encontrar quando o servidor está sendo executado como root. Isto pode somente ser feito com uma conexão TCP completa para a porta alvo (ex.: a opção de scanning -sT). Quando
.B \-I
é usada, o identd do host remoto é pesquisado para cada porta aberta encontrada. Obviamente isso não funciona se o host não estiver rodando o identd.
.TP
.B \-f
Esta opção requere os flags SYN, FIN, XMAS, ou NULL scan para usar cuidadosos pacotes IP fragmentados. A idéia é dividir o cabeçalho TCP sobre vários pacotes para ficar difícil para o filtro de pacotes, sistemas de detecção de intrusão, e outros aborrecimentos para detectar o que você está fazendo. Seja cuidadoso com isso! Vários programas tem preocupações lidando com estes cuidadosos pacotes. Enquanto este método não obtem pacotes filtrados e firewalls que enfileram todos os fragmentos IP (como a opção CONFIG_IP_ALWAYS_DEFRAG no kernel do linux), várias redes não conseguem assegurar o golpe de performance que este fato causa, então é melhor deixar este desabilitado.
.Sp
Note que esta opção, ainda, não esta funcionando em todos os sistemas. Esta
funciona bem para o Linux, FreeBSD, e OpenBSD e outras pessoas tem reportado
sucessos com outras variações *NIX.
.TP
.B \-v
Modo Verbose. Esta é uma opção altamente recomendada e fornece mais informações sobre o que esta acontecendo. Você pode usá-la duas vezes para um melhor efeito. Use
.B \-d
em conjunto se você realmente quiser ficar louco com a quantidade de informações na tela!
.TP
.B \-h
Esta cômoda opção mostra uma rápida tela de referência das opções usadas no nmap. Como você deve ter notado, está man page não é exatamente uma 'rápida referência' :o)
.TP
.B \-oN <logfilename>
Este log mostra o resultado do seu scan em uma forma
.B humanamente legível
no arquivo que você especificou como argumento.
.TP
.B \-oX <logfilename>
Este log mostra o resultado do seu scan na forma de
.B XML
no arquivo que você especificou como argumento. Isto permite aos programas facilmente capturar e interpretar os resultados do Nmap. Você pode fornecer o argumento \'-\'(sem quotas) para colocar em uma stdout (para shell pipelines, etc). Neste caso uma saída normal será suprimida. Tomar cuidado para as mensagem de erro se você esta usando esta (elas, ainda, irão para stderr). Também, note que \'-v\' pode causar algumas informações extras para ser impressas.
.TP
.B \-oG <logfilename>
Este log mostra o resultado do seu scan na forma do
.B grepable
no arquivo que você especificou como argumento. Este simples formato provê todas as informações em uma linha (então você pode facilmente usar o grep para portas ou obter informações de SOs e ver todos os endereços IPs). Este é o mecanismo preferido pelos programas para interagir com o Nmap, porém agora é recomendado usar a saída em XML (-oX). Este simples formato pode não conter tantas informações quanto os outros formatos. Você pode fornecer o argumento \'-\'(sem quotas) para colocar em uma stdout (para shell pipelines, etc). Neste caso uma saída normal será suprimida. Tomar cuidado para as mensagem de erro se você esta usando esta (elas, ainda, irão para stderr). Também, note que \'-v\' irá fornecer várias informações extras para ser impressas.
.TP
.B \-oS <logfilename>
thIs l0gz th3 r3suLtS of YouR ScanZ iN a
.B s|<ipT kiDd|3
f0rM iNto THe fiL3 U sPec\|fy 4s an arGuMEnT! U kAn gIv3
the 4rgument \'-\' (wItHOUt qUOteZ) to sh00t output iNT0
stDouT!@!!
.TP
.B \--resume <logfilename>
O scan de rede que é cancelado devido a um control-C, interrupção da rede, etc. pode ser resumido usando esta opção. O logfilename precisa ser normal (-oN) ou parsable na máquina (-oM) para registrar o scan abortado. Nenhuma outra opção pode ser usada. Nmap começará na máquina depois que a última foi scanneada com sucesso e armazenada no arquivo de log.
.TP
.B \-iL <inputfilename>
É feita a leitura de um arquivo alvo especificado na linha de comando. O arquivo deve conter uma lista de hosts ou expressões de rede separados por espaços, tabs, ou novas linhas. Use o hífen (-) como
.I inputfilename
se você quisesse que o nmap leia expressões do hosts de stdin (como no final do pipe). Veja a seção
.I especificação do alvo
para maiores informações nas expressões que você preencherá no arquivo.
.TP
.B \-iR
Esta opção fala para o Nmap para gerar seus próprios hosts para scannear, usando simplesmente números randomicos :o). Isso nunca irá terminar. Isso pode ser muito útil para tirar amostras estatísticas da internet para estimar várias coisas. Se você nunca estiver realmente entediado, tente
.I nmap \-sS \-iR \-p 80
para encontrar vários servidores web para observar.
.TP
.B \-p <port ranges>
Esta opção especifica quais portas você quer para descrever. Por exemplo '-p 23' irá tentar somente a porta 23 do host(s) alvo. \'\-p 20-30,139,60000-\' irá scannear portas entre 20 e 30, porta 139, e todas as portas maiores que 60000. Por definição é para scannear todas as portas entre 1 e 1024 tão bem quanto qualquer porta listada no arquivo de serviços o qual vem com o nmap. Para o scan de protocolos IP (-sO), especifica o número do protocolo que você deseja para (0-255).
.TP
.B \-F Modo de scan rápido.
Especifica que você somente deseja scannear por portas catalogadas no arquivo services o qual vem com o nmap (ou o arquivo de protocolos para -sO). Este é obviamente muito mais rápido do que scannear todas 65535 portas no host.
.TP
.B \-D <decoy1 [,decoy2][,ME],...>
O processo de decoy scan será executado fazendo ele mostrar-se para o host
remoto que o(s) host(s) que você especificou como decoys estão scanneando a rede alvo também. Então seus IDS precisarão reportar 5-10 scan de portas de um único endereço IP, porém eles não saberão qual o endereço IP que os estava scanneando e quais eram os decoys inocentes. Enquanto isto pode ser descoberto através de uma rota, respostas soltas, e outras mecanismos ativos, este é geralmente uma técnica extremamente efetiva para esconder seu endereço IP.
.Sp
Separando cada decoy host com vírgulas, você pode usar opcionalmente 'ME' como um dos decoys para representar a posição que você quer seu endereço IP para ser usado. Se você colocar 'ME' na sexta posição ou outra maior, várias detectores comuns de scan de portas não serão razoáveis para mostrar seu endereço IP por completo. Se você não usar 'ME', o nmap irá colocar você em uma posição randomica.
.Sp
Note que os hosts que você usa como decoys devem estar ativos ou você precisará acidentalmente inundar com pacotes SYN seu alvo. Também, ele será muito fácil para determinar quais hosts estão scanneando se somente um está atualmente ativo na rede. Você deverá querer usar o endereço IP ao invez de nomes (então redes decoy não irão ver você em seus nameserver logs).
.Sp
Também, note que vários (estúpidos) "detectores de scan de portas" irão firewall/deny roteamento para hosts que tentam fazer o scan de portas. Então você precisa descuidadosamente causar a perda de conexão da máquina que você está scanneando com a máquina decoy que você esta usando. Isto pode causar maiores problemas para a máquina alvo se o decoy está sendo usado, digo, seu internet gateway ou até "localhost". Então você pode querer ser cuidadoso com esta opção. A real moral da história é que os detectores de scan de portas spoofable não devem gastar ações contra a máquina que parece estar scanneando suas portas. Este pode ser somente um decoy, ou seja, uma isca, uma armadilha!
.Sp
Decoys são usados tanto em ping scan inicial (usando ICMP, SYN, ACK, ou o que seja) e durante a fase de atual scanneamento de porta. Decoy são também usados durante a detecção remota de SO (
.B \-O
).
.Sp
Este é um digno registrador que usa vários decoys que podem atrasar seu scan e potencialmente até fazer este menos preciso. Também, vários ISPs filtram pacotes spoofed, embora vários (correntemente a maioria) não restrigem pacotes IP spoofed por inteiro.
.TP
.B \-S <IP_Address>
Em várias circunstâncias,
.I nmap
pode não ser capaz de determinar seu endereço de origem (
.I nmap
irá avisá-lo se este é o caso). Nesta situação, use
\-S com seu endereço IP (através da interface que você deseja enviar pacotes).
.Sp
Outro possível uso deste flag é para spoofar o scan para fazer o alvo pensar que
.B alguém mais
está scanneando. Imagine uma companhia sendo repetidamente port scanned pelo seu competidor! Este não é um uso suportado (ou o principal propósito) deste flag. Eu penso somente que isso levanta uma interessante discussão, em que as pessoas devem estar cientes antes que elas acusem outras pessoas de estar scanneando suas portas.
.B \-e
geralmente será requerida para este tipo de uso.
.TP
.B \-e <interface>
Fala para o nmap qual interface enviar e receber pacotes. Nmap deve ser capaz de detectar isto, porém este contará para você se não puder.
.TP
.B \-g <portnumber>
Conjunto de números de portas de origens usadas no scan. Vários ingênuos firewalls e filtros de pacotes instalados fazem uma exceção em seus conjuntos de regras para permitir pacotes DNS (53) ou FTP-DATA (20) para entrar e estabelecer a conexão. Obviamente isto contesta completamente as vantagens de segurança do firewall desde que intrusos podem somente mascarar como FTP ou DNS por modificar suas portas de origem. Obviamente para UDP scan você deve tentar 53 primeiro e TCP scans devem tentar 20 antes da porta 53. Note que isso é somente uma requisição -- nmap honrará isso somente quando esta estiver hábil para. Por exemplo, você não pode amostrar todo TCP ISN de um host:porta para um host:porta, então nmap muda a porta de origem mesmo que seja usado -g.
.Sp
Seja ciente que existe uma penalidade na performance em vários scans por usar esta opção, porque eu algumas vezes armazeno informações úteis no número da porta de origem.
.TP
.B \-r
Fala para o Nmap para
.B NÃO
randomizar a ordem na qual as portas serão scanneada.
.TP
.B \-\-randomize_hosts
Fala para o Nmap para embaralhar cada grupo acima de 2048 hosts antes de scanneá-los. Isto pode fazer o scan menos evidente para vários sistemas de monitoração de rede, especialmente quando você combina estes com as opções de baixo tempo (slow timing) (veja abaixo).
.TP
.B \-M <max sockets>
Conjunto máximo de números de sockets que será usado em paralelo pelo TCP connect() scan (por definição). Esta é útil para diminuir um pouco o scan e anular a possibilidade de travar a máquina remota. Outra aproximação é para usar \-sS, a qual é geralmente fácil para as máquinas descreverem.
.TP
.B OPÇÕES DE TEMPO
Geralmente o Nmap faz um bom trabalho em ajustar para as características da rede um tempo de execução e scanning tão rápido quanto possível enquanto minimiza as chances do hosts/portas serem não detectadas. Entretanto, existem vários casos onde a política de tempo default do Nmap pode não encontrar seus objetivos. As seguintes opções provêem um fino nível de controle sobre o tempo de scan:
.TP
.B -T <Paranoid|Sneaky|Polite|Normal|Aggressive|Insane>
Estas são políticas de tempo preservados para convenientemente expressar suas prioridades para o Nmap.
.B Paranoid
modo de scan
.B muito
lento na esperança de prevenir a detecção pelo sistema IDS. Este serializa todos os scans (scanning não paralelo) e geralmente espera no mínimo 5 minutos entre o envio de pacotes.
.B Sneaky
é similar, exceto que somente espera 15 segundos entre o envio de pacotes.
.B Polite
tem o significado para facilitar a carga na rede e reduzir as chances de travar a máquina. Ele serializa os testes e espera
.B no mínimo
0.4 segundos entre eles.
.B Normal
é o comportamento default do Nmap, o qual tenta executar tão rápido quanto possível sem sobrecarregar a rede ou perder hosts/portas.
.B Aggressive
esse modo adiciona um timeout de 5 minutos por host e nunca espera mais que 1.25 segundos para testar as respostas.
.B Insane
é somente adequando para redes muito rápidas ou onde você não se importa em perder algumas informações. Nesta opção o timeout dos hosts acontecem em 75 segundos e espera somente 0.3 segundos por teste individual. Esta possibilita, de qualquer forma, uma varredura extremamente rápida na rede :o). Você pode também referenciar isso por números (0-5). Por exemplo, \'-T 0\' fornece para você o modo Paranoid e \'-T 5\' é o modo Insane.
.Sp
Estes modos, para preservar o tempo, NÃO devem ser usados em combinação com controles de baixo nível, como os fornecidos abaixo.
.TP
.B --host_timeout <milliseconds>
Especifica a soma de tempo que o Nmap permite para gastar scanneando um simples host antes de desistir daquele IP. O modo de tempo default não tem o timeout do host.
.TP
.B --max_rtt_timeout <milliseconds>
Especifica a soma máxima de tempo do Nmap tem permitido para esperar pela resposta de teste antes de retransmitir ou ocorrer um timeout de um particular teste. O modo default seta este valor em 9000.
.TP
.B --min_rtt_timeout <milliseconds>
Quando um host alvo começa a estabelecer um padrão de resposta muito rápido, Nmap irá contrair a soma de tempo fornecida por teste. Isto aumenta a velocidade do scan, porém pode levar a perder pacotes quando a resposta gasta mais tempo que o usual. Com este parâmetro você pode garantir que o Nmap irá esperar ao menos a soma de tempo fornecida antes de abrir mão do teste.
.TP
.B --initial_rtt_timeout <milliseconds>
Especifica o timeout do teste inicial. Isto é geralmente útil quando scanning firewalled hosts com -P0. Normalmente o Nmap pode obter boas estimativas RTT do ping e dos primeiros testes. O modo default usa 6000.
.TP
.B --max_parallelism <number>
Especifica o número máximo de Nmap scans permitidos para serem performados em paralelo. Ajustando este para 1 significa que o Nmap nunca irá tentar scannear mais que uma porta por vez. Este, também, afeta outros scans paralelos como o ping sweep, RPC scan, etc.
.TP
.B --scan_delay <milliseconds>
Especifica a
.B mínima
soma de tempo que o Nmap precisa esperar entre testes. Este é, na maioria das vezes, útil para reduzir a carga da rede ou para diminuir a maneira de scan para esquivar-se do IDS.
.SH ESPECIFICAÇÃO DO ALVO
Tudo que não é uma opção (ou argumento de opção) no nmap é tratado como especificação do host alvo. No caso mais simples são registrados simples hostnames ou endereços IPs na linha de comando. Se você quiser scannear uma subrede de endereços IPs, você pode anexar
.B '/mask'
para o hostname ou endereço IP.
.B mask
precisa estar entre 0 (faz o scan de toda internet) e 32 (faz o scan de um simples host especificado). Use /24 para scannear a classe de endereço 'C' e /16 para a classe de endereço 'B'.
.Sp
Nmap, também, tem a mais poderosa notação a qual permite você especificar um
endereço IP usando uma lista/fileira para cada elemento. Então você pode scannear todo o endereço classe 'B' da rede 192.168.*.* especificando '192.168.*.*' ou '192.168.0-255.0-255' ou até '192.168.1-50,51-255.1,2,3,4,5-255'. E é claro, você pode usar a notação de máscara: '192.168.0.0/16'. Estes todos são equivalentes.
.Sp
Outra coisa interessante para fazer é dividir em pedaços a Internet de outra maneira. Ao invez de scannear todos os hosts da classe 'B', scan '*.*.5.6-7' com o objetivo de explorar todos os endereços IPs que terminam em .5.6 ou .5.7 escolhendo seus próprios números. Para mais informações dos hosts específicos para scannear, veja a seção de
.I exemplos.
.SH EXEMPLOS
Aqui existem vários exemplos de uso do nmap, do simples e normal para um pouco mais complexo/esotérico. Note que números atuais e vários nomes de domínios atuais são usados para tornar as coisas mais concretas. Em seus lugares você deve substituir por endereços/nomes da
.B sua própria rede.
Eu não penso que scannear portas de outras rede é ilegal; nem deve o scanneamento de portas ser feito por outros como um ataque. Eu tenho scanneado centenas de milhares de máquinas e tenho recebido somente uma reclamação. Porém eu não sou advogado e alguma pessoa pode estar irritado pelos testes do
.I nmap
. Primeiramente, obtenha permissão ou use sobre seu próprio risco.
.Sp
.B nmap -v target.example.com
.Sp
Esta opção faz o scan de todas as portas TCP reservadas na máquina target.example.com. A opção \-v significa ligar o modo verbose.
.Sp
.B nmap -sS -O target.example.com/24
.Sp
Lança um stealth SYN scan contra cada máquina que está ativa, abrangendo todas as 255 máquinas de classe 'C' onde target.example.com reside. Este exemplo, também, tenta determinar o sistema operacional que esta executando em cada host que esta ativo. Este requere privilégios de root (super usuário) por causa da técnica SYN scan e da detecção de SOs.
.Sp
.B nmap -sX -p 22,53,110,143,4564 "198.116.*.1-127"
.Sp
Envia um Xmas tree scan para a primeira metade de cada uma das 255 possibilidades de subredes de 8 bit no espaço de endereços classe 'B' em 198.116. Nós estamos testando quando o sistema executa sshd, DNS, pop3d, imapd, ou a porta 4564. Note que o Xmas scan não trabalha com a Microsoft devido a sua deficiente pilha TCP. O mesmo acontece com CISCO, IRIX, HP/UX, e BSDI.
.Sp
.B nmap -v --randomize_hosts -p 80 '*.*.2.3-5'
.Sp
Em lugar de focar somente um específico IP, é interessante, algumas vezes, abranger um fatia de toda a internet e fazer o scan de um pequena amostra de cada fatia. Este comando encontra todos os servidores web em máquinas com endereços IPs terminando em .2.3, .2.4, ou .2.5. Se você é super usuário (root) você pode adicionar -sS. Também, você irá encontrar mais máquinas interessantes começando com 127., então você pode querer usar '127-222' ao invez dos primeiros asterísticos porque essa parte tem uma alta densidade de máquinas interessantes
(IMHO).
.Sp
.B host -l company.com | cut '-d ' -f 4 | ./nmap -v -iL -
.Sp
Fazer uma transferência de zona de DNS para encontrar hosts em company.com e então alimentar os endereços IPs para o
.I nmap.
Os comandos acima são para minha caixa GNU/Linux. Você pode precisar de diferentes comandos/opções em outros sistemas operacionais.
.SH BUGS
Bugs? O que é bugs? Envie-me os bugs que você encontrar. Patches são uma boa também :o) Lembrem-se de, também, enviar novos SO fingerprints para que possamos aumentar nossa base de dados. O Nmap irá fornecer para você uma URL de submissão quando um apropriado fingerprint for encontrado.
.SH AUTOR
.Sp
Fyodor
.I <fyodor@insecure.org>
.SH TRADUTOR
.Sp
Antônio Pires de Castro Jr
.I <apcastro@ic.unicamp.br>; <apcastro@ondefor.com.br>
Texto traduzido em 17 de Outubro de 2000.
.SH NOTA DO TRADUTOR
.Sp
Esta tradução foi realizada usando a man page oficial do nmap (NMAP 2.54BETA7), e não possui nenhum compromisso com www.insecure.org. Este trabalho foi realizado pela livre e expontânea vontade do tradutor. Qualquer correção desta pode ser feita enviando um email para o tradutor.
.SH DISTRIBUIÇÃO
A mais nova versão do
.I nmap
pode ser obtida em
.I http://www.insecure.org/nmap/
.Sp
.I nmap
(C) 1997,1998,1999,2000 por Fyodor (fyodor@insecure.org)
.Sp
.I libpcap
é, também, distribuída junto com nmap. Esta é uma copyrighted por Van Jacobson, Craig Leres and Steven McCanne, todos do Laboratório Nacional de Lawrence em Berkeley, University of California, Berkeley, CA. A versão distribuída com o nmap pode ser modificada, a fonte original está disponível em ftp://ftp.ee.lbl.gov/libpcap.tar.Z .
.Sp
Este programa é um software livre; você pode redistribuí-lo e/ou modificá-lo sobre os termos da Licença Pública Geral GNU como publicado pelo Free Software Foundation; Versão 2. Esta garante seu direito de usar, modificar e redistribuir o Nmap sobre certas condições. Se esta licença for inaceitável para você, o Insecure.Org pode estar querendo negociar alternativas licenças (entre em contato com fyodor@insecure.org).
.Sp
O código de origem é fornecido para este software porque nós acreditamos que os usuários tem o direito de conhecer exatamente qual o programa ele irá usar antes de executá-lo. Isto, também, permite você auditar o software para furos de segurança (nenhum foi encontrado).
.Sp
O código de origem também permite você portar o Nmap para novas plataformas, consertar bugs, e adicionar novas características. Você esta altamente encorajado para enviar suas mudanças para fyodor@insecure.org para possíveis encorporações em sua principal distribuição. Por enviar estas mudanças para Fyodor ou uma das listas de discussão dos desenvolvedores insecure.org, será assumido que você está oferecendo nenhum limite a Fyodor, não-exclusivo direito de reusar, modificar, e relicenciar o código. Isto é importante por causa da incapacidade para relicenciar códigos, isso tem causado devastadores problemas para outros projetos de software livres (como KDE e NASM). O código fonte do Nmap sempre estará disponível. Se você desejar especificar especiais condições de licença das suas contribuições, somente diga quando você as enviar.
.Sp
Este programa é distribuído na esperança de ser útil, porém
.B SEM NENHUMA GARANTIA;
sem mesmo implicar garantia de
.B COMERCIABILIDADE
ou
.B ADAPTAÇÃO PARA UM PROPÓSITO PARTICULAR.
Veja a Licença Pública Geral GNU por mais detalhes (esta está no arquivo COPYING da distribuição do
.I nmap
).
.Sp
Também deve ser notado que o Nmap tem sido conhecido por travar certas aplicações pobremente escritas, pilhas TCP/IP, e mesmo certos sistemas operacionais.
.B O Nmap nunca deve ser executado contra sistemas críticos de missão ao menos que você esteja preparado para sofrer com o tempo ocioso. Nós reconhecemos aqui que o Nmap pode travar seu sistema ou rede e nós renunciamos todas responsabilidades por qualquer dano ou problemas que o Nmap possa causar.
.Sp
Por menosprezar os riscos de travar e por causa de vários usuários malíciosos gostarem de usar o Nmap para fazer o levantamento topológico da rede antes de atacar o sistema, existem administradores que estão preocupados e podem reclamar quando seus sistemas são scanneados. Por isso, é muitas vezes conveniente requerer permissão antes de fazer, mesmo que seja, um simples scan na rede.
.Sp
O Nmap nunca deve ser executado com privilégios (ex.: suid root) por razões de segurança.
.Sp
Todas as versões do Nmap igual á ou maiores que 2.0 são acreditadas não ter problemas, em todos os aspectos, com o bug do ano 2000 (Y2K). Porém, não existe razão para acreditar que versões anteriores a 2.0 são susceptíveis a problemas, porém nós não as testamos.

File diff suppressed because it is too large Load diff

View file

@ -1,549 +0,0 @@
.\"Traducido al español por
.\"Antonio Aneiros <aneiros@ctv.es>
.\"el 04-08-1999
.de Sp
.if n .sp
.if t .sp 0.4
..
.TH NMAP 1
.SH NOMBRE
nmap \- Herramienta de exploración de red y escáner de seguridad.
.SH SINOPSIS
.B nmap
[Tipos(s)de escaneo] [Opciones] <servidor o red #1 ... [#N]>
.SH DESCRIPCIÓN
.I Nmap
ha sido diseñado para permitir a administradores de sistemas y gente curiosa
en general el escaneo de grandes redes para determinar qué servidores se
encuentran activos y qué servicios ofrecen.
.I nmap
es compatible con un gran número de técnicas de escaneo como: UDP, TCP connect(),
TCP SYN (half open), ftp proxy (bounce attack), Reverse-ident, ICMP (ping
sweep), FIN, ACK sweep, Xmas Tree, SYN sweep, and Null scan. Véase la sección
.I Tipos de Escaneo
para más detalles.
.I nmap
proporciona también características avanzadas como la detección remota del
sistema operativo por medio de huellas TCP/IP , escaneo tipo stealth (oculto),
retraso dinámico y cálculos de retransmisión, escaneo paralelo, detección de
servidores inactivos por medio de pings paralelos, escaneo con señuelos,
detección de filtrado de puertos, escaneo por fragmentación y especificación
flexible de destino y puerto.
.PP
Se han hecho grandes esfuerzos encaminados a proporcionar un rendimiento
decente para usuarios normales (no root). Por desgracia, muchos de los
interfaces críticos del kernel ( tales como los raw sockets) requieren
privilegios de root.
Debería ejecutarse
.I nmap
como root siempre que sea posible.
.SH OPCIONES
En general, pueden combinarse aquellas opciones que tengan sentido en conjunto.
Algunas de ellas son específicas para ciertos modos de escaneo.
.I nmap
trata de detectar y advertir al usuario sobre el uso de combinaciones de
opciones sicóticas o no permitidas.
.Sp
Si usted es una persona impaciente, puede pasar directamente a la sección
.I ejemplos
al final de este documento, donde encontrará ejemplos de los usos más
corrientes. También puede ejecutar el comando
.B nmap -h
para una página de referencia rápida con un listado de todas las opciones.
.TP
.B Tipos de Escaneo
.TP
.B \-sT
Escaneo TCP connect(): Es la forma más básica de escaneo TCP. La llamada de
sistema connect() proporcionada por nuestro sistema operativo se usa para
establecer una conexión con todos los puertos interesantes de la máquina. Si
el puerto está a la escucha, connect() tendrá éxito, de otro modo, el puerto
resulta inalcanzable. Una ventaja importante de esta técnica es que no resulta
necesario tener privilegios especiales. Cualquier usuario en la mayoría de los
sistemas UNIX tiene permiso para usar esta llamada.
.Sp
Este tipo de escaneo resulta fácilmente detectable dado que los registros del
servidor de destino muestran un montón de conexiones y mensajes de error para
aquellos servicios que accept() (aceptan) la conexión para luego cerrarla
inmediatamente.
.TP
.B \-sS
Escaneo TCP SYN: A menudo se denomina a esta técnica escaneo "half open" (medio
abierto), porque no se abre una conexión TCP completa. Se envía un paquete
SYN, como si se fuese a abrir una conexión real y se espera que llegue una
respuesta. Un SYN|ACK indica que el puerto está a la escucha. Un RST es
indicativo de que el puerto no está a la escucha. Si se recibe un SYN|ACK, se
envía un RST inmediatamente para cortar la conexión (en realidad es el kernel
de nuestro sistema operativo el que hace esto por nosotros). La ventaja
principal de esta técnica de escaneo es que será registrada por muchos menos
servidores que la anterior. Por desgracia se necesitan privilegios de root
para construir estos paquetes SYN modificados.
.TP
.B \-sF \-sX \-sN
Modos Stealth FIN, Xmas Tree o Nul scan: A veces ni siquiera el escaneo SYN
resulta lo suficientemente clandestino. Algunas firewalls y filtros de
paquetes vigilan el envío de paquetes SYN a puertos restringidos, y programas
disponibles como Synlogger y Courtney detectan este tipo de escaneo. Estos
tipos de escaneo avanzado, sin embargo, pueden cruzar estas barreras sin ser
detectados.
.Sp
La idea es que se requiere que los puertos cerrados respondan a nuestro
paquete de prueba con un RST, mientras que los puertos abiertos deben ignorar
los paquetes en cuestión (véase RFC 794 pp 64). El escaneo FIN utiliza un
paquete FIN vacío (sorpresa) como prueba, mientras que el escaneo Xmas tree
activa las flags FIN, URG y PUSH. El escaneo NULL desactiva todas las flags.
Por desgracia Microsoft (como de costumbre) decidió ignorar el estándar
completamente y hacer las cosas a su manera. Debido a esto, este tipo de
escaneo no funcionará con sistemas basados en Windows95/NT. En el lado
positivo, esta es una buena manera de distinguir entre las dos plataformas. Si
el escaneo encuentra puertos cerrados, probablemente se trate de una máquina
UNIX, mientras que todos los puertos abiertos es indicativo de Windows.
Excepcionalmente, Cisco, BSDI, HP/UX, MVS, y IRIX también envían RSTs en vez
de desechar el paquete.
.TP
.B \-sP
Escaneo ping: A veces únicamente se necesita saber qué servidores en una red
se encuentran activos. Nmap puede hacer esto enviando peticiones de respuesta
ICMP a cada dirección IP de la red que se especifica. Aquellos servidores que
responden se encuentran activos. Desafortunadamente, algunos sitios web como
microsoft.com bloquean este tipo de paquetes. Nmap puede enviar
también un paquete TCP ack al puerto 80 (por defecto). Si se obtiene por
respuesta un RST, esa máquina está activa. Una tercera técnica implica el
envío de un paquete SYN y la espera de de un RST o un SYN/ACK. Para usuarios
no root se usa un método connect().
.Sp
Por defecto (para usuarios no root), nmap usa las técnicas ICMP y ACK en
paralelo. Se puede cambiar la opción
.B \-p
descrita más adelante.
.Sp
Nótese que el envio de pings se realiza por defecto de todas maneras y que
sólamente se escanean aquellos servidores de los que se obtiene respuesta. Use
esta opción sólamente en el caso de que desee un ping sweep (barrido ping)
.B sin
hacer ningún tipo de escaneo de puertos.
.TP
.B \-sU
Escaneo Udp: Este método se usa para saber qué puertos UDP (Protocolo de
Datagrama de Usuario, RFC 768) están abiertos en un servidor. La técnica
consiste en enviar paquetes UCP de 0 bytes a cada puerto de la máquina
objetivo. Si se recibe un mensaje ICMP de puerto no alcanzable, entonces el
puerto está cerrado. De lo contrario, asumimos que está abierto.
.Sp
Alguna gente piensa que el escaneo UDP no tiene sentido. Normalmente les
recuerdo el reciente agujero Solaris rcpbind. Puede encontrarse a rcpbind
escondido en un puerto UDP no documentado en algún lugar por encima del 32770.
Por lo tanto, no importa que el 111 esté bloqueado por la firewall.
Pero, ¿quién puede decir en cual de los más de 30000 puertos altos se
encuentra a la escucha el programa? ¡Con un escáner UDP se puede! Tenemos
también el programa de puerta trasera cDc Back Orifice que se oculta en un
puerto UDP configurable en las máquinas Windows, por no mencionar los muchos
servicios frecuentemente vulnerables que usan UDP como snmp, tftp, NFS, etc.
.Sp
Por desgracia, el escaneo UDP resulta a veces tremendamente lento debido a que
la mayoría de los servidores implementan una sugerencia recogida en el RFC
1812 (sección 4.3.2.8) acerca de la limitación de la frecuencia de mensajes de
error ICMP. Por ejemplo, el kernel de Linux (en /ipv4/icmp.h) limita la
generación de mensajes de destino inalcanzable a 80 cada cuatro segundos, con
una penalización de 1/4 de segundo si se rebasa dicha cantidad. Solaris tiene
unos límites mucho más estrictos (más o menos 2 mensajes por segundo) y por lo
tanto lleva más tiempo hacerle un escaneo.
.I nmap
detecta este límite de frecuencia y se ralentiza en consecuencia, en vez de
desbordar la red con paquetes inútiles que la máquina destino ignorará.
.Sp
Como de costumbre, Microsoft ignoró esta sugerencia del RFC y no parece que
haya previsto ningún tipo de límite de frecuencia para las máquinas Windows.
Debido a esto resulta posible escanear los 65K puertos de una máquina Windows
.B muy
rápidamente. ¡Woop!
.TP
.B \-b <ftp relay host>
Ataque de rebote FTP: Una característica "interesante" del protocolo FTP (FRC
959) es la posibilidad de realizar conexiones ftp tipo "proxy". En otras
palabras, ¡me resultaría posible conectarme desde malvado.com al servidor ftp
de destino.com y pedirle a ese servidor que enviase un archivo a CUALQUIER
PARTE de Internet! Aun así, esto podría haber funcionado bien en 1985 cuando
se escribió el RFC, pero en la Internet actual, no podemos permitir que la
gente vaya por ahí asaltando servidores ftp y pidiéndoles que escupan sus
datos a puntos arbitrarios de Internet. Tal y como escribió *Hobbit* en 1985,
este defecto del protocolo "puede usarse para enviar mensajes de correo y
noticias cuyo rastro será virtualmente imposible de seguir, machacar
servidores en varios sitios web, llenar discos, tratar de saltarse firewalls y
, en general, resultar molesto y difícil de detectar al mismo tiempo." Nosotros
explotaremos este defecto para (sorpresa, sorpresa) escanear puertos TCP desde
un servidor ftp "proxy". De este modo nos podríamos conectar a un servidor ftp
tras una firewall, y luego escanear aquellos puertos que con más probabilidad
se encuentren bloqueados (el 139 es uno bueno). Si el servidor ftp permite la
lectura y escritura en algún directorio (como por ejemplo /incoming), se
pueden enviar datos arbitrarios a puertos que se encuentren abiertos (aunque
nmap no realiza esta función por sí mismo).
.Sp
El argumento que se pasa a la opción 'b' es el host que se pretende usar como
proxy, en notación URL estándar. El formato es:
.I nombre_de_usuario:password@servidor:puerto.
Todo excepto
.I servidor
es opcional. Para determinar qué servidores son vulnerables a este ataque,
véase mi artículo en
.I Phrack
51. Se encuentra disponible una versión actualizada en la URL de
.I nmap
(http://www.insecure.org/nmap).
.TP
.B Opciones Generales
No se requiere ninguna pero algunas de ellas pueden resultar de gran utilidad.
.TP
.B \-p0
No intenta hacer ping a un servidor antes de escanearlo. Esto permite el
escaneo de redes que no permiten que pasen peticiones (o respuestas)de ecos
ICMP a través de su firewall. microsoft.com es un ejemplo de una red de este
tipo, y, por lo tanto, debería usarse siempre
.B \-p0
o
.B \-PT80
al escanear microsoft.com.
.TP
.B \-PT
Usa el ping TCP para determinar qué servidores están activos. En vez de enviar
paquetes de petición de ecos ICMP y esperar una respuesta, se lanzan paquetes
TCP ACK a través de la red de destino (o a una sola máquina) y luego se espera
a que lleguen las respuestas. Los servidores activos responden con un RST.
Esta opción mantiene la eficiencia de escanear únicamente aquellos servidores
que se encuentran activos y la combina con la posibilidad de escanear
redes/servidores que bloquean los paquetes ping. Para los usuarios no root
se usa connect(). Para establecer el puerto de destino de los paquetes de
prueba use -PT <número de puerto). El puerto por defecto es el 80, dado que
normalmente este puerto no es un puerto filtrado.
.TP
.B \-PS
Esta opción usa paquetes SYN (petición de conexión) en vez de los paquetes ACK
para usuarios root. Los servidores activos deberían responder con un RST (o,
en raras ocasiones, un SYN|ACK).
.TP
.B \-PI
Esta opción usa un paquete ping (petición de eco ICMP) verdadero. Encuentra
servidores que están activos y también busca direcciones de broadcast
dirigidas a subredes en una red. Se trata de direcciones IP
alcanzables desde el exterior que envían los paquetes IP entrantes a una subred
de servidores. Estas direcciones deberían eliminarse, si se encontrase alguna,
dado que suponen un riesgo elevado ante numerosos ataques de denegación de
servicio (el más corriente es Smurf).
.TP
.B \-PB
Este es el tipo de ping por defecto. Usa los barridos ACK (
.B \-PT
) e ICMP (
.B \-PI
) en paralelo. De este modo se pueden alcanzar firewalls que filtren uno de los
dos (pero no ambos).
.TP
.B \-O
Esta opción activa la detección remota del sistema operativo por medio de la
huella TCP/IP. En otras palabras, usa un puñado de técnicas para detectar
sutilezas en la pila de red subyacente del sistema operativo de los servidores
que se escanean. Usa esta información para crear una 'huella' que luego
compara con una base de datos de huellas de sistemas operativos conocidas (el
archivo nmap-os-fingerprints) para decidir qué tipo de sistema se está
escaneando.
.Sp
Si encuentra una máquina diagnosticada erróneamente que tenga por lo menos un
puerto abierto, me sería de gran utilidad que me enviase los detalles en un
email (es decir, se encontró la versión xxx de tal cosa y se detectó este u
otro sistema operativo..). Si encuentra una máquina con al menos un puerto
abierto de la cual nmap le informe "sistema operativo desconocido",
le estaría agradecido si me enviase la dirección IP junto con el nombre del
sistema operativo y el número de su versión. Si no me puede enviar la
dirección IP, una alternativa sería ejecutar nmap con la opción
.B \-d
y enviarme las tres huellas que obtendría como resultado junto con el nombre
del sistema operativo y el número de versión. Al hacer esto, está
contribuyendo a aumentar el número importante de sistemas operativos conocidos
por namp y de este modo el programa resultará más exacto para todo el mundo.
.TP
.B \-I
Esta opción activa el escaneo TCP de identificación contraria. Tal y como
comenta Dave Goldsmith en un correo Bugtrat de 1996, el protocolo ident (rfc
1413) permite la revelación del nombre del usuario propietario de cualquier
proceso conectado vía TCP, incluso aunque ese proceso no haya iniciado la
conexión. De este modo se puede, por ejemplo, conectar con el puerto http y
luego usar identd para descubrir si el servidor está ejecutándose como root.
Esto sólo se puede hacer con una conexión TCP completa con el puerto de
destino (o sea, la opción de escaneo -sT).
Cuando se usa
.B \-I,
se consulta al identd del servidor remoto sobre cada uno de los puertos
abiertos encontrados en el sistema. Por supuesto, esto no funcionará si el
servidor en cuestión no está ejecutando identd.
.TP
.B \-f
Esta opción hace que el escaneo solicitado de tipo SYN, FIN, XMAS, o NULL use
pequeños paquetes IP fragmentados. La idea consiste en dividir la cabecera TCP
en varios paquetes para ponérselo más difícil a los filtros de paquetes,
sistemas de detección de intrusión y otras inconveniencias por el estilo que
tratan de saber lo uno está haciendo. ¡Tenga cuidado con esto! Algunos
programas tienen problemas a la hora de manejar estos paquetes tan pequeños.
Mi sniffer favorito produjo un error de segmentación inmediatamente después de
recibir el primer fragmento de 36 bytes. ¡Después de este viene uno de 24
bytes! Mientras que este método no podrá con filtros de paquetes y firewalls
que ponen en cola todos los fragmentos IP (como en el caso de la opción
CONFIG_IP_ALWAYS_DEFRAG en la configuración del kernel de Linux), también
es verdad que algunas redes no pueden permitirse el efecto negativo que esta
opción causa sobre su rendimiento y por lo tanto la dejan desactivada.
.Sp
Nótese que no he coseguido que esta opción funcione con todos los sistemas.
Funciona bien con mis sistemas Linux, FreeBSD y OpenBSD y algunas personas
han informado de éxitos con otras variantes *NIX.
.TP
.B \-v
Modo de información ampliada. Esta opción resulta muy recomendable y
proporciona gran cantidad de información sobre lo que está sucediendo. Puede
usarla dos veces para un efecto mayor. ¡Use
.B \-d
un par veces si lo que quiere es volverse loco haciendo scroll en su pantalla!
.TP
.B \-h
Esta opción tan práctica muestra una pantalla de referencia rápida sobre las
opciones de uso de nmap. Quizás haya notado que esta página de manual no es
precisamente una "referencia rápida" :)
.TP
.B \-o <nombre_de_archivo_de_registro>
Esta opción guarda los resultados de sus escaneos en forma
.B humanamente inteligible
en el archivo especificado como argumento.
.TP
.B \-m <nombre_de_archivo_de_registro>
Esta opción guarda los resultados de sus escaneos en un formato
.B comprensible para una máquina
en el archivo especificado como argumento.
.TP
.B \-i <nombre_de_archivo_de_entrada>
Lee especificaciones de servidores o redes de destino a partir del archivo
especificado en vez de hacerlo de la línea de comandos. El archivo debe
contener una lista de expresiones de servidores o redes separadas por
espacios, tabuladores o nuevas líneas. Use un guión (-) como
.I nombre_de_archivo_de_entrada
si desea que nmap tome las expresiones de servidores de stdin. Véase la sección
.I Especificación de Objetivo
para más información sobre expresiones con las que poder completar este
archivo.
.TP
.B \-p <rango de puertos>
Esta opción determina los puertos que se quieren especificar. Por ejemplo, '-p
23' probará solo el puerto 23 del servidor(es) objetivo. '-p
20-30,139,60000-' escanea los puertos del 20 al 30, el puerto 139 y todos los
puertos por encima de 60000. Por defecto se escanean todos los puertos entre
el 1 y el 1024 así como los que figuran en el archivo /etc/services.
.TP
.B \-F Modo de escaneo rápido.
Implica que sólo se desean escanear aquellos puertos que figuran en
/etc/services. Obviamente esto resulta mucho más rápido que escanear cada uno
de los 65535 puertos de un servidor.
.TP
.B \-D <señuelo1 [,señuelo2][,ME],...>
Especifica que se desea efectuar un escaneo con señuelos, el cual hace que el
servidor escaneado piense que la red destino del escaneo está siendo escaneada
también por el servidor(es) especificados como señuelos. Así, sus IDs pueden
informar de entre 5 y 10 escaneos procedentes de direcciónes IP únicas, pero
no sabrán que dirección IP les estaba escaneando realmente y cúales eran
señuelos inocentes.
.Sp
Separe cada servidor señuelo con comas, y puede usar opcionalmente 'ME' como
señuelo que representa la posición que quiere que ocupe su dirección IP. Si
coloca 'ME' en la sexta posición o superior, es muy poco probable que algunos
escáneres de puertos comunes (como el excelente scanlogd de Solar Designer)
lleguen incluso a mostrar su dirección IP. Si no se usa 'ME', nmap le colocará
a usted en una posición aleatoria.
.Sp
Nótese que aquellos servidores usados como señuelos deben escontrarse activos,
o, de lo contrario podría provocar un desbordamiento (flood) SYN en su
objetivo. Por otra parte, resultará bastante fácil saber qué servidor está
escaneando si únicamente hay uno activo en la red.
.Sp
Nótese también que algunos (estúpidos) "detectores de escáneres de puertos"
opondrán una firewall o bien denegarán el rutaje a aquellos servidores que
intenten escanear sus puertos. De este modo se podría provocar
inadvertidamente que la máquina que se está intentando escanear perdiese
contacto con los servidores usados como señuelos. Esto podría causarles a los
servidores escaneados verdaderos problemas si los servidores señuelo fuesen,
por ejemplo, su gateway a internet o incluso "localhost". Debería usarse esta
opción con extremo cuidado. La verdadera moraleja de este asunto es que un
detector de escaneos de puertos que aparenten tener intenciones poco
amistosas no debería llevar a cabo acción alguna contra la máquina que
aparentemente le está escaneando. ¡Podría no ser más que un señuelo!
.Sp
Los señuelos se usan tanto en el escaneo ping inicial (usando ICMP, SYN, ACK,
o lo que sea) como en la fase de escaneo de puertos propiamente dicha. También
se usan los señuelos en la fase de detección remota del sistema operativo (
.B \-O
).
.Sp
Vale la pena destacar que el uso de demasiados señuelos puede ralentizar el
proceso de escaneo y, potencialmente, hacer que sea menos exacto. Por otra
parte, algunos ISPs filtrarán los paquetes manipulados y los desecharán,
aunque muchos (actualmente la mayoría) no ponen restricciones a este tipo de
paquetes.
.TP
.B \-S <Dirección_IP>
En determinadas circunstancias, es posible que
.I nmap
no sea capaz de determinar su (de usted) dirección IP de origen (
.I nmap
se lo hará saber si este es el caso). En este caso, use -S con su dirección IP
(del interfaz a través del cual desea enviar los paquetes).
.Sp
Otro posible uso de esta opción es el de manipular el escaneo para hacer creer
a los servidores de destino que
.B alguien más
les está escaneando. ¡Imagínese a una compañía escaneada repetidamente por una
compañía rival! Esta no es la función para la que se ha diseñado esta opción
(ni su propósito principal). Simplemente pienso que revela una posibilidad que
la gente debería tener en cuenta antes de acusar a los demás de escanear sus
puertos.
La opción
.B \-e
será necesaria en general para este tipo de uso.
.TP
.B \-e <interfaz>
Le dice a nmap qué interfaz ha de usar para enviar y recibir paquetes. El
programa debería detectar esto por sí mismo, pero le informará si no es así.
.TP
.B \-g <número_de_puerto>
Establece el número de puerto de origen a usar en los escaneos. Muchas
instalaciones de firewalls y filtros de paquetes inocentes hacen una excepción
en sus reglas para permitir que las atraviesen y establezcan una conexión
paquetes DNS (53) o FTP-DATA (20). Evidentemente esto contraviene
completamente las ventajas en materia de seguridad que comporta una firewall
dado que los intrusos pueden enmascararse como DNS o FTP con una simple
modificación de su puerto de origen. Por supuesto, debería probarse primero
con el puerto 53 para un escaneo UDP y los escaneos TCP deberían probar el 20
antes del 53.
.Sp
Nótese que el uso de esta opción penaliza levemente el rendimiento del
escaneo, porque a veces se almacena información útil en el número de puerto
de origen.
.TP
.B \-M <max sockets>
Establece el número máximo de sockets que se usarán en paralelo para un
escaneo TCP connect() (escaneo por defecto). Resulta útil a la hora de
ralentizar ligeramente el proceso de escaneo con el fin de evitar que
la máquina de destino se cuelgue. Otra manera de hacerlo es usar \-sS, que
normalmente les resulta más fácil de asumir a las máquinas de destino.
.TP
.B Especificación de Objetivo
Cualquier cosa que no es una opción (o el argumento de una opción) en namp se
trata como una especificación de servidor de destino. El caso más simple
consiste en especificar servidores aislados o direcciones IP en la línea de
comandos. Si pretende escanear una subred de direcciones IP, entonces se puede
añadir
.B '/mask'
a la dirección IP o al nombre del servidor.
.B mask
debe estar entre 0 (escanea toda Internet) y 32 (escanea únicamente el
servidor especificado). Use /24 para escanear una dirección de clase 'C' y /16
para la clase 'B'.
.Sp
Nmap dispone también de una notación mucho más potente que permite la
especificación de direcciones IP usando listas/rangos para cada elemento. De
este modo, se puede escanear la red de clase 'B' completa 128.210.*.*
especificando '128.210.*.*' o '128.210.0-255.0-255' o incluso
'128.210.1-50,51-255.1,2,3,4,5-255'. Y, por supuesto, se puede usar la
notación de máscara: '128.210.0.0/16'. Todas ellas son equivalentes. Si se
usan asteriscos ('*'), ha de tenerse en cuenta que la mayoría de los shells
requieren que se salga de ellos con caracteres / o que se les proteja con
comillas.
.Sp
Otra posibilidad interesante consiste en dividir Internet en el otro sentido.
En vez de escanear todos los servidores en una clase 'B', se puede
escanear '*.*.5.6-7' para escanear todas las direcciones IP terminadas en .5.6 o .5.7
Escoja sus propios números. Para más información sobre la especificación de
servidores a escanear, véase la sección
.I ejemplos
a continuación.
.SH EJEMPLOS
A continuación se muestran algunos ejemplos del uso de nmap que abarcan desde
los usos más normales y frecuentes a los más complejos o incluso esotéricos.
Nótese que se han incluido direciones IP y nombres de dominio reales para hacer
las cosas más concretas. Usted debería sustituirlos por números y direcciones
de su
.B propia red.
No creo que escanear otras redes sea ilegal; ni se deberían considerar los
escaneos de puertos como ataques. He escaneado cientos de miles de máquinas y
tan sólo he recibido una queja. Pero no soy abogado y es posible que los
intentos de
.I nmap
lleguen a molestar a alguna gente. Obtenga primero el permiso para hacerlo o
hágalo bajo su propia responsabilidad.
.Sp
.B nmap -v objetivo.ejemplo.com
.Sp
Esta opción escanea todos los puertos TCP reservados en la máquina
objetivo.ejemplo.com. La \-v implica la activación del modo de información
ampliada.
.Sp
.B nmap -sS -O objetivo.ejemplo.com/24
.Sp
Lanza un escaneo SYN oculto contra cada una de las máquinas activas de las 255
máquinas de la classe 'C' donde se aloja objetivo.ejemplo.com. También trata
de determinar el sistema operativo usado en cada una de las máquinas activas.
Este escaneo requiere privilegios de roor a causa del escaneo SYN y la
detección del sistema operativo.
.Sp
.B nmap -sX -p 22,53,110,143 "128.210.*.1-127"
.Sp
Envía un escaneo Xmas tree a la primera mitad de cada una de las 255 posibles
subredes de 8 bits en el espacio de direcciones clase 'B' 128.210 . Se trata
de comprobar si los sistemas ejecutan sshd, DNS, pop3d, imapd o el puerto
4564. Nótese que el escaneo Xmas no funciona contra servidores ejecutando
cualquier sistema operativo de Microsoft debido a una pila TCP deficiente. Lo
mismo se aplica a los sistemas CISCO, IRIX, HP/UX, y BSDI.
.Sp
.B nmap -v -p 80 '*.*.2.3-5'
.Sp
En vez de centrarse en un rango específico de direcciones IP, resulta a veces
interesante dividir Internet en porciones y escanear una pequeña muestra de
cada porción. Este comando encuentra todos los servidores web en máquinas
cuyas direcciones IP terminen en .2.3, .2.4, o .2.5 . Si usted es root podría
añadir también -sS. También encontrará máquinas mucho más interesantes
si empieza en 127. así que es posible que desee usar '127-222' en vez de el
primer asterisco dado que esa sección tiene una densidad mucho mayor de
máquinas interesantes (IMHO).
.Sp
.B host -l compañía.com | cut '-d ' -f 4 | ./nmap -v -i -
.Sp
Hace una transferencia de DNS de zona para descubrir los servidores en
compañía.com y luego pasar las direcciones IP a
.I nmap.
Los comandos arriba indicados son para mi sistema Linux. Es posible que se
necesiten comandos/opciones diferentes para otros sistemas operativos.
.SH BUGS
¿Bugs? ¿Qué bugs? Por favor, envíeme cualquier bug que descubra. Los parches
tampoco estarían mal :) Recuerde enviar también nuevas huellas de sistemas
operativos para que podamos ampliar nuestra base de datos.
.SH AUTOR
.Sp
Fyodor
.I <fyodor@insecure.org>Tipos de Escaneo
.SH DISTRIBUCIÓN
La última versión de
.I nmap
se puede obtener en
.I http://www.insecure.org/nmap
.Sp
.I nmap
es (C) 1997,1998 de Fyodor (fyodor@insecure.org, fyodor@insecure.org)
.Sp
Este programa es software libre; puede redistribuirse y/o modificarse bajo los
términos de la Licencia Pública General GNU tal y como la publica la Fundación
de Software Libre; Versión 2.
.Sp
Este programa se distribuye con la esperanza de que pueda resultar de
utilidad, pero SIN NINGÚN TIPO DE GARANTÍA; sin tan siquiera la garantía e ser
apto para su COMECIALIZACIÓN o ADECUADO PARA UN PROPÓSITO EN PARTICULAR. Véase
la Licencia Pública General GNU para más detalles (está en el archivo COPYING
de la distribución de
.I nmap
).

View file

@ -55,7 +55,7 @@ be installed before installing nmap-frontend.
%build
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$RPM_OPT_FLAGS"
./configure --prefix=%{prefix} --mandir=%{prefix}/share/man --without-openssl
./configure --prefix=%{prefix} --mandir=%{prefix}/share/man --without-openssl --without-umit
%if "%{static}" == "1"
make static
%else

View file

@ -399,18 +399,18 @@ static int l_set_port_version(lua_State* l, Target* target, Port* port) {
}
static int l_print_debug_unformatted(lua_State *l) {
int verbosity=1, stack_counter(1);
const char *out;
if (lua_gettop(l) != 2) return luaL_error(l, "Incorrect number of arguments\n");
verbosity = luaL_checkinteger(l, 1);
if (verbosity > o.verbose) return 0;
out = luaL_checkstring(l, 2);
log_write(LOG_STDOUT, "%s DEBUG: %s\n", SCRIPT_ENGINE, out);
return 0;
int verbosity=1;
const char *out;
if (lua_gettop(l) != 2) return luaL_error(l, "Incorrect number of arguments\n");
verbosity = luaL_checkinteger(l, 1);
if (verbosity > o.verbose) return 0;
out = luaL_checkstring(l, 2);
log_write(LOG_STDOUT, "%s DEBUG: %s\n", SCRIPT_ENGINE, out);
return 0;
}
static int l_exc_finalize(lua_State *l) {

View file

@ -1,16 +1,10 @@
PLATFORM=@host@
#ugly hack to get the includes right
ifeq ($(LIBLUA_LIBS),$(LIBLUADIR)/liblua.a)
LIBLUA_INCLUDE= -I../$(LIBLUADIR)
endif
LIBSUFFIX=@LIBSUFFIX@
CC = @CC@
CXX = @CXX@
CCOPT =
DBGFLAGS =
# LIBPCREDIR = @LIBPCREDIR@
SHTOOL = ../shtool
INSTALL = $(SHTOOL) install
@ -21,7 +15,7 @@ LTFLAGS = --tag=CC --silent
all: bit.so
bit.so: bit.c @LIBTOOL_DEPS@
$(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(LIBLUA_INCLUDE) $(CFLAGS) -c bit.c
$(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) @LUAINCLUDE@ $(CFLAGS) -c bit.c
$(LIBTOOL) $(LTFLAGS) --mode=link $(CC) -avoid-version -module -rpath /usr/local/lib -o bit.la bit.lo
mv .libs/bit.so bit.so

185
nselib/configure vendored
View file

@ -836,6 +836,7 @@ FFLAGS
ac_ct_F77
LIBTOOL
LIBTOOL_DEPS
LUAINCLUDE
LIBOBJS
LTLIBOBJS'
ac_subst_files=''
@ -3630,7 +3631,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 3633 "configure"' > conftest.$ac_ext
echo '#line 3634 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -6252,11 +6253,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6255: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6256: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:6259: \$? = $ac_status" >&5
echo "$as_me:6260: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -6520,11 +6521,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6523: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6524: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:6527: \$? = $ac_status" >&5
echo "$as_me:6528: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -6624,11 +6625,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6627: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6628: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:6631: \$? = $ac_status" >&5
echo "$as_me:6632: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -8921,7 +8922,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 8924 "configure"
#line 8925 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -9021,7 +9022,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 9024 "configure"
#line 9025 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11361,11 +11362,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11364: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11365: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:11368: \$? = $ac_status" >&5
echo "$as_me:11369: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -11465,11 +11466,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11468: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11469: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:11472: \$? = $ac_status" >&5
echo "$as_me:11473: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -13026,11 +13027,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:13029: $lt_compile\"" >&5)
(eval echo "\"\$as_me:13030: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:13033: \$? = $ac_status" >&5
echo "$as_me:13034: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -13130,11 +13131,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:13133: $lt_compile\"" >&5)
(eval echo "\"\$as_me:13134: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:13137: \$? = $ac_status" >&5
echo "$as_me:13138: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -15321,11 +15322,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15324: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15325: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15328: \$? = $ac_status" >&5
echo "$as_me:15329: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -15589,11 +15590,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15592: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15593: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15596: \$? = $ac_status" >&5
echo "$as_me:15597: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -15693,11 +15694,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15696: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15697: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:15700: \$? = $ac_status" >&5
echo "$as_me:15701: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -18386,6 +18387,141 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
# needed for lua-includes
if test "${ac_cv_header_lua_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for lua.h" >&5
echo $ECHO_N "checking for lua.h... $ECHO_C" >&6; }
if test "${ac_cv_header_lua_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
{ echo "$as_me:$LINENO: result: $ac_cv_header_lua_h" >&5
echo "${ECHO_T}$ac_cv_header_lua_h" >&6; }
else
# Is the header compilable?
{ echo "$as_me:$LINENO: checking lua.h usability" >&5
echo $ECHO_N "checking lua.h usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <lua.h>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
{ echo "$as_me:$LINENO: checking lua.h presence" >&5
echo $ECHO_N "checking lua.h presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <lua.h>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: lua.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: lua.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: lua.h: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: lua.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: lua.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: lua.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: lua.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: lua.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: lua.h: see the Autoconf documentation" >&5
echo "$as_me: WARNING: lua.h: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: lua.h: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: lua.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: lua.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: lua.h: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: lua.h: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: lua.h: in the future, the compiler will take precedence" >&2;}
;;
esac
{ echo "$as_me:$LINENO: checking for lua.h" >&5
echo $ECHO_N "checking for lua.h... $ECHO_C" >&6; }
if test "${ac_cv_header_lua_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_lua_h=$ac_header_preproc
fi
{ echo "$as_me:$LINENO: result: $ac_cv_header_lua_h" >&5
echo "${ECHO_T}$ac_cv_header_lua_h" >&6; }
fi
if test $ac_cv_header_lua_h = yes; then
:
else
{ echo "$as_me:$LINENO: using lua-includefiles provided with nmap" >&5
echo "$as_me: using lua-includefiles provided with nmap" >&6;};LUAINCLUDE=-I../liblua/
fi
ac_config_files="$ac_config_files Makefile"
@ -19086,11 +19222,12 @@ FFLAGS!$FFLAGS$ac_delim
ac_ct_F77!$ac_ct_F77$ac_delim
LIBTOOL!$LIBTOOL$ac_delim
LIBTOOL_DEPS!$LIBTOOL_DEPS$ac_delim
LUAINCLUDE!$LUAINCLUDE$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 72; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View file

@ -15,6 +15,9 @@ AC_SUBST(LIBTOOL_DEPS)
AC_CANONICAL_HOST
# needed for lua-includes
AC_CHECK_HEADER([lua.h],,[AC_MSG_NOTICE(using lua-includefiles provided with nmap);[LUAINCLUDE=-I../liblua/]],)
AC_SUBST(LUAINCLUDE)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View file

@ -120,6 +120,8 @@
# endif
#endif
#include <list>
extern NmapOps o;
/* Note that a sport of 0 really will (try to) use zero as the source

View file

@ -115,6 +115,8 @@
#include "utils.h"
#include <string>
#include <vector>
#include <list>
/* Workaround for lack of namespace std on HP-UX 11.00 */
namespace std {};

View file

@ -101,6 +101,8 @@
#include "Target.h"
#include <vector>
/* Probe types */
#define PROBE_TRACE 0
#define PROBE_TTL 1