diff --git a/Makefile.in b/Makefile.in index 1ae4eb31f..9ea4b483c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -19,6 +19,7 @@ export NSOCKDIR=@NSOCKDIR@ export LIBLUADIR = @LIBLUADIR@ export NDIR=$(shell pwd) export LIBLUA_LIBS = @LIBLUA_LIBS@ +export NCATDIR=@NCATDIR@ CC = @CC@ CXX = @CXX@ CCOPT = @@ -74,7 +75,7 @@ OBJS = main.o nmap.o targets.o tcpip.o nmap_error.o utils.o idle_scan.o osscan.o .cc.o: $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ -all: @LUA_BUILD@ @PCAP_BUILD@ @PCRE_BUILD@ @DNET_BUILD@ @NBASE_BUILD@ @NSOCK_BUILD@ +all: @LUA_BUILD@ @PCAP_BUILD@ @PCRE_BUILD@ @DNET_BUILD@ @NBASE_BUILD@ @NSOCK_BUILD@ @NCAT_BUILD@ $(MAKE) $(TARGET) $(BUILDZENMAP) $(TARGET): @LUA_DEPENDS@ @PCAP_DEPENDS@ @PCRE_DEPENDS@ @DNET_DEPENDS@ $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a $(OBJS) @@ -99,6 +100,9 @@ nsock_build: $(NSOCKDIR)/src/Makefile nbase_build @echo Compiling libnsock; cd $(NSOCKDIR)/src && $(MAKE) +ncat_build: $(NCATDIR)/Makefile + cd $(NCATDIR) && $(MAKE) + lua_build: $(LIBLUADIR)/Makefile @echo Compiling liblua; cd $(LIBLUADIR) && $(MAKE) liblua.a CC="$(CC)" MYCFLAGS="$(CFLAGS) @LUA_CFLAGS@" @@ -121,7 +125,7 @@ distro: web: cd $(NMAPDEVDIR) && $(MAKE) web -clean: @LUA_CLEAN@ @PCAP_CLEAN@ @PCRE_CLEAN@ @DNET_CLEAN@ nsock_clean nbase_clean my_clean @ZENMAP_CLEAN@ +clean: @LUA_CLEAN@ @PCAP_CLEAN@ @PCRE_CLEAN@ @DNET_CLEAN@ nsock_clean nbase_clean my_clean @ZENMAP_CLEAN@ @NCAT_CLEAN@ my_clean: rm -f dependencies.mk makefile.dep @@ -136,6 +140,8 @@ nbase_clean: -cd $(NBASEDIR) && $(MAKE) clean nsock_clean: -cd $(NSOCKDIR)/src && $(MAKE) clean +ncat_clean: + -cd $(NCATDIR) && $(MAKE) clean lua_clean: -cd $(LIBLUADIR) && $(MAKE) clean zenmap_clean: @@ -152,12 +158,14 @@ nbase_dist_clean: -cd $(NBASEDIR) && $(MAKE) distclean nsock_dist_clean: -cd $(NSOCKDIR)/src && $(MAKE) distclean +ncat_dist_clean: + -cd $(NCATDIR) && $(MAKE) distclean zenmap_dist_clean: zenmap_clean -cd $(ZENMAPDIR) && rm -rf MANIFEST build/ dist/ debugclean: rm -f *.gcov *.gcda *.gcno gmon.out -distclean: my_clean my_distclean @LUA_DIST_CLEAN@ @PCAP_DIST_CLEAN@ @PCRE_DIST_CLEAN@ @DNET_DIST_CLEAN@ nbase_dist_clean nsock_dist_clean @ZENMAP_DIST_CLEAN@ +distclean: my_clean my_distclean @LUA_DIST_CLEAN@ @PCAP_DIST_CLEAN@ @PCRE_DIST_CLEAN@ @DNET_DIST_CLEAN@ nbase_dist_clean nsock_dist_clean @ZENMAP_DIST_CLEAN@ @NCAT_DIST_CLEAN@ my_distclean: rm -f Makefile Makefile.bak makefile.dep nmap_config.h stamp-h stamp-h.in \ @@ -218,10 +226,13 @@ install-nse: $(TARGET) $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib cp -f $(NSE_LIB_LUA_FILES) $(DESTDIR)$(nmapdatadir)/nselib -install: install-nmap $(INSTALLNSE) $(INSTALLZENMAP) +install-ncat: $(NCATDIR)/ncat + @cd $(NCATDIR) && $(MAKE) install + +install: install-nmap $(INSTALLNSE) $(INSTALLZENMAP) @NCAT_INSTALL@ @echo "NMAP SUCCESSFULLY INSTALLED" -uninstall: uninstall-nmap $(UNINSTALLZENMAP) +uninstall: uninstall-nmap $(UNINSTALLZENMAP) @NCAT_UNINSTALL@ uninstall-nmap: rm -f $(DESTDIR)$(bindir)/$(TARGET) @@ -237,6 +248,9 @@ uninstall-zenmap: fi rm -f $(DESTDIR)$(bindir)/xnmap +uninstall-ncat: + @cd $(NCATDIR) && $(MAKE) uninstall + ${srcdir}/configure: configure.ac cd ${srcdir} && autoconf diff --git a/aclocal.m4 b/aclocal.m4 index e81215b37..838879235 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/configure b/configure index 96de5503f..393d8ad6a 100755 --- a/configure +++ b/configure @@ -726,6 +726,12 @@ LIBNBASE_LIBS NSOCKDIR NSOCK_BUILD LIBNSOCK_LIBS +NCATDIR +NCAT_BUILD +NCAT_INSTALL +NCAT_UNINSTALL +NCAT_CLEAN +NCAT_DIST_CLEAN LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -745,7 +751,8 @@ ac_subdirs_all='libpcap libpcre libdnet-stripped nbase -nsock/src' +nsock/src +ncat' # Initialize some variables set by options. ac_init_help= @@ -1337,6 +1344,7 @@ Optional Packages: from compilation) --with-libnbase=DIR Look for nbase include/libs in DIR --with-libnsock=DIR Compile and link to libnsock in DIR + --without-ncat Skip build and installation of Ncat Some influential environment variables: CC C compiler command @@ -8677,6 +8685,40 @@ LIBNSOCK_LIBS="-lnsock" subdirs="$subdirs nsock/src" +NCATDIR="ncat" + + +# Check whether --with-ncat was given. +if test "${with_ncat+set}" = set; then + withval=$with_ncat; +else + with_ncat=check +fi + + +if test "$with_ncat" = "no"; then + NCAT_BUILD="" + NCAT_INSTALL="" + NCAT_UNINSTALL="" + NCAT_CLEAN="" + NCAT_DIST_CLEAN="" +else + NCAT_BUILD="ncat_build" + NCAT_INSTALL="install-ncat" + NCAT_UNINSTALL="uninstall-ncat" + NCAT_CLEAN="ncat_clean" + NCAT_DIST_CLEAN="ncat_dist_clean" + subdirs="$subdirs ncat" + +fi + + + + + + + + ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -9449,11 +9491,17 @@ LIBNBASE_LIBS!$LIBNBASE_LIBS$ac_delim NSOCKDIR!$NSOCKDIR$ac_delim NSOCK_BUILD!$NSOCK_BUILD$ac_delim LIBNSOCK_LIBS!$LIBNSOCK_LIBS$ac_delim +NCATDIR!$NCATDIR$ac_delim +NCAT_BUILD!$NCAT_BUILD$ac_delim +NCAT_INSTALL!$NCAT_INSTALL$ac_delim +NCAT_UNINSTALL!$NCAT_UNINSTALL$ac_delim +NCAT_CLEAN!$NCAT_CLEAN$ac_delim +NCAT_DIST_CLEAN!$NCAT_DIST_CLEAN$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` = 18; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index bedb45b41..f88b764bc 100644 --- a/configure.ac +++ b/configure.ac @@ -729,6 +729,33 @@ AC_SUBST(LIBNSOCK_LIBS) AC_CONFIG_SUBDIRS(nsock/src) +NCATDIR="ncat" + +AC_ARG_WITH(ncat, + AC_HELP_STRING([--without-ncat], [Skip build and installation of Ncat]), [], [with_ncat=check]) + +if test "$with_ncat" = "no"; then + NCAT_BUILD="" + NCAT_INSTALL="" + NCAT_UNINSTALL="" + NCAT_CLEAN="" + NCAT_DIST_CLEAN="" +else + NCAT_BUILD="ncat_build" + NCAT_INSTALL="install-ncat" + NCAT_UNINSTALL="uninstall-ncat" + NCAT_CLEAN="ncat_clean" + NCAT_DIST_CLEAN="ncat_dist_clean" + AC_CONFIG_SUBDIRS(ncat) +fi + +AC_SUBST(NCATDIR) +AC_SUBST(NCAT_BUILD) +AC_SUBST(NCAT_INSTALL) +AC_SUBST(NCAT_UNINSTALL) +AC_SUBST(NCAT_CLEAN) +AC_SUBST(NCAT_DIST_CLEAN) + AC_OUTPUT(Makefile) # Krad ASCII ART#!#@$!@#$ if test -f docs/leet-nmap-ascii-art.txt; then diff --git a/macosx/Makefile b/macosx/Makefile index fca681a60..c11e4302b 100644 --- a/macosx/Makefile +++ b/macosx/Makefile @@ -1,5 +1,5 @@ # This makefile builds a disk image (.dmg) containing the installer for Nmap -# and Zenmap. +# Zenmap, and Ncat. NMAP_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') NMAP_NUM_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_NUM_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') @@ -17,6 +17,9 @@ NMAP_STAGING_DIR = Nmap ZENMAP_BUILD_DIR = zenmap-build ZENMAP_STAGING_DIR = Zenmap +NCAT_BUILD_DIR = ncat-build +NCAT_STAGING_DIR = Ncat + PREFIX = /usr/local PACKAGEMAKER = /Developer/usr/bin/packagemaker @@ -43,7 +46,7 @@ $(IMAGE_NAME): $(IMAGE_STAGING_DIR)/$(PKG_NAME) $(EXTRA_DIST_FILES) rm -f $@ hdiutil create -imagekey zlib-level=9 -srcfolder $(IMAGE_STAGING_DIR) $@ -$(IMAGE_STAGING_DIR)/$(PKG_NAME): stage-nmap stage-zenmap README COPYING.formatted +$(IMAGE_STAGING_DIR)/$(PKG_NAME): stage-nmap stage-ncat stage-zenmap README COPYING.formatted mkdir -p $(IMAGE_STAGING_DIR) $(PACKAGEMAKER) --doc nmap.pmdoc --title "Nmap $(NMAP_VERSION)" -o $@ @@ -55,11 +58,17 @@ export-%: svn export ../zenmap $*/zenmap stage-nmap: export-$(NMAP_BUILD_DIR) - cd $(NMAP_BUILD_DIR) && ./configure --without-zenmap $(CONFIGURE_ARGS) + cd $(NMAP_BUILD_DIR) && ./configure --without-zenmap --without-ncat $(CONFIGURE_ARGS) make -C $(NMAP_BUILD_DIR) rm -rf $(NMAP_STAGING_DIR) make -C $(NMAP_BUILD_DIR) install DESTDIR="`pwd`/$(NMAP_STAGING_DIR)" +stage-ncat: export-$(NCAT_BUILD_DIR) + cd $(NCAT_BUILD_DIR) && ./configure --without-zenmap --with-ncat $(CONFIGURE_ARGS) + make -C $(NCAT_BUILD_DIR) + rm -rf $(NCAT_STAGING_DIR) + make -C $(NCAT_BUILD_DIR) install-ncat DESTDIR="`pwd`/$(NCAT_STAGING_DIR)" + # make-bundle.sh uses these to build its authorization wrapper. export CC CPPFLAGS CFLAGS CXXFLAGS LDFLAGS @@ -87,6 +96,8 @@ clean: rm -rf $(NMAP_STAGING_DIR) rm -rf $(ZENMAP_BUILD_DIR) rm -rf $(ZENMAP_STAGING_DIR) + rm -rf $(NCAT_BUILD_DIR) + rm -rf $(NCAT_STAGING_DIR) rm -f COPYING.formatted rm -f $(IMAGE_NAME) diff --git a/macosx/README b/macosx/README index 0b1af3e56..b6f643b4f 100644 --- a/macosx/README +++ b/macosx/README @@ -1,7 +1,7 @@ -Nmap is a free and open source utility for network exploration and security auditing. Zenmap is a multi-platform graphical frontend and results viewer for Nmap. +Nmap is a free and open source utility for network exploration and security auditing. Zenmap is a multi-platform graphical frontend and results viewer for Nmap. Ncat is a general-purpose network sending and receiving utility, a reimplementation of Netcat. -This package contains Nmap and Zenmap. It is intended to work on Intel and PowerPC Macs running Mac OS X 10.4 or later. +This package contains Nmap, Zenmap, and Ncat. It is intended to work on Intel and PowerPC Macs running Mac OS X 10.4 or later. -Installation of both Nmap and Zenmap is optional. Unselect Zenmap to get just the command-line tool. Unselect Nmap if you prefer to use a copy of Nmap that is already installed. Zenmap will not work without Nmap. +Installation of all three packages is optional. Unselect Zenmap to get just the command-line tools. You can unselect Nmap if you want to use Zenmap with a copy of Nmap that is already installed. Zenmap will not work without Nmap. -The nmap command-line binary will be installed in /usr/local/bin, and additional support files will be installed in /usr/local/share. The Zenmap application bundle will be installed in /Applications/Zenmap.app. +The nmap and ncat command-line binaries will be installed in /usr/local/bin, and additional support files will be installed in /usr/local/share. The Zenmap application bundle will be installed in /Applications/Zenmap.app. diff --git a/mswin32/Makefile b/mswin32/Makefile index ebbe6d4f6..262a22d86 100644 --- a/mswin32/Makefile +++ b/mswin32/Makefile @@ -29,6 +29,7 @@ winbuild: cp -a Release/nselib nmap-$(NMAP_VERSION) cp winpcap/winpcap-nmap-*.exe nmap-$(NMAP_VERSION) cp vcredist_x86.exe nmap-$(NMAP_VERSION) + cp ../ncat/Release/ncat.exe nmap-$(NMAP_VERSION) zip -r nmap-$(NMAP_VERSION)-win32.zip nmap-$(NMAP_VERSION) mkdir nmap-$(NMAP_VERSION)/zenmap cd ../zenmap && install_scripts/windows/copy_and_compile.bat diff --git a/mswin32/nmap.sln b/mswin32/nmap.sln index d5e50f179..50c1a3a65 100644 --- a/mswin32/nmap.sln +++ b/mswin32/nmap.sln @@ -22,6 +22,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dnet", "..\libdnet-stripped EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "..\liblua\liblua.vcproj", "{31FB0767-A71F-4575-8379-002D72B8AF86}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ncat", "..\ncat\ncat.vcproj", "{C1E04411-E021-468B-83F1-CB624BBA7589}" + ProjectSection(ProjectDependencies) = postProject + {31FB0767-A71F-4575-8379-002D72B8AF86} = {31FB0767-A71F-4575-8379-002D72B8AF86} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -52,6 +57,10 @@ Global {31FB0767-A71F-4575-8379-002D72B8AF86}.Debug|Win32.Build.0 = Debug|Win32 {31FB0767-A71F-4575-8379-002D72B8AF86}.Release|Win32.ActiveCfg = Release|Win32 {31FB0767-A71F-4575-8379-002D72B8AF86}.Release|Win32.Build.0 = Release|Win32 + {C1E04411-E021-468B-83F1-CB624BBA7589}.Debug|Win32.ActiveCfg = Debug|Win32 + {C1E04411-E021-468B-83F1-CB624BBA7589}.Debug|Win32.Build.0 = Debug|Win32 + {C1E04411-E021-468B-83F1-CB624BBA7589}.Release|Win32.ActiveCfg = Release|Win32 + {C1E04411-E021-468B-83F1-CB624BBA7589}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/nmap.spec.in b/nmap.spec.in index 338364273..741bb683d 100644 --- a/nmap.spec.in +++ b/nmap.spec.in @@ -1,6 +1,7 @@ # To build a static RPM, add # --define "static 1" -# to the rpmbuild command line. +# to the rpmbuild command line. To build without Ncat, add +# --define "buildncat 0" %define name nmap %define version @VERSION@ @@ -37,6 +38,9 @@ devices are also supported, including the Sharp Zaurus and the iPAQ. %build %configure --without-openssl --without-zenmap --with-libdnet=included --with-libpcap=included --with-libpcre=included --with-liblua=included +%if "%{buildncat}" == "0" +%configure --without-ncat +%endif %if "%{static}" == "1" make static %else @@ -61,11 +65,36 @@ gzip $RPM_BUILD_ROOT%{_mandir}/man1/* || : %{_bindir}/nmap %{_datadir}/nmap +# Ncat subpackage +%if "%{buildncat}" != "0" +%package -n ncat +Summary: Nmap's Netcat replacement +Group: Applications/System + +%description -n ncat +Ncat is a feature packed networking utility which will read and +write data across a network from the command line. It uses both +TCP and UDP for communication and is designed to be a reliable +back-end tool to instantly provide network connectivity to other +applications and users. Ncat will not only work with IPv4 and IPv6 +but provides the user with a virtually limitless number of potential +uses. + +%files -n ncat +%defattr(-,root,root) +%doc %{_prefix}/share/man/man1/ncat.1.gz +%{_bindir}/ncat + +%endif + %changelog * Mon Sep 08 2008 David Fifield (david(a)bamsoftware.com) - Build with --with-openssl rather than --without-openssl. +* Sun Aug 17 2008 Kris Katterjohn (katterjohn(a)gmail.com) +- Added the Ncat subpackage + * Thu Nov 08 2007 David Fifield (david(a)bamsoftware.com) - Split the zenmap subpackage into its own spec file.