Skip to content

Commit

Permalink
Merge from /nmap-exp/david/nmap-ndiff and /nmap-exp/david/zenmap-ndiff.
Browse files Browse the repository at this point in the history
  • Loading branch information
david committed Sep 18, 2008
1 parent 4c5e79b commit 1073c82
Show file tree
Hide file tree
Showing 11 changed files with 376 additions and 23 deletions.
17 changes: 15 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ LIBPCAPDIR = @libpcapdir@
LIBPCREDIR = @LIBPCREDIR@
export LIBDNETDIR = @LIBDNETDIR@
ZENMAPDIR = zenmap
NDIFFDIR = ndiff
PYTHON = @PYTHON@
DEFS = @DEFS@ -DNMAP_NAME=\"$(NMAP_NAME)\" -DNMAP_URL=\"$(NMAP_URL)\" -DNMAP_PLATFORM=\"$(NMAP_PLATFORM)\" -DNMAPDATADIR=\"$(nmapdatadir)\" -DNMAPLIBEXECDIR=\"$(nmaplibexecdir)\"
# For mtrace debugging -- see MTRACE define in main.cc for instructions
Expand Down Expand Up @@ -56,7 +57,9 @@ DESTDIR =
TARGET = nmap
INSTALLNSE=@INSTALLNSE@
BUILDZENMAP=@BUILDZENMAP@
BUILDNDIFF=@BUILDNDIFF@
INSTALLZENMAP=@INSTALLZENMAP@
INSTALLNDIFF=@INSTALLNDIFF@
UNINSTALLZENMAP=@UNINSTALLZENMAP@

ifneq (@LIBLUA_LIBS@,)
Expand All @@ -76,7 +79,7 @@ OBJS = main.o nmap.o targets.o tcpip.o nmap_error.o utils.o idle_scan.o osscan.o
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@

all: @LUA_BUILD@ @PCAP_BUILD@ @PCRE_BUILD@ @DNET_BUILD@ @NBASE_BUILD@ @NSOCK_BUILD@ @NCAT_BUILD@
$(MAKE) $(TARGET) $(BUILDZENMAP)
$(MAKE) $(TARGET) $(BUILDZENMAP) $(BUILDNDIFF)

$(TARGET): @LUA_DEPENDS@ @PCAP_DEPENDS@ @PCRE_DEPENDS@ @DNET_DEPENDS@ $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a $(OBJS)
echo Compiling nmap
Expand Down Expand Up @@ -146,6 +149,8 @@ lua_clean:
-cd $(LIBLUADIR) && $(MAKE) clean
zenmap_clean:
-cd $(ZENMAPDIR) && $(PYTHON) setup.py clean --all
ndiff_clean:
-cd $(NDIFFDIR) && $(PYTHON) setup.py clean --all
pcap_dist_clean:
-cd $(LIBPCAPDIR) && $(MAKE) distclean
pcre_dist_clean:
Expand All @@ -162,6 +167,8 @@ ncat_dist_clean:
-cd $(NCATDIR) && $(MAKE) distclean
zenmap_dist_clean: zenmap_clean
-cd $(ZENMAPDIR) && rm -rf MANIFEST build/ dist/
ndiff_dist_clean: ndiff_clean
-cd $(NDIFFDIR) && rm -rf build/ dist/
debugclean:
rm -f *.gcov *.gcda *.gcno gmon.out

Expand Down Expand Up @@ -217,6 +224,12 @@ install-zenmap: $(ZENMAPDIR)/setup.py
# Create a symlink from xnmap to zenmap unconditionally.
ln -sf zenmap $(DESTDIR)$(bindir)/xnmap

build-ndiff:
cd $(NDIFFDIR) && $(PYTHON) setup.py build $(if $(DESTDIR),--executable "$(DEFAULT_PYTHON_PATH)")

install-ndiff:
cd $(NDIFFDIR) && $(PYTHON) setup.py install --prefix "$(prefix)" $(if $(DESTDIR),--root "$(DESTDIR)")

