diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/BUNDLING.md | 130 | ||||
-rw-r--r-- | macosx/Makefile | 187 | ||||
-rw-r--r-- | macosx/README.md | 96 | ||||
-rwxr-xr-x | macosx/check_test.sh | 124 | ||||
-rwxr-xr-x | macosx/createdmg.sh | 76 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/01nmap-contents.xml | 3 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/01nmap.xml | 25 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/02zenmap-contents.xml | 3 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/02zenmap.xml | 37 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/03ncat-contents.xml | 3 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/03ncat.xml | 25 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/04ndiff-contents.xml | 3 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/04ndiff.xml | 25 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/05nping-contents.xml | 3 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/05nping.xml | 25 | ||||
-rw-r--r-- | macosx/nmap.pmdoc/index.xml | 56 | ||||
-rw-r--r-- | macosx/nmap.png | bin | 0 -> 116077 bytes | |||
-rw-r--r-- | macosx/openssl.modules | 81 | ||||
-rw-r--r-- | macosx/pkg_bg.jpg | bin | 0 -> 200397 bytes |
19 files changed, 902 insertions, 0 deletions
diff --git a/macosx/BUNDLING.md b/macosx/BUNDLING.md new file mode 100644 index 0000000..904144e --- /dev/null +++ b/macosx/BUNDLING.md @@ -0,0 +1,130 @@ +# Table of Contents +--- + + * [Jhbuild](#jhbuild) + * Possible error + * [gtk-mac-bundler](#bundler) + * [How to use](#howto) + * Prerequisite + * Usage + +## <a name="jhbuild"></a>Jhbuild + +In order to set up Jhbuild properly before building Nmap suite, follow the tutorial at [https://wiki.gnome.org/Projects/GTK%2B/OSX/Building](https://wiki.gnome.org/Projects/GTK%2B/OSX/Building), but keep reading this file if you encounter any error... + +If you had any error, just type the following command to delete jhbuild, + + $ rm -rf ~/.local ~/.new_local ~/.cache ~/.config ~/Source/jhbuild ~/Source/pyenv ~/Library/Caches/pip* ~/gtk + +And we'll start over together: + +1. First, simply download the following script in your _$HOME_ directory ([https://git.gnome.org/browse/gtk-osx/plain/gtk-osx-build-setup.sh](https://git.gnome.org/browse/gtk-osx/plain/gtk-osx-build-setup.sh)). Edit it to make sure that `MACOSX_DEPLOYMENT_TARGET` exists and is set to the lowest supported version of OS X, e.g. "10.11". Then run it: + + ~~~~ + $ sh gtk-osx-build-setup.sh + ~~~~ + + And add it to your _$PATH_, so you can run jhbuild without the absolute path: + + ~~~~ + $ export PATH=$HOME/.local/bin:$PATH + ~~~~ + +2. In `~/.jhbuildrc-custom`, make sure that this line is setup properly and matches `MACOSX_DEPLOYMENT_TARGET` from step 1: + + ~~~~ + setup_sdk(target="10.11") + ~~~~ + +3. Now do, + + ~~~~ + $ jhbuild bootstrap-gtk-osx + ~~~~ + + To install missing dependencies (with **--force** option to force rebuilding).<br/> + +4. And, + + ~~~~ + $ jhbuild build meta-gtk-osx-bootstrap + $ jhbuild build meta-gtk-osx-core + +5. Now we need Python2 and the GTK2 bindings for it, but gtk-osx has built +Python3, and the bindings will prefer that even though the dev headers aren't +present. Specifically, we need pycairo prior to 1.19 (when they dropped Python2 +support) and gtk-integration-python. There's got to be a better way, but what I +did was first install python2: + + $ jhbuild build python + +Then install pycairo. This is necessary because if it's missing for Python 2, +the other bindings won't build for Python 2 either. Make sure version is less +than 1.19 in ~/.cache/jhbuild/gtk-osx-python.modules. This may "succeed" but it +will have built the Python3 bindings. Clear out the build tree and make sure +the source will prefer python2: + + $ jhbuild build pycairo + $ rm -rf ~/.cache/jhbuild/build/pycairo-* + $ sed -i 's/python3/python2/' ~/gtk/source/pycairo-*/meson_options.txt + $ jhbuild build pycairo + +Now build the rest of the python bindings. Some of these will fail (and maybe +they failed as prereqs for pycairo earlier), so hang on and I'll tell you how +to fix those: + + $ jhbuild build meta-gtk-osx-python + +Ok, when you get a failure, that's your chance to reconfigure with python2. +Jhbuild will give you some options; choose "4. start a shell" and then check +for the proper configuration command (may be visible in scrollback, otherwise +check config.log) and copy it. Clear out the build directory (probably the +current directory, ~/.cache/jhbuild/build/package-name-version/*) then from +there run the configuration command with PYTHON variable overridden, e.g.: + + $ PYTHON=$(which python2) ~/gtk/source/package-name-version/configure --some-options + +Now exit that shell and go to the build step. This might mean "ignore error and +continue with build" or it might mean "rerun step build" depending on when the +error happened. + +### Possible error + +For those of you who have this error while trying to make, + +~~~~ +svn: E155021: This client is too old to work with the working copy at... +~~~~ + +You need to **update SVN**.<br/> +Go to [http://www.wandisco.com/subversion/download#osx](http://www.wandisco.com/subversion/download#osx) and download and install the approriate version for your OS. + +Now, add the path for the new SVN version to your _$PATH_: + +~~~~ +$ export PATH=/opt/subversion/bin:$PATH +~~~~ + +## <a name="bundler"></a>gtk-mac-bundler + +Now that Jhbuild is properly configured, we need to install **gtk-mac-bundler** in order to render the bundle file: + +~~~~ +$ git clone git://git.gnome.org/gtk-mac-bundler +$ cd gtk-mac-bundler +$ make install +~~~~ + +## <a name="howto"></a>How to use +#### Prerequisite: +—`openssl.modules`: + +This is a jhbuild moduleset that can be used to build/update openssl. + +#### Usage: + +Now use it like this: + +~~~~ +$ jhbuild -m openssl.modules build nmap-deps +~~~~ diff --git a/macosx/Makefile b/macosx/Makefile new file mode 100644 index 0000000..a9e7327 --- /dev/null +++ b/macosx/Makefile @@ -0,0 +1,187 @@ +# This makefile builds a disk image (.dmg) containing the installer for Nmap, +# Zenmap, Ncat, and Ndiff. + +export NMAP_VERSION := $(shell echo NMAP_VERSION | $(CPP) -imacros ../nmap.h - | sed -n '$$s/[" ]//g;$$p') +OSX_VERSION=$(shell sw_vers -productVersion | cut -d'.' -f1,2 | tr -d ' ') +OSX_MIN_VERSION = 10.15 + +NAME_VERSION = nmap-$(NMAP_VERSION)$(if $(APPENDAGE),-$(APPENDAGE)) + +IMAGE_NAME = $(NAME_VERSION).dmg +PKG_NAME = $(NAME_VERSION).mpkg + +IMAGE_STAGING_DIR = $(NAME_VERSION) + +NMAP_BUILD_DIR = nmap-build +NMAP_STAGING_DIR = nmap-root + +ZENMAP_BUILD_DIR = zenmap-build +ZENMAP_STAGING_DIR = zenmap-root + +NCAT_BUILD_DIR = ncat-build +NCAT_STAGING_DIR = ncat-root + +NDIFF_BUILD_DIR = ndiff-build +NDIFF_STAGING_DIR = ndiff-root + +NPING_BUILD_DIR = nping-build +NPING_STAGING_DIR = nping-root + +JHBUILD_PREFIX=$(HOME)/gtk/inst +JHBUILD_SOURCE=$(HOME)/gtk/source +PREFIX = /usr/local + +# Extra distribution file names +README_FILE = README.md +LICENSE_FILE = LICENSE +3RD_P_LIC_FILE = 3rd-party-licenses.txt +LICENSES_FILE = licenses + +EXTRA_DIST = README.md ../LICENSE ../docs/3rd-party-licenses.txt ../docs/licenses + +CONFIGURE_ARGS = --prefix="$(PREFIX)" --with-libdnet=included --with-libpcap=included --with-libpcre=included --with-liblua=included CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" PYTHON="$(PYTHON)" + +CFLAGS = -mmacosx-version-min=$(OSX_MIN_VERSION) +CXXFLAGS = -mmacosx-version-min=$(OSX_MIN_VERSION) + +# Jhbuild static libraries +PYTHON = $(JHBUILD_PREFIX)/bin/python3 +OPENSSL_STATIC = $(JHBUILD_PREFIX)/lib/libssl.a $(JHBUILD_PREFIX)/lib/libcrypto.a +LIBZ_STATIC = $(JHBUILD_PREFIX)/lib/libz.a + +# These are the positions used by the createdmg.sh and check_test.sh scripts +export ICON_SIZE=88 +export FONT_SIZE=13 +export MPKG_POS_X=110 +export MPKG_POS_Y=170 +export APPS_POS_X=110 +export APPS_POS_Y=310 +export README_POS_X=802 +export README_POS_Y=180 +export LICENSE_POS_X=802 +export LICENSE_POS_Y=310 +export THIRD_P_POS_X=802 +export THIRD_P_POS_Y=440 +export LICENSES_POS_X=670 +export LICENSES_POS_Y=60 + +$(IMAGE_NAME): tool-checks $(IMAGE_STAGING_DIR)/$(PKG_NAME) + rm -f $@ + # Create the dmg disk image and convert it to read only disk + ./createdmg.sh $(IMAGE_STAGING_DIR) $(README_FILE) $(LICENSE_FILE) $(3RD_P_LIC_FILE) $(LICENSES_FILE) + # Check the created disk image for the sizes, backgrounds and icons presence and positions + ./check_test.sh $(README_FILE) $(LICENSE_FILE) $(3RD_P_LIC_FILE) $(LICENSES_FILE) + +tool-checks: have-$(CC) have-jhbuild have-gtk-mac-bundler + +have-%: + which $* + +#$(IMAGE_STAGING_DIR)/$(PKG_NAME): check-nmap check-ncat check-ndiff check-zenmap check-nping LICENSE.formatted +$(IMAGE_STAGING_DIR)/$(PKG_NAME): check-nmap check-ncat check-ndiff check-zenmap check-nping LICENSE.formatted + rm -rf $(IMAGE_STAGING_DIR) + mkdir -p $(IMAGE_STAGING_DIR) + cp -rf $(EXTRA_DIST) $(IMAGE_STAGING_DIR)/ + # Create packages (.pkg) for all the components to install in the installer (.mpkg) + pkgbuild --root $(NMAP_STAGING_DIR) --identifier org.insecure.nmap --version $(NMAP_VERSION) --install-location /usr/local nmap.pkg + pkgbuild --root $(NCAT_STAGING_DIR) --identifier org.insecure.nmap.ncat --version $(NMAP_VERSION) --install-location /usr/local ncat.pkg + pkgbuild --root $(NDIFF_STAGING_DIR)/usr/local --identifier org.insecure.nmap.ndiff --version $(NMAP_VERSION) --install-location /usr/local ndiff.pkg + pkgbuild --root $(NPING_STAGING_DIR) --identifier org.insecure.nmap.nping --version $(NMAP_VERSION) --install-location /usr/local nping.pkg + pkgbuild --root $(ZENMAP_STAGING_DIR) --identifier org.insecure.nmap.zenmap --version $(NMAP_VERSION) --install-location /Applications zenmap.pkg + + # Produce a .xml with packages information + productbuild --synthesize \ + --package 'nmap.pkg' \ + --package 'ncat.pkg' \ + --package 'ndiff.pkg' \ + --package 'nping.pkg' \ + --package 'zenmap.pkg' \ + distribution.xml + + # Make a new file and add background and title attributes + head -n 2 distribution.xml > finalDist.xml + echo " <title>Nmap $(NMAP_VERSION)</title>" >> finalDist.xml + # This line is for adding a background image to the .mpkg + echo " <background file=\"pkg_bg.jpg\" mime-type=\"image/jpeg\" scaling=\"proportional\" alignment=\"bottomleft\"/>" >> finalDist.xml + tail -n +3 distribution.xml >> finalDist.xml + + # Build the .mpkg according to the final .xml file (and so all the .pkg) + productbuild --distribution finalDist.xml --resources . --package-path . $(NAME_VERSION).mpkg + + mv $(NAME_VERSION).mpkg $(NAME_VERSION)/$(NAME_VERSION).mpkg + +check-%: stage-% + (find $*-root -perm -a+x -type f | xargs otool -L | awk '/:$$/{e=$$0}index($$0,"$(JHBUILD_PREFIX)"){x=1;print e; print}END{exit x}') && echo "Libs are clean" + +export-%: + rm -rf $* +# Using @BASE discards local changes. + svn export .. $* + +export-tarball: + rm -rf nmap-$(NMAP_VERSION) + svn export .. nmap-$(NMAP_VERSION) + tar czf nmap-$(NMAP_VERSION).tar.gz nmap-$(NMAP_VERSION) + cp nmap-$(NMAP_VERSION).tar.gz $(JHBUILD_SOURCE)/pkgs/ + +xstage-nmap: export-$(NMAP_BUILD_DIR) + cd $(NMAP_BUILD_DIR) && ./configure --without-zenmap --without-ncat --without-ndiff --without-nping --with-openssl="$(JHBUILD_PREFIX)" --with-libz="$(JHBUILD_PREFIX)" $(CONFIGURE_ARGS) + # LIB* is libssh2's name for *_LIBS + make -C $(NMAP_BUILD_DIR) OPENSSL_LIBS="$(OPENSSL_STATIC)" LIBSSL="$(OPENSSL_STATIC)" ZLIB_LIBS="$(LIBZ_STATIC)" LIBZ="$(LIBZ_STATIC)" + rm -rf $(NMAP_STAGING_DIR) + make -C $(NMAP_BUILD_DIR) install DESTDIR="`pwd`/$(NMAP_STAGING_DIR)" OPENSSL_LIBS="$(OPENSSL_STATIC)" ZLIB_LIBS="$(LIBZ_STATIC)" + +xstage-ncat: export-$(NCAT_BUILD_DIR) + cd $(NCAT_BUILD_DIR) && ./configure --without-zenmap --with-ncat --without-ndiff --without-nping --with-openssl="$(JHBUILD_PREFIX)" $(CONFIGURE_ARGS) + make -C $(NCAT_BUILD_DIR) build-ncat OPENSSL_LIBS="$(OPENSSL_STATIC)" + rm -rf $(NCAT_STAGING_DIR) + make -C $(NCAT_BUILD_DIR) install-ncat DESTDIR="`pwd`/$(NCAT_STAGING_DIR)" OPENSSL_LIBS="$(OPENSSL_STATIC)" + +xstage-nping: export-$(NPING_BUILD_DIR) + cd $(NPING_BUILD_DIR) && ./configure --without-zenmap --without-ncat --without-ndiff --with-nping --with-openssl="$(JHBUILD_PREFIX)" $(CONFIGURE_ARGS) + make -C $(NPING_BUILD_DIR) build-nping OPENSSL_LIBS="$(OPENSSL_STATIC)" + rm -rf $(NPING_STAGING_DIR) + make -C $(NPING_BUILD_DIR) install-nping DESTDIR="`pwd`/$(NPING_STAGING_DIR)" OPENSSL_LIBS="$(OPENSSL_STATIC)" + +openssl.modules: ../nmap.h + sed -i.bak '/ENTITY nmap_version/s/\".*\"/\"$(NMAP_VERSION)\"/' $@ + +stage-%: export-tarball openssl.modules + jhbuild -m "file://`pwd`/openssl.modules" build $* + rm -rf $*-root + mkdir $*-root + rsync -a --files-from "$(JHBUILD_PREFIX)/_jhbuild/manifests/$*" "$(JHBUILD_PREFIX)" $*-root/ + +stage-zenmap: export-$(ZENMAP_BUILD_DIR) + cd $(ZENMAP_BUILD_DIR)/zenmap && jhbuild run install_scripts/macosx/make-bundle.sh + rm -rf $(ZENMAP_STAGING_DIR) + mkdir -p $(ZENMAP_STAGING_DIR) + cp -rf $(ZENMAP_BUILD_DIR)/zenmap/dist/Zenmap.app $(ZENMAP_STAGING_DIR) + +stage-ndiff: export-$(NDIFF_BUILD_DIR) + mkdir -p $(NDIFF_STAGING_DIR)/usr/local/bin + mkdir -p $(NDIFF_STAGING_DIR)/usr/local/share/man/man1 + cp $(NDIFF_BUILD_DIR)/ndiff/ndiff.py $(NDIFF_STAGING_DIR)/usr/local/bin/ndiff + cp $(NDIFF_BUILD_DIR)/ndiff/docs/ndiff.1 $(NDIFF_STAGING_DIR)/usr/local/share/man/man1/ + +LICENSE.formatted: +# Use the license formatter from the Windows installer. + ../mswin32/license-format/licformat.sh ../LICENSE > $@ + +clean: + rm -rf $(IMAGE_STAGING_DIR) + rm -rf $(NMAP_BUILD_DIR) + 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 -rf $(NDIFF_BUILD_DIR) + rm -rf $(NDIFF_STAGING_DIR) + rm -rf $(NPING_BUILD_DIR) + rm -rf $(NPING_STAGING_DIR) + rm -f LICENSE.formatted + rm -f $(IMAGE_NAME) + rm -rf distribution.xml finalDist.xml nmap.pkg ncat.pkg ndiff.pkg nping.pkg zenmap.pkg + +.PHONY: clean export-% stage-% diff --git a/macosx/README.md b/macosx/README.md new file mode 100644 index 0000000..c79fdb3 --- /dev/null +++ b/macosx/README.md @@ -0,0 +1,96 @@ +# Table of Contents +--- + + * [Introduction](#intro) + * [Requirements](#requ) + * [Installation](#install) + * [Files in this directory](#files) + * [Zenmap](#zenmap) + * [Repositories and Troubleshooting](#repo) + * [The CONTRIBUTING file](#contributing) + +## <a name="intro"></a>Introduction + + * **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. + * **Ndiff** is a an Nmap scan comparison utility. + * **Nping** is a tool for packet generation and sending. + +This package contains Nmap, Zenmap, Ncat, Ndiff, and Nping. It is intended to work on Intel Macs running **Mac OS X 10.8 or later**. + +Installation of all packages 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. + +The nmap, ncat, ndiff, and nping 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`. + +For a full description of Nmap's installation on Mac OS, visit the page: +[https://nmap.org/book/inst-macosx.html](https://nmap.org/book/inst-macosx.html) + +## <a name="requ"></a>Requirements + +In order to compile, build and run Nmap on Mac OS, you will requiere the followings: + +1. **Jhbuild** for bundling and dependencies (see the [BUNDLING file](../BUNDLING.md)) +2. **Xcode** for Mac OS 10.8 or later ([https://developer.apple.com/xcode](https://developer.apple.com/xcode/)) +3. **Xcode Command-line Tools** for Mac OS 10.8 or later ([https://developer.apple.com/downloads](https://developer.apple.com/downloads/) — then download the latest version compatible with your OS version) + +## <a name="install"></a>Installation + +Ideally, you should be able to just type: + + ./configure + make + make install + +from `nmap/` directory (the root folder). + +For far more in-depth compilation, installation, and removal notes, read the **Nmap Install Guide** at [https://nmap.org/book/install.html](https://nmap.org/book/install.html). + +## <a name="files"></a>Files in this directory + +* [openssl.modules](openssl.modules): This is a Jhbuild moduleset that can be used to build dependencies (openssl) as required for building Nmap, Ncat, and Nping. Use it like this: + + ~~~~ + $ jhbuild -m openssl.modules build nmap-deps + ~~~~ + +* [Makefile](Makefile): The Mac OS X Makefile used to build everything specific to this OS. +* [BUNDLING.md](BUNDLING.md): A manual on how to setup and use Jhbuild on Mac OS X. + +## <a name="zenmap"></a>Zenmap + +### Files into `zenmap/install_scripts/macosx/`: + +All of the files have to do with packaging on Mac OS X. They are useful only for those wanting to build binary distributions of Zenmap for Mac OS X. + +* [Info.plist](../zenmap/install_scripts/macosx/Info.plist): A properties list file template that is filled out by [make-bundle.sh](../zenmap/install_scripts/macosx/make-bundle.sh). +* [make-bundle.sh](../zenmap/install_scripts/macosx/make-bundle.sh): This script builds a .app bundle. It must be run from the root of the Zenmap source tree. The finished bundle is put in `dist/Zenmap.app`. +* [zenmap.icns](../zenmap/install_scripts/macosx/zenmap.icns): The icon file for the bundle. It was created using the Icon Composer utility (`$ open -a "Icon Composer"`). +* [zenmap_auth.c](../zenmap/install_scripts/macosx/zenmap_auth.c): This is a simple wrapper program that attempts to run [launcher.sh](../zenmap/install_scripts/macosx/launcher.sh) with privileges. +* [launcher.sh](../zenmap/install_scripts/macosx/launcher.sh): A launcher script that configures the environment for Zenmap, Python, and GTK before launching the main Zenmap script file. +* [zenmap.bundle](../zenmap/install_scripts/macosx/zenmap.bundle): An XML configuration file for gtk-mac-bundler which specifies files and metadata for the application bundle ([https://wiki.gnome.org/Projects/GTK%2B/OSX/Building](https://wiki.gnome.org/Projects/GTK%2B/OSX/Building)). + +### Authorization Wrapper: + +The **bundling** process is as follows: + +1. First, the bundler ([make-bundle.sh](../zenmap/install_scripts/macosx/make-bundle.sh)) look at the bundle XML (`zenmap.bundle`) and copy everything over. +2. The launcher script ([launcher.sh](../zenmap/install_scripts/macosx/launcher.sh)) gets renamed into the app name (`Zenmap`). +3. The authorization wrapper is compiled to `Zenmap` so that it is the entry point of the app. +4. The last part is filling in the [Info.plist template file](../zenmap/install_scripts/macosx/Info.plist) based on the current information in `zenmap.ZenmapCore.Version`. + +After the bundling process is done and the app is installed, the **execution** path is as follows: + +**Zenmap (zenmap_auth) —> zenmap.bin (launcher.sh) —> python zenmap.py** + +## <a name="repo"></a>Repositories and Troubleshooting + +Nmap uses a read-only repository on **Github** for issues tracking and pull requests. You can contribute at the following address: [https://github.com/nmap/nmap](https://github.com/nmap/nmap). + +The read-write repository is managed with **Subversion**. Although, all actual commits are made to our Subversion repository on [https://svn.nmap.org](https://svn.nmap.org/). + +In order to be always up to date, you can consult the Changelog here: [https://nmap.org/changelog.html](https://nmap.org/changelog.html). + +## <a name="contributing"></a>The CONTRIBUTING file + +General information about contributing to Nmap can be found in the [CONTRIBUTING file](../CONTRIBUTING.md). It contains information specifically about Nmap's use of Github and how contributors can use Github services to participate in **Nmap development**. diff --git a/macosx/check_test.sh b/macosx/check_test.sh new file mode 100755 index 0000000..b547401 --- /dev/null +++ b/macosx/check_test.sh @@ -0,0 +1,124 @@ +#!/bin/sh -e + +test -n "${NMAP_VERSION}" || exit 1 +export title="nmap-${NMAP_VERSION}" +export disk="/Volumes/${title}" +export backgroundPictureName="nmap.png" +export finalDMGName="${title}.dmg" +export applicationName="${title}.mpkg" +RES="True" +NB_FILES=7 + +hdiutil attach ${finalDMGName} + +# Try to list files in the Volume, if we can't, its because its not ready yet +# so we should sleep while its mounted before trying to check if everything is ok +stop=false +while [ "$stop" = false ]; do + test=`ls -l /Volumes/${title}/ | wc -l` + if [ "$test" -eq $NB_FILES ]; then + stop=true + fi + sleep 1 +done + +echo "\nDisk: ${disk}" +echo "Checking positions...\n" + +export MPKG=`echo ' + tell application "Finder" + set f to POSIX file "'${disk}'/'${applicationName}'" as alias + get properties of f + end tell +' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'` + +export README=`echo ' + tell application "Finder" + set f to POSIX file "'${disk}'/'$1'" as alias + get properties of f + end tell +' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'` + +export LICENSE=`echo ' + tell application "Finder" + set f to POSIX file "'${disk}'/'$2'" as alias + get properties of f + end tell +' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'` + +export LICENSES_3RD=`echo ' + tell application "Finder" + set f to POSIX file "'${disk}'/'$3'" as alias + get properties of f + end tell +' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'` + +export LICENSES=`echo ' + tell application "Finder" + set f to POSIX file "'${disk}'/'$4'" as alias + get properties of f + end tell +' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'` + +if [ "$MPKG" = "$MPKG_POS_X, $MPKG_POS_Y" ]; then + echo "${applicationName}: OK" +else + echo "${applicationName}: Wrong" + RES="False" +fi; + +if [ "$README" = "$README_POS_X, $README_POS_Y" ]; then + echo "README.md: OK" +else + echo "README.md: Wrong" + RES="False" +fi; + +if [ "$LICENSE" = "$LICENSE_POS_X, $LICENSE_POS_Y" ]; then + echo "LICENSE: OK" +else + echo "LICENSE: Wrong" + RES="False" +fi; + +if [ "$LICENSES_3RD" = "$THIRD_P_POS_X, $THIRD_P_POS_Y" ]; then + echo "3rd-party-licenses.txt: OK" +else + echo "3rd-party-licenses.txt: Wrong" + RES="False" +fi; + +if [ "$LICENSES" = "$LICENSES_POS_X, $LICENSES_POS_Y" ]; then + echo "licenses: OK" +else + echo "licenses: Wrong" + RES="False" +fi; + +export BG=`echo ' + tell application "Finder" + set f to POSIX file "'${disk}'/.background/'${backgroundPictureName}'" as alias + if exists file f then + return true + else + return false + end if + end tell +' | osascript` + +if [ "$BG" = "true" ]; then + echo "\nBackground exists: Yes\n" +else + echo "\nBackground exists: No\n" + RES="False" +fi; + +hdiutil detach ${disk} + +if [ "$RES" = "True" ]; then + echo "\nTest passed?: Yes\n" + exit 0 +else + echo "\nTest passed?: No\nThere are some errors that should be corrected\n" + exit 1 +fi; diff --git a/macosx/createdmg.sh b/macosx/createdmg.sh new file mode 100755 index 0000000..1c80507 --- /dev/null +++ b/macosx/createdmg.sh @@ -0,0 +1,76 @@ +#!/bin/sh -e +set -x + +test -n "${NMAP_VERSION}" || exit 1 +export source=$1 +export title="nmap-${NMAP_VERSION}" +export size=50000 +export backgroundPictureName="nmap.png" +export finalDMGName="${title}.dmg" +export applicationName="${title}.mpkg" +NB_FILES=7 + +rm -rf ${source}/.background/${backgroundPictureName} +rm -rf ${source}/.background/ +rm -rf pack.temp.dmg +rm -rf ${title}.dmg +rm -rf ${source}/Applications + +# Copy the background image to the background of the image disk +mkdir ${source}/.background/ +cp ${backgroundPictureName} ${source}/.background/ +ln -s /Applications ${source}/ + +# Ensure that we have no virtual disk currently mounted +hdiutil detach /Volumes/${title}/ 2> /dev/null || true + +hdiutil create -srcfolder "${source}" -volname "${title}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -ov -format UDRW -size ${size}k pack.temp.dmg + +# Mount the disk image and store the device name +export device=$(hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}') + +# Try to list files in the Volume, if we can't, its because its not ready yet +# so we should sleep while its mounted before trying to design it with Applescript +stop=false +while [ "$stop" = false ]; do + test=`ls -l /Volumes/${title}/ | wc -l` + if [ "$test" -eq $NB_FILES ]; then + stop=true + fi + sleep 1 +done + +# Applescript: design the virtual disk image we just mounted +# This will fail if there is not a graphical login +echo ' + tell application "Finder" + tell disk "'${title}'" + open + + set current view of container window to icon view + set toolbar visible of container window to false + set statusbar visible of container window to false + set the bounds of container window to {100, 100, 1000, 660} + set theViewOptions to the icon view options of container window + set icon size of theViewOptions to '${ICON_SIZE}' + set text size of theViewOptions to '${FONT_SIZE}' + set arrangement of theViewOptions to not arranged + set background picture of theViewOptions to file ".background:'${backgroundPictureName}'" + + set position of item "'${applicationName}'" of container window to {'${MPKG_POS_X}', '${MPKG_POS_Y}'} + set position of item "Applications" of container window to {'${APPS_POS_X}', '${APPS_POS_Y}'} + set position of item "'$2'" of container window to {'${README_POS_X}', '${README_POS_Y}'} + set position of item "'$3'" of container window to {'${LICENSE_POS_X}', '${LICENSE_POS_Y}'} + set position of item "'$4'" of container window to {'${THIRD_P_POS_X}', '${THIRD_P_POS_Y}'} + set position of item "'$5'" of container window to {'${LICENSES_POS_X}', '${LICENSES_POS_Y}'} + + update without registering applications + + close + end tell + end tell +' | osascript - + +hdiutil detach ${device} +hdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o "${finalDMGName}" +rm -f pack.temp.dmg diff --git a/macosx/nmap.pmdoc/01nmap-contents.xml b/macosx/nmap.pmdoc/01nmap-contents.xml new file mode 100644 index 0000000..d93b4ef --- /dev/null +++ b/macosx/nmap.pmdoc/01nmap-contents.xml @@ -0,0 +1,3 @@ +<pkg-contents spec="1.12"> + <f n="Nmap" pt="Nmap" m="false" t="file"/> +</pkg-contents> diff --git a/macosx/nmap.pmdoc/01nmap.xml b/macosx/nmap.pmdoc/01nmap.xml new file mode 100644 index 0000000..67e0dc6 --- /dev/null +++ b/macosx/nmap.pmdoc/01nmap.xml @@ -0,0 +1,25 @@ +<pkgref spec="1.12" uuid="A488395A-3951-449A-B3F6-A74D5E926D69"> + <config> + <identifier>org.insecure.nmap.Nmap.pkg</identifier> + <version>1</version> + <description /> + <post-install type="none" /> + <requireAuthorization /> + <installFrom relative="true" includeRoot="false">Nmap</installFrom> + <installTo>/</installTo> + <flags> + <followSymbolicLinks /> + </flags> + <packageStore type="internal" /> + <mod>parent</mod> + <mod>installFrom.isRelativeType</mod> + </config> + <contents> + <file-list>01nmap-contents.xml</file-list> + <filter>/CVS$</filter> + <filter>/\.svn$</filter> + <filter>/\.cvsignore$</filter> + <filter>/\.cvspass$</filter> + <filter>/\.DS_Store$</filter> + </contents> +</pkgref> diff --git a/macosx/nmap.pmdoc/02zenmap-contents.xml b/macosx/nmap.pmdoc/02zenmap-contents.xml new file mode 100644 index 0000000..a5d41b4 --- /dev/null +++ b/macosx/nmap.pmdoc/02zenmap-contents.xml @@ -0,0 +1,3 @@ +<pkg-contents spec="1.12"> + <f n="Zenmap.app" pt="Zenmap/Applications/Zenmap.app" m="false" t="file"/> +</pkg-contents> diff --git a/macosx/nmap.pmdoc/02zenmap.xml b/macosx/nmap.pmdoc/02zenmap.xml new file mode 100644 index 0000000..0082370 --- /dev/null +++ b/macosx/nmap.pmdoc/02zenmap.xml @@ -0,0 +1,37 @@ +<pkgref spec="1.12" uuid="FC648982-1188-47E2-9FA7-5492BAB9EF2D"> + <config> + <identifier>org.insecure.nmap.Zenmap.pkg</identifier> + <version>1</version> + <description /> + <post-install type="none" /> + <requireAuthorization /> + <installFrom relative="true" includeRoot="true">Zenmap/Applications/Zenmap.app</installFrom> + <installTo relocatable="true">/Applications</installTo> + <flags> + <followSymbolicLinks /> + </flags> + <packageStore type="internal" /> + <mod>parent</mod> + <mod>installFrom.isRelativeType</mod> + </config> + <contents> + <file-list>02zenmap-contents.xml</file-list> + <component id="org.insecure.Zenmap" + path="Zenmap/Applications/Zenmap.app" + version="4.60"> + <locator-info> + <token title="pkmk-token-199"> + <search-rule> + <combo identifier="org.insecure.Zenmap" + default-path="/Applications/Zenmap.app" /> + </search-rule> + </token> + </locator-info> + </component> + <filter>/CVS$</filter> + <filter>/\.svn$</filter> + <filter>/\.cvsignore$</filter> + <filter>/\.cvspass$</filter> + <filter>/\.DS_Store$</filter> + </contents> +</pkgref> diff --git a/macosx/nmap.pmdoc/03ncat-contents.xml b/macosx/nmap.pmdoc/03ncat-contents.xml new file mode 100644 index 0000000..a178a29 --- /dev/null +++ b/macosx/nmap.pmdoc/03ncat-contents.xml @@ -0,0 +1,3 @@ +<pkg-contents spec="1.12"> + <f n="Ncat" pt="Ncat" m="false" t="file"/> +</pkg-contents> diff --git a/macosx/nmap.pmdoc/03ncat.xml b/macosx/nmap.pmdoc/03ncat.xml new file mode 100644 index 0000000..b0d5e4c --- /dev/null +++ b/macosx/nmap.pmdoc/03ncat.xml @@ -0,0 +1,25 @@ +<pkgref spec="1.12" uuid="405DE819-24DC-406C-A9F8-4ED37BA1C1D6"> + <config> + <identifier>org.insecure.nmap.Ncat.pkg</identifier> + <version>1</version> + <description /> + <post-install type="none" /> + <requireAuthorization /> + <installFrom relative="true" includeRoot="false">Ncat</installFrom> + <installTo>/</installTo> + <flags> + <followSymbolicLinks /> + </flags> + <packageStore type="internal" /> + <mod>parent</mod> + <mod>installFrom.isRelativeType</mod> + </config> + <contents> + <file-list>03ncat-contents.xml</file-list> + <filter>/CVS$</filter> + <filter>/\.svn$</filter> + <filter>/\.cvsignore$</filter> + <filter>/\.cvspass$</filter> + <filter>/\.DS_Store$</filter> + </contents> +</pkgref> diff --git a/macosx/nmap.pmdoc/04ndiff-contents.xml b/macosx/nmap.pmdoc/04ndiff-contents.xml new file mode 100644 index 0000000..63000ce --- /dev/null +++ b/macosx/nmap.pmdoc/04ndiff-contents.xml @@ -0,0 +1,3 @@ +<pkg-contents spec="1.12"> + <f n="Ndiff" pt="Ndiff" m="false" t="file"/> +</pkg-contents> diff --git a/macosx/nmap.pmdoc/04ndiff.xml b/macosx/nmap.pmdoc/04ndiff.xml new file mode 100644 index 0000000..08dc0a0 --- /dev/null +++ b/macosx/nmap.pmdoc/04ndiff.xml @@ -0,0 +1,25 @@ +<pkgref spec="1.12" uuid="A488395A-3951-449A-B3F6-A74D5E926D69"> + <config> + <identifier>org.insecure.nmap.Ndiff.pkg</identifier> + <version>1</version> + <description /> + <post-install type="none" /> + <requireAuthorization /> + <installFrom relative="true" includeRoot="false">Ndiff</installFrom> + <installTo>/</installTo> + <flags> + <followSymbolicLinks /> + </flags> + <packageStore type="internal" /> + <mod>parent</mod> + <mod>installFrom.isRelativeType</mod> + </config> + <contents> + <file-list>04ndiff-contents.xml</file-list> + <filter>/CVS$</filter> + <filter>/\.svn$</filter> + <filter>/\.cvsignore$</filter> + <filter>/\.cvspass$</filter> + <filter>/\.DS_Store$</filter> + </contents> +</pkgref> diff --git a/macosx/nmap.pmdoc/05nping-contents.xml b/macosx/nmap.pmdoc/05nping-contents.xml new file mode 100644 index 0000000..9138f05 --- /dev/null +++ b/macosx/nmap.pmdoc/05nping-contents.xml @@ -0,0 +1,3 @@ +<pkg-contents spec="1.12"> + <f n="Nping" pt="Nping" m="false" t="file"/> +</pkg-contents> diff --git a/macosx/nmap.pmdoc/05nping.xml b/macosx/nmap.pmdoc/05nping.xml new file mode 100644 index 0000000..cf4ca27 --- /dev/null +++ b/macosx/nmap.pmdoc/05nping.xml @@ -0,0 +1,25 @@ +<pkgref spec="1.12" uuid="A488395A-3951-449A-B3F6-A74D5E926D69"> + <config> + <identifier>org.insecure.nping.Nping.pkg</identifier> + <version>1</version> + <description /> + <post-install type="none" /> + <requireAuthorization /> + <installFrom relative="true" includeRoot="false">Nping</installFrom> + <installTo>/</installTo> + <flags> + <followSymbolicLinks /> + </flags> + <packageStore type="internal" /> + <mod>parent</mod> + <mod>installFrom.isRelativeType</mod> + </config> + <contents> + <file-list>01nping-contents.xml</file-list> + <filter>/CVS$</filter> + <filter>/\.svn$</filter> + <filter>/\.cvsignore$</filter> + <filter>/\.cvspass$</filter> + <filter>/\.DS_Store$</filter> + </contents> +</pkgref> diff --git a/macosx/nmap.pmdoc/index.xml b/macosx/nmap.pmdoc/index.xml new file mode 100644 index 0000000..4287e94 --- /dev/null +++ b/macosx/nmap.pmdoc/index.xml @@ -0,0 +1,56 @@ +<pkmkdoc spec="1.12"> + <properties> + <title>Nmap</title> + <organization>org.insecure</organization> + <userSees ui="custom" /> + <min-target os="2" /> + <domain anywhere="true" /> + </properties> + <distribution> + <versions min-spec="1.000000" /> + <scripts></scripts> + </distribution> + <contents> + <choice title="Nmap" id="choice92" starts_selected="true" + description="Nmap executables, scripts, and support files." + starts_enabled="true" starts_hidden="false"> + <pkgref id="org.insecure.nmap.Nmap.pkg" /> + </choice> + <choice title="Zenmap" id="choice93" starts_selected="true" + description="Zenmap graphical frontend." + starts_enabled="true" starts_hidden="false"> + <pkgref id="org.insecure.nmap.Zenmap.pkg" /> + </choice> + <choice title="Ncat" id="choice94" starts_selected="true" + description="Ncat general-purpose network sender and receiver (reimplementation of Netcat)." + starts_enabled="true" starts_hidden="false"> + <pkgref id="org.insecure.nmap.Ncat.pkg" /> + </choice> + <choice title="Ndiff" id="choice95" starts_selected="true" + description="Ndiff scan comparison utility." + starts_enabled="true" starts_hidden="false"> + <pkgref id="org.insecure.nmap.Ndiff.pkg" /> + </choice> + <choice title="Nping" id="choice96" starts_selected="true" + description="Nping packet generator." + starts_enabled="true" starts_hidden="false"> + <pkgref id="org.insecure.nmap.Nping.pkg" /> + </choice> + </contents> + <resources bg-scale="none" bg-align="topleft"> + <locale lang="en"> + <resource relative="true" type="welcome">README</resource> + <resource relative="true" type="license">LICENSE.formatted</resource> + </locale> + </resources> + <flags /> + <item type="file">01nmap.xml</item> + <item type="file">02zenmap.xml</item> + <item type="file">03ncat.xml</item> + <item type="file">04ndiff.xml</item> + <item type="file">05nping.xml</item> + <mod>properties.customizeOption</mod> + <mod>properties.title</mod> + <mod>properties.anywhereDomain</mod> + <mod>properties.systemDomain</mod> +</pkmkdoc> diff --git a/macosx/nmap.png b/macosx/nmap.png Binary files differnew file mode 100644 index 0000000..f7337c3 --- /dev/null +++ b/macosx/nmap.png diff --git a/macosx/openssl.modules b/macosx/openssl.modules new file mode 100644 index 0000000..e558703 --- /dev/null +++ b/macosx/openssl.modules @@ -0,0 +1,81 @@ +<?xml version="1.0"?> +<!DOCTYPE moduleset SYSTEM "moduleset.dtd" [ +<!ENTITY nmap_version "7.93SVN"> +<!ENTITY openssl_version "3.0.8"> +]> +<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> +<moduleset> + + <!-- INCLUDE --> + + <!-- <include href="https://git.gnome.org/browse/gtk-osx/plain/modulesets-stable/gtk-osx.modules"/> --> + + <!-- REPOSITORIES --> + + <repository type="tarball" name="openssl" href="http://www.openssl.org/source/"/> + <repository type="tarball" name="nmap-local" href="http://localhost:8000/"/> + + <!-- MODULES --> + +<!-- no-asm added to support building OpenSSL 3.0 on HighSierra. When upgrading to newer build system, remove it. --> + <autotools id="openssl" autogen-sh="Configure" autogenargs="shared enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers" + autogen-template="%(srcdir)s/%(autogen-sh)s --prefix=%(prefix)s + --openssldir=%(prefix)s/etc/ssl %(autogenargs)s" + makeargs="depend all" + makeinstallargs="INSTALL_PREFIX='$(DESTDIR)' install_dev" + supports-parallel-builds="no" + supports-non-srcdir-builds="no"> + <branch repo="openssl" version="&openssl_version;" module="openssl-&openssl_version;.tar.gz"/> + </autotools> + + <autotools id="nmap" supports-non-srcdir-builds="no" + autogen-sh="configure" autogenargs="--with-libdnet=included --with-libpcap=included --with-libpcre=included --with-liblua=included +--without-zenmap --without-ncat --without-ndiff --without-nping" + makeargs='OPENSSL_LIBS="${JHBUILD_LIBDIR}/libssl.a ${JHBUILD_LIBDIR}/libcrypto.a" LIBSSL="${JHBUILD_LIBDIR}/libssl.a ${JHBUILD_LIBDIR}/libcrypto.a" ZLIB_LIBS="${JHBUILD_LIBDIR}/libz.a" LIBZ="${JHBUILD_LIBDIR}/libz.a"' + makeinstallargs='install OPENSSL_LIBS="${JHBUILD_LIBDIR}/libssl.a ${JHBUILD_LIBDIR}/libcrypto.a" ZLIB_LIBS="${JHBUILD_LIBDIR}/libz.a"' + makeclean="false" + > + <branch repo="nmap-local" module="nmap-&nmap_version;.tar.gz" version="&nmap_version;"/> + <dependencies> + <dep package="openssl" /> + </dependencies> + </autotools> + + <autotools id="ncat" supports-non-srcdir-builds="no" + autogen-sh="configure" autogenargs="--with-libdnet=included --with-libpcap=included --with-libpcre=included --with-liblua=included +--without-zenmap --without-ndiff --without-nping" + makeargs='build-ncat OPENSSL_LIBS="${JHBUILD_LIBDIR}/libssl.a ${JHBUILD_LIBDIR}/libcrypto.a"' + makeinstallargs='install-ncat OPENSSL_LIBS="${JHBUILD_LIBDIR}/libssl.a ${JHBUILD_LIBDIR}/libcrypto.a"' + makeclean="false" + > + <branch repo="nmap-local" module="nmap-&nmap_version;.tar.gz" version="&nmap_version;"/> + <dependencies> + <dep package="openssl" /> + </dependencies> + </autotools> + + <autotools id="nping" supports-non-srcdir-builds="no" + autogen-sh="configure" autogenargs="--with-libdnet=included --with-libpcap=included --with-libpcre=included --with-liblua=included +--without-zenmap --without-ncat --without-ndiff" + makeargs='build-nping OPENSSL_LIBS="${JHBUILD_LIBDIR}/libssl.a ${JHBUILD_LIBDIR}/libcrypto.a"' + makeinstallargs='install-nping OPENSSL_LIBS="${JHBUILD_LIBDIR}/libssl.a ${JHBUILD_LIBDIR}/libcrypto.a"' + makeclean="false" + > + <branch repo="nmap-local" module="nmap-&nmap_version;.tar.gz" version="&nmap_version;"/> + <dependencies> + <dep package="openssl" /> + </dependencies> + </autotools> + + <!-- METAMODULE --> + + <metamodule id="nmap-packages"> + <dependencies> + <dep package="openssl" /> + <dep package="nmap" /> + <dep package="ncat" /> + <dep package="nping" /> + </dependencies> + </metamodule> + +</moduleset> diff --git a/macosx/pkg_bg.jpg b/macosx/pkg_bg.jpg Binary files differnew file mode 100644 index 0000000..8604350 --- /dev/null +++ b/macosx/pkg_bg.jpg |