mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Preliminary Windows bundling for Zenmap and Ndiff
This commit is contained in:
@@ -55,8 +55,8 @@ stage-common: $(NMAPDIR)/CHANGELOG $(NMAPDIR)/LICENSE $(NMAPDIR)/nmap-mac-prefix
|
|||||||
# Install the ndiff batch file wrapper in the zip distribution.
|
# Install the ndiff batch file wrapper in the zip distribution.
|
||||||
cp $(NMAPDIR)/ndiff/ndiff.py nmap-$(NMAP_VERSION)/ndiff.py
|
cp $(NMAPDIR)/ndiff/ndiff.py nmap-$(NMAP_VERSION)/ndiff.py
|
||||||
cp python-wrap.bat nmap-$(NMAP_VERSION)/ndiff.bat
|
cp python-wrap.bat nmap-$(NMAP_VERSION)/ndiff.bat
|
||||||
cd $(NMAPDIR)/zenmap && install_scripts/windows/copy_and_compile.bat
|
cd $(NMAPDIR)/zenmap && install_scripts/windows/build.sh
|
||||||
cp -R $(NMAPDIR)/zenmap/dist/* nmap-$(NMAP_VERSION)/
|
cp -R $(NMAPDIR)/zenmap/dist/zenmap-w64 nmap-$(NMAP_VERSION)/
|
||||||
cp $(NMAPDIR)/zenmap/README nmap-$(NMAP_VERSION)/ZENMAP_README
|
cp $(NMAPDIR)/zenmap/README nmap-$(NMAP_VERSION)/ZENMAP_README
|
||||||
cp $(NMAPDIR)/zenmap/COPYING_HIGWIDGETS nmap-$(NMAP_VERSION)
|
cp $(NMAPDIR)/zenmap/COPYING_HIGWIDGETS nmap-$(NMAP_VERSION)
|
||||||
cp $(NMAPDIR)/ndiff/README nmap-$(NMAP_VERSION)/NDIFF_README
|
cp $(NMAPDIR)/ndiff/README nmap-$(NMAP_VERSION)/NDIFF_README
|
||||||
@@ -73,7 +73,7 @@ stage-nmap-main: build-nmap${OEM_SUFFIX}
|
|||||||
mkdir -p nmap-$(NMAP_VERSION)${OEM_SUFFIX}
|
mkdir -p nmap-$(NMAP_VERSION)${OEM_SUFFIX}
|
||||||
cp $(VCCONFIG)${OEM_SUFFIX}/nmap.exe nmap-$(NMAP_VERSION)${OEM_SUFFIX}/
|
cp $(VCCONFIG)${OEM_SUFFIX}/nmap.exe nmap-$(NMAP_VERSION)${OEM_SUFFIX}/
|
||||||
|
|
||||||
sign-files: nmap-$(NMAP_VERSION)-oem/nmap.exe nmap-$(NMAP_VERSION)/nmap.exe nmap-$(NMAP_VERSION)/ncat.exe nmap-$(NMAP_VERSION)/nping.exe nmap-$(NMAP_VERSION)/ndiff.exe nmap-$(NMAP_VERSION)/zenmap.exe nmap-$(NMAP_VERSION)/libssh2.dll nmap-$(NMAP_VERSION)/libcrypto-3.dll nmap-$(NMAP_VERSION)/libssl-3.dll nmap-$(NMAP_VERSION)/zlibwapi.dll
|
sign-files: nmap-$(NMAP_VERSION)-oem/nmap.exe nmap-$(NMAP_VERSION)/nmap.exe nmap-$(NMAP_VERSION)/ncat.exe nmap-$(NMAP_VERSION)/nping.exe nmap-$(NMAP_VERSION)/zenmap-w64/zenmap.exe nmap-$(NMAP_VERSION)/libssh2.dll nmap-$(NMAP_VERSION)/libcrypto-3.dll nmap-$(NMAP_VERSION)/libssl-3.dll nmap-$(NMAP_VERSION)/zlibwapi.dll
|
||||||
# TODO: evaluate whether we should also sign the Python stuff for Zenmap, Ndiff
|
# TODO: evaluate whether we should also sign the Python stuff for Zenmap, Ndiff
|
||||||
"$(SIGNTOOL)" $(SIGNTOOL_ARGS) $^
|
"$(SIGNTOOL)" $(SIGNTOOL_ARGS) $^
|
||||||
touch sign-files
|
touch sign-files
|
||||||
@@ -110,14 +110,8 @@ bundle-zip-main: sign-files
|
|||||||
|| true
|
|| true
|
||||||
cp npcap-$(NPCAP_VERSION)${OEM_SUFFIX}.exe nmap-$(NMAP_VERSION)${OEM_SUFFIX}
|
cp npcap-$(NPCAP_VERSION)${OEM_SUFFIX}.exe nmap-$(NMAP_VERSION)${OEM_SUFFIX}
|
||||||
zip -x nmap-$(NMAP_VERSION)${OEM_SUFFIX}/ZENMAP_README \
|
zip -x nmap-$(NMAP_VERSION)${OEM_SUFFIX}/ZENMAP_README \
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/zenmap/\* \
|
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/zenmap-w64/\* \
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/zenmap.exe \
|
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/share/\* \
|
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/python27.dll \
|
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/py2exe/\* \
|
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/COPYING_HIGWIDGETS \
|
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/COPYING_HIGWIDGETS \
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/w9xpopen.exe \
|
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/ndiff.exe \
|
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/Uninstall.exe \
|
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/Uninstall.exe \
|
||||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/icon1.ico \
|
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/icon1.ico \
|
||||||
-r nmap-$(NMAP_VERSION)${OEM_SUFFIX}-win32.zip nmap-$(NMAP_VERSION)${OEM_SUFFIX}
|
-r nmap-$(NMAP_VERSION)${OEM_SUFFIX}-win32.zip nmap-$(NMAP_VERSION)${OEM_SUFFIX}
|
||||||
|
|||||||
@@ -285,25 +285,21 @@ SectionEnd
|
|||||||
Section "Zenmap (GUI Frontend)" SecZenmap
|
Section "Zenmap (GUI Frontend)" SecZenmap
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
SetOverwrite on
|
SetOverwrite on
|
||||||
File ${STAGE_DIR}\zenmap.exe
|
|
||||||
File ${STAGE_DIR}\ZENMAP_README
|
File ${STAGE_DIR}\ZENMAP_README
|
||||||
File ${STAGE_DIR}\COPYING_HIGWIDGETS
|
File ${STAGE_DIR}\COPYING_HIGWIDGETS
|
||||||
File ${STAGE_DIR}\python27.dll
|
File /r ${STAGE_DIR}\zenmap-w64
|
||||||
File /r ${STAGE_DIR}\share
|
WriteINIStr "$INSTDIR\zenmap-w64\mingw64\share\zenmap\config\zenmap.conf" paths nmap_command_path "$INSTDIR\nmap.exe"
|
||||||
File /r ${STAGE_DIR}\py2exe
|
WriteINIStr "$INSTDIR\zenmap-w64\mingw64\share\zenmap\config\zenmap.conf" paths ndiff_command_path "$INSTDIR\ndiff.bat"
|
||||||
StrCpy $zenmapset "true"
|
StrCpy $zenmapset "true"
|
||||||
Call vcredistinstaller
|
|
||||||
Call create_uninstaller
|
Call create_uninstaller
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Ndiff (Scan comparison tool)" SecNdiff
|
Section "Ndiff (Scan comparison tool)" SecNdiff
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
SetOverwrite on
|
SetOverwrite on
|
||||||
File ${STAGE_DIR}\ndiff.exe
|
File ${STAGE_DIR}\ndiff.py
|
||||||
|
File ${STAGE_DIR}\ndiff.bat
|
||||||
File ${STAGE_DIR}\NDIFF_README
|
File ${STAGE_DIR}\NDIFF_README
|
||||||
File ${STAGE_DIR}\python27.dll
|
|
||||||
File /r ${STAGE_DIR}\py2exe
|
|
||||||
Call vcredistinstaller
|
|
||||||
Call create_uninstaller
|
Call create_uninstaller
|
||||||
SectionEnd
|
SectionEnd
|
||||||
!endif
|
!endif
|
||||||
|
|||||||
34
zenmap/install_scripts/windows/PKGBUILD
Normal file
34
zenmap/install_scripts/windows/PKGBUILD
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# PKGBUILD for Zenmap targeting MinGW and MSYS2, for use in packaging Zenmap for Windows.
|
||||||
|
# Expected invocation: makepkg-mingw -RdfL
|
||||||
|
# -R: repackage, do not download source
|
||||||
|
# -d: do not verify dependencies (Python 3 is the only build dependency)
|
||||||
|
# -f: force, overwrite existing package.
|
||||||
|
# -L: log progress to file
|
||||||
|
_realname=zenmap
|
||||||
|
pkgbase=mingw-w64-python-${_realname}
|
||||||
|
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
|
||||||
|
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
||||||
|
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
||||||
|
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
||||||
|
pkgver=$(echo NMAP_VERSION | $(CC) -E -imacros nmap.h - | sed -n '$s/[" ]//g;$p')
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Graphical Nmap frontend and results viewer"
|
||||||
|
url="https://nmap.org/zenmap/"
|
||||||
|
arch=("any")
|
||||||
|
license=("NPSL")
|
||||||
|
source=("https://nmap.org/dist/nmap-${pkgver}.tar.bz2")
|
||||||
|
sha256sums=("SKIP")
|
||||||
|
mingw_arch=('mingw64')
|
||||||
|
depends=("${MINGW_PACKAGE_PREFIX}-python" "${MINGW_PACKAGE_PREFIX}-python-gobject")
|
||||||
|
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
|
||||||
|
|
||||||
|
package() {
|
||||||
|
# If this script is in zenmap/install_scripts/windows/PKGBUILD
|
||||||
|
# then a repackage (makepkg -R) will set srcdir=zenmap/install_scripts/windows/src
|
||||||
|
# We want to cd to zenmap/
|
||||||
|
cd "${srcdir}/../../.."
|
||||||
|
${MINGW_PREFIX}/bin/python setup.py build
|
||||||
|
MSYS2_ARG_CONV_EXCL="--prefix=" \
|
||||||
|
${MINGW_PREFIX}/bin/python setup.py install vanilla --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1
|
||||||
|
install -Dm644 install_scripts/unix/zenmap.desktop "${pkgdir}${MINGW_PREFIX}/share/applications/zenmap.desktop"
|
||||||
|
}
|
||||||
62
zenmap/install_scripts/windows/build.sh
Normal file
62
zenmap/install_scripts/windows/build.sh
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# bash shebang because MSYS2/Styrene require Bash, not just /bin/sh
|
||||||
|
|
||||||
|
BUILDDIR=dist
|
||||||
|
|
||||||
|
: << '#MULTILINE_COMMENT'
|
||||||
|
# Setup environment
|
||||||
|
pacman -S --needed zip mingw-w64-x86_64-{python3,gcc,nsis,binutils,git}
|
||||||
|
pacman -S --needed mingw-w64-x86_64-python3-pip
|
||||||
|
git clone https://github.com/achadwick/styrene.git
|
||||||
|
git apply <<EOF
|
||||||
|
diff --git a/styrene/bundle.py b/styrene/bundle.py
|
||||||
|
index 7f5155e..e5c31d3 100644
|
||||||
|
--- a/styrene/bundle.py
|
||||||
|
+++ b/styrene/bundle.py
|
||||||
|
@@ -446,7 +446,7 @@ class NativeBundle:
|
||||||
|
- (?P<version> [^-]+ - \d+ )
|
||||||
|
- any
|
||||||
|
[.]pkg[.]tar
|
||||||
|
- (?: [.](?:gz|xz) )?
|
||||||
|
+ (?: [.](?:gz|xz|zst) )?
|
||||||
|
$
|
||||||
|
'''
|
||||||
|
keyobj = functools.cmp_to_key(self._vercmp)
|
||||||
|
EOF
|
||||||
|
cd styrene
|
||||||
|
pip3 install .
|
||||||
|
#MULTILINE_COMMENT
|
||||||
|
|
||||||
|
# make the zenmap package
|
||||||
|
makepkg-mingw -RdfL
|
||||||
|
|
||||||
|
# make the minimal msys2 environment
|
||||||
|
styrene -p . -o "$BUILDDIR" styrene.cfg --no-exe --no-zip
|
||||||
|
|
||||||
|
# Clean up unused Python modules
|
||||||
|
rm -rf "$BUILDDIR/**/*.opt-?.pyc"
|
||||||
|
rm -rf "$BUILDDIR/distutils/"
|
||||||
|
rm -rf "$BUILDDIR/pydoc_data/"
|
||||||
|
rm -rf "$BUILDDIR/ctypes/"
|
||||||
|
rm -rf "$BUILDDIR/asyncio/"
|
||||||
|
rm -rf "$BUILDDIR/multiprocessing/"
|
||||||
|
rm -rf "$BUILDDIR/html/"
|
||||||
|
rm -rf "$BUILDDIR/msilib/"
|
||||||
|
rm -rf "$BUILDDIR/venv/"
|
||||||
|
rm -rf "$BUILDDIR/xmlrpc/"
|
||||||
|
rm -rf "$BUILDDIR/concurrent/"
|
||||||
|
rm -rf "$BUILDDIR/json/"
|
||||||
|
rm -rf "$BUILDDIR/config-3.*/"
|
||||||
|
rm -rf "$BUILDDIR/zoneinfo/"
|
||||||
|
|
||||||
|
# Remove pacman database
|
||||||
|
rm -rf var/lib/pacman/
|
||||||
|
|
||||||
|
# fake a new install script for what we removed:
|
||||||
|
mkdir -p var/lib/pacman/local/zenmap-fake-pkg/
|
||||||
|
cat >var/lib/pacman/local/zenmap-fake-pkg/install <<EOF
|
||||||
|
post_install() {
|
||||||
|
mingw64/bin/gtk-update-icon-cache -q -t -f mingw64/share/icons/hicolor
|
||||||
|
mingw64/bin/gtk-update-icon-cache -q -t -f mingw64/share/icons/Adwaita
|
||||||
|
}
|
||||||
|
EOF
|
||||||
117
zenmap/install_scripts/windows/styrene.cfg
Executable file
117
zenmap/install_scripts/windows/styrene.cfg
Executable file
@@ -0,0 +1,117 @@
|
|||||||
|
# Styrene config file for Zenmap and Ndiff
|
||||||
|
|
||||||
|
[bundle]
|
||||||
|
|
||||||
|
# Packages to install into the bundle, separated by spaces.
|
||||||
|
# Pacman will resolve dependencies automatically.
|
||||||
|
# Substs: {pkg_prefix} for "mingw-w64-x86_64-" or "mingw-w64-i686-".
|
||||||
|
# The first package is the main one: it provides the default metadata.
|
||||||
|
packages = {pkg_prefix}python-zenmap {pkg_prefix}python-gobject {pkg_prefix}python {pkg_prefix}gtk3 msys2-runtime
|
||||||
|
|
||||||
|
# Reduce some bundling time and size by skipping these prereqs we don't use
|
||||||
|
assume_installed = {pkg_prefix}ncurses {pkg_prefix}expat {pkg_prefix}openssl {pkg_prefix}tcl {pkg_prefix}tk
|
||||||
|
|
||||||
|
# The first part of generated installer or archive filenames.
|
||||||
|
# Will be suffixed with the version, an architecture spec
|
||||||
|
# like "-w64" or "-w32", and the appropriate filename extension.
|
||||||
|
# Default: the main package's name (with {pkg_prefix} as "").
|
||||||
|
filename_stub = zenmap
|
||||||
|
|
||||||
|
# Display name for the bundle. Spaces are OK.
|
||||||
|
# The suffix " (w32)" is appended for MINGW32 bundles.
|
||||||
|
# Default: the filename stub
|
||||||
|
display_name = Zenmap
|
||||||
|
|
||||||
|
# Short human-readable description.
|
||||||
|
description = Nmap GUI
|
||||||
|
|
||||||
|
# Version number for the bundle.
|
||||||
|
# Default: parsed from the main package's version.
|
||||||
|
# version =
|
||||||
|
|
||||||
|
# URLs that default to the main package's URL metadata.
|
||||||
|
# url =
|
||||||
|
|
||||||
|
# Launchers to install.
|
||||||
|
# Entries here should name a desktop file,
|
||||||
|
# or an equivalent section below.
|
||||||
|
launchers =
|
||||||
|
zenmap.desktop
|
||||||
|
ndiff-launcher
|
||||||
|
|
||||||
|
# Additional icons to explicitly convert.
|
||||||
|
# These will be converted from the bundle's FreeDesktop.org PNG icons.
|
||||||
|
# They are used in addition to the ones listed in the launchers.
|
||||||
|
# The conversion only knows about Adwaita & the default hicolor theme.
|
||||||
|
# The first converted icon will be used for the installer too [VOLATILE]
|
||||||
|
; icons =
|
||||||
|
|
||||||
|
# Surplus files and folders to be deleted.
|
||||||
|
# Space-separated list of glob patterns rooted in $INSTDIR.
|
||||||
|
|
||||||
|
delete = *
|
||||||
|
|
||||||
|
|
||||||
|
# List files and directories you *don't* want to be deleted here.
|
||||||
|
# If you're cleaning out $PREFIX/bin, you need to keep all the EXEs
|
||||||
|
# which are called from the postinst.cmd.
|
||||||
|
|
||||||
|
nodelete =
|
||||||
|
# The postinst scripts that GTK needs, followed by their binaries.
|
||||||
|
var/lib/pacman/local/mingw-w64-*-glib2-*-*/install
|
||||||
|
mingw*/bin/glib-compile-schemas*.exe
|
||||||
|
mingw*/share/glib*/schemas
|
||||||
|
|
||||||
|
var/lib/pacman/local/mingw-w64-*-gdk-pixbuf2-*-*/install
|
||||||
|
mingw*/bin/gdk-pixbuf-query-loaders*.exe
|
||||||
|
|
||||||
|
var/lib/pacman/local/mingw-w64-*-gtk3-*-*/install
|
||||||
|
mingw*/bin/gtk-query-immodules*.exe
|
||||||
|
mingw*/bin/gtk-update-icon-cache*.exe
|
||||||
|
usr/bin/mkdir.exe
|
||||||
|
usr/bin/msys-2*.dll
|
||||||
|
|
||||||
|
var/lib/pacman/local/mingw-w64-*-adwaita-icon-theme-*-*/install
|
||||||
|
|
||||||
|
var/lib/pacman/local/mingw-w64-*-hicolor-icon-theme-*-*/install
|
||||||
|
|
||||||
|
# Runtime requirements for the demos etc.
|
||||||
|
mingw*/etc/gtk-3.0
|
||||||
|
mingw*/bin/*.dll
|
||||||
|
|
||||||
|
mingw*/lib/gtk-3.0
|
||||||
|
mingw*/lib/gdk-pixbuf-2.0
|
||||||
|
mingw*/share/applications
|
||||||
|
|
||||||
|
|
||||||
|
# This is the most minimal subset for GTK. Breaks many demos.
|
||||||
|
mingw*/share/icons/**/window-*.symbolic.png ; window surrounds
|
||||||
|
mingw*/share/icons/**/pan-*.symbolic.png ; foldouts & arrows
|
||||||
|
mingw*/share/icons/**/process-working* ; spinner (SVG)
|
||||||
|
mingw*/share/icons/**/index.theme
|
||||||
|
# Or to be certain, include all symbolic PNGS
|
||||||
|
mingw*/share/icons/**/*.symbolic.png
|
||||||
|
|
||||||
|
# python-gobject stuff
|
||||||
|
mingw*/lib/girepository-*
|
||||||
|
mingw*/lib/python3.*
|
||||||
|
mingw*/bin/pythonw.exe
|
||||||
|
mingw*/bin/libpython*.dll
|
||||||
|
# Zenmap's files (mostly in site-packages above)
|
||||||
|
mingw*/share/zenmap
|
||||||
|
# mingw*/bin/zenmap
|
||||||
|
|
||||||
|
# Local launcher definitions
|
||||||
|
|
||||||
|
; You can define new app launchers here, or extend the launchers in
|
||||||
|
; installed .desktop files by overriding their keys.
|
||||||
|
;
|
||||||
|
; All launchers need to be listed in the [bundle]'s "launchers" key.
|
||||||
|
[zenmap.desktop]
|
||||||
|
exec = pythonw.exe -c 'from zenmapGUI.App import run; run()'
|
||||||
|
icon = {msystem_subdir}/share/zenmap/pixmaps/zenmap.png
|
||||||
|
; For debugging:
|
||||||
|
;Terminal = true
|
||||||
|
;exec = pythonw.exe -c 'from zenmapGUI.App import run; run()' -vvvvv
|
||||||
|
[ndiff-launcher]
|
||||||
|
exec = python.exe ../ndiff.py %F
|
||||||
Reference in New Issue
Block a user