NSE_FILES = scripts/script.db scripts/*.nse
NSE_LIB_LUA_FILES = nselib/*.lua

Expand All @@ -229,7 +242,7 @@ install-nse: $(TARGET)
install-ncat: $(NCATDIR)/ncat
@cd $(NCATDIR) && $(MAKE) install

install: install-nmap $(INSTALLNSE) $(INSTALLZENMAP) @NCAT_INSTALL@
install: install-nmap $(INSTALLNSE) $(INSTALLZENMAP) @NCAT_INSTALL@ $(INSTALLNDIFF)
@echo "NMAP SUCCESSFULLY INSTALLED"

uninstall: uninstall-nmap $(UNINSTALLZENMAP) @NCAT_UNINSTALL@
Expand Down
241 changes: 236 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,10 @@ pythondir
pkgpythondir
pyexecdir
pkgpyexecdir
BUILDNDIFF
INSTALLNDIFF
NDIFF_CLEAN
NDIFF_DIST_CLEAN
BUILDZENMAP
INSTALLZENMAP
UNINSTALLZENMAP
Expand Down Expand Up @@ -1326,6 +1330,7 @@ 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-ndiff Skip installation of the Ndiff utility
--without-zenmap Skip installation of the Zenmap graphical frontend
--with-openssl=DIR Use optional openssl libs and includes from
DIR/lib/ and DIR/include/openssl/)
Expand Down Expand Up @@ -5680,6 +5685,228 @@ if test "$ac_res" != no; then
fi
# Do they want Ndiff?
# Check whether --with-ndiff was given.
if test "${with_ndiff+set}" = set; then
withval=$with_ndiff;
else
with_ndiff=check
fi
if test "$with_ndiff" != "no"; then
if test -n "$PYTHON"; then
# If the user set $PYTHON, use it and don't search something else.
{ echo "$as_me:$LINENO: checking whether $PYTHON version >= 2.4" >&5
echo $ECHO_N "checking whether $PYTHON version >= 2.4... $ECHO_C" >&6; }
prog="import sys, string
# split strings by '.' and convert to numeric. Append some zeros
# because we need at least 4 digits for the hex conversion.
minver = map(int, string.split('2.4', '.')) + [0, 0, 0]
minverhex = 0
for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i]
sys.exit(sys.hexversion < minverhex)"
if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5
($PYTHON -c "$prog") >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
else
{ { echo "$as_me:$LINENO: error: too old" >&5
echo "$as_me: error: too old" >&2;}
{ (exit 1); exit 1; }; }
fi
am_display_PYTHON=$PYTHON
else
# Otherwise, try each interpreter until we find one that satisfies
# VERSION.
{ echo "$as_me:$LINENO: checking for a Python interpreter with version >= 2.4" >&5
echo $ECHO_N "checking for a Python interpreter with version >= 2.4... $ECHO_C" >&6; }
if test "${am_cv_pathless_PYTHON+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
for am_cv_pathless_PYTHON in python python2 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 none; do
test "$am_cv_pathless_PYTHON" = none && break
prog="import sys, string
# split strings by '.' and convert to numeric. Append some zeros
# because we need at least 4 digits for the hex conversion.
minver = map(int, string.split('2.4', '.')) + [0, 0, 0]
minverhex = 0
for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i]
sys.exit(sys.hexversion < minverhex)"
if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5
($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
break
fi
done
fi
{ echo "$as_me:$LINENO: result: $am_cv_pathless_PYTHON" >&5
echo "${ECHO_T}$am_cv_pathless_PYTHON" >&6; }
# Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
if test "$am_cv_pathless_PYTHON" = none; then
PYTHON=:
else
# Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args.
set dummy $am_cv_pathless_PYTHON; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_path_PYTHON+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $PYTHON in
[\\/]* | ?:[\\/]*)
ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
PYTHON=$ac_cv_path_PYTHON
if test -n "$PYTHON"; then
{ echo "$as_me:$LINENO: result: $PYTHON" >&5
echo "${ECHO_T}$PYTHON" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
am_display_PYTHON=$am_cv_pathless_PYTHON
fi
if test "$PYTHON" = :; then
if test "$with_ndiff" = "check"; then
{ echo "$as_me:$LINENO: WARNING: Not building Ndiff because Python 2.4 or later was not found" >&5
echo "$as_me: WARNING: Not building Ndiff because Python 2.4 or later was not found" >&2;}
else
{ { echo "$as_me:$LINENO: error: --with-ndiff requires Python 2.4 or later
See \`config.log' for more details." >&5
echo "$as_me: error: --with-ndiff requires Python 2.4 or later
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
with_ndiff=no
else
{ echo "$as_me:$LINENO: checking for $am_display_PYTHON version" >&5
echo $ECHO_N "checking for $am_display_PYTHON version... $ECHO_C" >&6; }
if test "${am_cv_python_version+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
am_cv_python_version=`$PYTHON -c "import sys; print sys.version[:3]"`
fi
{ echo "$as_me:$LINENO: result: $am_cv_python_version" >&5
echo "${ECHO_T}$am_cv_python_version" >&6; }
PYTHON_VERSION=$am_cv_python_version
PYTHON_PREFIX='${prefix}'
PYTHON_EXEC_PREFIX='${exec_prefix}'
{ echo "$as_me:$LINENO: checking for $am_display_PYTHON platform" >&5
echo $ECHO_N "checking for $am_display_PYTHON platform... $ECHO_C" >&6; }
if test "${am_cv_python_platform+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`
fi
{ echo "$as_me:$LINENO: result: $am_cv_python_platform" >&5
echo "${ECHO_T}$am_cv_python_platform" >&6; }
PYTHON_PLATFORM=$am_cv_python_platform
{ echo "$as_me:$LINENO: checking for $am_display_PYTHON script directory" >&5
echo $ECHO_N "checking for $am_display_PYTHON script directory... $ECHO_C" >&6; }
if test "${am_cv_python_pythondir+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
fi
{ echo "$as_me:$LINENO: result: $am_cv_python_pythondir" >&5
echo "${ECHO_T}$am_cv_python_pythondir" >&6; }
pythondir=$am_cv_python_pythondir
pkgpythondir=\${pythondir}/$PACKAGE
{ echo "$as_me:$LINENO: checking for $am_display_PYTHON extension module directory" >&5
echo $ECHO_N "checking for $am_display_PYTHON extension module directory... $ECHO_C" >&6; }
if test "${am_cv_python_pyexecdir+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`
fi
{ echo "$as_me:$LINENO: result: $am_cv_python_pyexecdir" >&5
echo "${ECHO_T}$am_cv_python_pyexecdir" >&6; }
pyexecdir=$am_cv_python_pyexecdir
pkgpyexecdir=\${pyexecdir}/$PACKAGE
fi
fi
if test "$with_ndiff" = "no"; then
BUILDNDIFF=""
INSTALLNDIFF=""
NDIFF_CLEAN=""
NDIFF_DIST_CLEAN=""
else
BUILDNDIFF=build-ndiff
INSTALLNDIFF=install-ndiff
NDIFF_CLEAN=ndiff_clean
NDIFF_DIST_CLEAN=ndiff_dist_clean
fi
# Do they want Zenmap?
# Check whether --with-zenmap was given.
Expand Down Expand Up @@ -9413,6 +9640,10 @@ pythondir!$pythondir$ac_delim
pkgpythondir!$pkgpythondir$ac_delim
pyexecdir!$pyexecdir$ac_delim
pkgpyexecdir!$pkgpyexecdir$ac_delim
BUILDNDIFF!$BUILDNDIFF$ac_delim
INSTALLNDIFF!$INSTALLNDIFF$ac_delim
NDIFF_CLEAN!$NDIFF_CLEAN$ac_delim
NDIFF_DIST_CLEAN!$NDIFF_DIST_CLEAN$ac_delim
BUILDZENMAP!$BUILDZENMAP$ac_delim
INSTALLZENMAP!$INSTALLZENMAP$ac_delim
UNINSTALLZENMAP!$UNINSTALLZENMAP$ac_delim
Expand All @@ -9430,10 +9661,6 @@ LIBPCREDIR!$LIBPCREDIR$ac_delim
PCRE_DEPENDS!$PCRE_DEPENDS$ac_delim
PCRE_BUILD!$PCRE_BUILD$ac_delim
PCRE_CLEAN!$PCRE_CLEAN$ac_delim
PCRE_DIST_CLEAN!$PCRE_DIST_CLEAN$ac_delim
LIBDNET_LIBS!$LIBDNET_LIBS$ac_delim
LIBDNETDIR!$LIBDNETDIR$ac_delim
DNET_DEPENDS!$DNET_DEPENDS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
Expand Down Expand Up @@ -9475,6 +9702,10 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
PCRE_DIST_CLEAN!$PCRE_DIST_CLEAN$ac_delim
LIBDNET_LIBS!$LIBDNET_LIBS$ac_delim
LIBDNETDIR!$LIBDNETDIR$ac_delim
DNET_DEPENDS!$DNET_DEPENDS$ac_delim
DNET_BUILD!$DNET_BUILD$ac_delim
DNET_CLEAN!$DNET_CLEAN$ac_delim
DNET_DIST_CLEAN!$DNET_DIST_CLEAN$ac_delim
Expand All @@ -9501,7 +9732,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 28; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Expand Down
28 changes: 28 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,34 @@ dnl If any socket libraries needed
AC_SEARCH_LIBS(setsockopt, socket)
AC_SEARCH_LIBS(gethostbyname, nsl)

# Do they want Ndiff?
AC_ARG_WITH(ndiff, AC_HELP_STRING([--without-ndiff], [Skip installation of the Ndiff utility]), [], [with_ndiff=check])

if test "$with_ndiff" != "no"; then
AM_PATH_PYTHON([2.4], [],
[if test "$with_ndiff" = "check"; then
AC_MSG_WARN([Not building Ndiff because Python 2.4 or later was not found])
else
AC_MSG_FAILURE([--with-ndiff requires Python 2.4 or later])
fi
with_ndiff=no])
fi
if test "$with_ndiff" = "no"; then
BUILDNDIFF=""
INSTALLNDIFF=""
NDIFF_CLEAN=""
NDIFF_DIST_CLEAN=""
else
BUILDNDIFF=build-ndiff
INSTALLNDIFF=install-ndiff
NDIFF_CLEAN=ndiff_clean
NDIFF_DIST_CLEAN=ndiff_dist_clean
fi
AC_SUBST(BUILDNDIFF)
AC_SUBST(INSTALLNDIFF)
AC_SUBST(NDIFF_CLEAN)
AC_SUBST(NDIFF_DIST_CLEAN)

# Do they want Zenmap?
AC_ARG_WITH(zenmap, AC_HELP_STRING([--without-zenmap], [Skip installation of the Zenmap graphical frontend]), [], [with_zenmap=check])

Expand Down
Loading

0 comments on commit 1073c82

Please sign in to comment.