summaryrefslogtreecommitdiffstats
path: root/zenmap/install_scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:42:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:42:04 +0000
commit0d47952611198ef6b1163f366dc03922d20b1475 (patch)
tree3d840a3b8c0daef0754707bfb9f5e873b6b1ac13 /zenmap/install_scripts
parentInitial commit. (diff)
downloadnmap-upstream.tar.xz
nmap-upstream.zip
Adding upstream version 7.94+git20230807.3be01efb1+dfsg.upstream/7.94+git20230807.3be01efb1+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--zenmap/install_scripts/README20
-rw-r--r--zenmap/install_scripts/macosx/Info.plist34
-rw-r--r--zenmap/install_scripts/macosx/README26
-rw-r--r--zenmap/install_scripts/macosx/gtkrc3
-rwxr-xr-xzenmap/install_scripts/macosx/launcher.sh63
-rwxr-xr-xzenmap/install_scripts/macosx/make-bundle.sh106
-rw-r--r--zenmap/install_scripts/macosx/zenmap.bundle144
-rw-r--r--zenmap/install_scripts/macosx/zenmap.icnsbin0 -> 145639 bytes
-rw-r--r--zenmap/install_scripts/macosx/zenmap_auth.m49
-rw-r--r--zenmap/install_scripts/macosx/zenmap_launcher.py43
-rwxr-xr-xzenmap/install_scripts/unix/su-to-zenmap.sh57
-rw-r--r--zenmap/install_scripts/unix/zenmap-root.desktop11
-rw-r--r--zenmap/install_scripts/unix/zenmap.desktop11
-rwxr-xr-xzenmap/install_scripts/utils/get_deps.py80
-rw-r--r--zenmap/install_scripts/utils/version_update.py107
-rwxr-xr-xzenmap/install_scripts/windows/Makefile15
-rw-r--r--zenmap/install_scripts/windows/PKGBUILD32
-rw-r--r--zenmap/install_scripts/windows/boot_script.py27
-rw-r--r--zenmap/install_scripts/windows/build.sh69
-rwxr-xr-xzenmap/install_scripts/windows/copy_and_compile.bat57
-rw-r--r--zenmap/install_scripts/windows/nmap-eye.icobin0 -> 419614 bytes
-rwxr-xr-xzenmap/install_scripts/windows/styrene.cfg171
22 files changed, 1125 insertions, 0 deletions
diff --git a/zenmap/install_scripts/README b/zenmap/install_scripts/README
new file mode 100644
index 0000000..8179a0c
--- /dev/null
+++ b/zenmap/install_scripts/README
@@ -0,0 +1,20 @@
+Every script under this directory is supposed to be executed from the
+top of the source tree. Don't get into this directory, nor any other
+under this one to execute any of the scripts, or they're not going to
+work as expected.
+
+This is a description of the scripts in this directory and its
+subdirectories.
+
+macosx:
+Files and scripts used to build Mac OS X packages. See macosx/README for a
+description of the files in this directory.
+
+utils/version_update.py:
+Updates the Zenmap version number everywhere it needs to be.
+
+windows/copy_and_compile.bat:
+Builds a Windows executable using py2exe.
+
+windows/nmap-eye.ico:
+An icon used on Windows.
diff --git a/zenmap/install_scripts/macosx/Info.plist b/zenmap/install_scripts/macosx/Info.plist
new file mode 100644
index 0000000..2f953cd
--- /dev/null
+++ b/zenmap/install_scripts/macosx/Info.plist
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleIdentifier</key>
+ <string>org.insecure.Zenmap</string>
+ <key>CFBundleName</key>
+ <string>Zenmap</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>${APP_COPYRIGHT}</string>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>Zenmap</string>
+ <key>CFBundleGetInfoString</key>
+ <string>${VERSION}, ${APP_COPYRIGHT} ${APP_WEB_SITE}</string>
+ <key>CFBundleIconFile</key>
+ <string>zenmap.icns</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${VERSION}</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${VERSION}</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.9</string>
+<key>GtkOSXLaunchScriptFile</key>
+<string>zenmap_launcher.py</string>
+</dict>
+</plist>
diff --git a/zenmap/install_scripts/macosx/README b/zenmap/install_scripts/macosx/README
new file mode 100644
index 0000000..f0695d2
--- /dev/null
+++ b/zenmap/install_scripts/macosx/README
@@ -0,0 +1,26 @@
+This is a description of the files in this directory, all of which 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
+A properties list file template that is filled out by make-bundle.sh
+
+== 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
+The icon file for the bundle. It was created using the Icon Composer
+utility (open -a "Icon Composer").
+
+== zenmap_auth.c
+This is a simple wrapper program that attempts to run launcher.sh
+with privileges.
+
+== launcher.sh
+A launcher script that configures the environment for Zenmap, Python, and GTK
+before launching the main Zenmap script file.
+
+== zenmap.bundle
+An XML config file for gtk-mac-bundler which specifies files and metadata for
+the application bundle. https://wiki.gnome.org/Projects/GTK%2B/OSX/Building
diff --git a/zenmap/install_scripts/macosx/gtkrc b/zenmap/install_scripts/macosx/gtkrc
new file mode 100644
index 0000000..b74f0c9
--- /dev/null
+++ b/zenmap/install_scripts/macosx/gtkrc
@@ -0,0 +1,3 @@
+# Use Lucida Grande, the face used by other OS X applications.
+
+gtk-font-name="Lucida Grande"
diff --git a/zenmap/install_scripts/macosx/launcher.sh b/zenmap/install_scripts/macosx/launcher.sh
new file mode 100755
index 0000000..881c9f6
--- /dev/null
+++ b/zenmap/install_scripts/macosx/launcher.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+name=`basename "$0"`
+tmp="$0"
+tmp=`dirname "$tmp"`
+tmp=`dirname "$tmp"`
+bundle=`dirname "$tmp"`
+bundle_contents="$bundle"/Contents
+bundle_res="$bundle_contents"/Resources
+bundle_lib="$bundle_res"/lib
+bundle_bin="$bundle_res"/bin
+bundle_data="$bundle_res"/share
+bundle_etc="$bundle_res"/etc
+
+export DYLD_LIBRARY_PATH="$bundle_lib"
+export XDG_CONFIG_DIRS="$bundle_etc"/xdg
+export XDG_DATA_DIRS="$bundle_data"
+export GTK_DATA_PREFIX="$bundle_res"
+export GTK_EXE_PREFIX="$bundle_res"
+export GTK_PATH="$bundle_res"
+
+export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
+export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
+export GDK_PIXBUF_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
+export PANGO_LIBDIR="$bundle_lib"
+export PANGO_SYSCONFDIR="$bundle_etc"
+
+#Set $PYTHON to point inside the bundle
+export PYTHON="$bundle_contents/MacOS/python"
+#Add the bundle's python modules
+PYTHONHOME="$bundle_res"
+export PYTHONHOME
+PYTHONPATH="$bundle_res/lib/zenmap"
+export PYTHONPATH
+
+# We need a UTF-8 locale.
+if [ -z ${lang+x} ]; then
+ # lang is unset, we are thus using the Apple locale because it's set to the currently used language,
+ # which is already in the good format
+ lang=`defaults read /Library/Preferences/.GlobalPreferences AppleLocale 2>/dev/null`
+ export LANG="`echo $lang`.UTF-8"
+fi
+
+if test -f "$bundle_lib/charset.alias"; then
+ export CHARSETALIASDIR="$bundle_lib"
+fi
+
+# Extra arguments can be added in environment.sh.
+EXTRA_ARGS=
+if test -f "$bundle_res/environment.sh"; then
+ source "$bundle_res/environment.sh"
+fi
+
+# Strip out the argument added by the OS.
+if /bin/expr "x$1" : "x-psn_.*" > /dev/null; then
+ shift 1
+fi
+
+# Make the real UID equal the effective UID. They are unequal when running
+# with privileges under AuthorizationExecuteWithPrivileges. GTK+ refuses to
+# run if they are different
+# Note that we're calling $PYTHON here to override the version in zenmap's shebang.
+$EXEC $PYTHON -c $'import os\nif os.getuid()!=os.geteuid():os.setuid(os.geteuid())\n'"os.execl(\"$PYTHON\",\"$PYTHON\",\"$bundle_bin/zenmap\")"
diff --git a/zenmap/install_scripts/macosx/make-bundle.sh b/zenmap/install_scripts/macosx/make-bundle.sh
new file mode 100755
index 0000000..7f37d05
--- /dev/null
+++ b/zenmap/install_scripts/macosx/make-bundle.sh
@@ -0,0 +1,106 @@
+#!/bin/bash -e
+set -x
+
+test "x$UNDER_JHBUILD" = "x" && exit 1
+
+# make-bundle.sh
+APP_NAME=Zenmap
+ZENMAP_DIST_DIR=$PWD/dist
+ZENMAP_BUILD_DIR=$PWD/build
+
+export ZENMAP_DIST_DIR
+export ZENMAP_BUILD_DIR
+
+BASE=$ZENMAP_DIST_DIR/$APP_NAME.app/Contents
+SCRIPT_DIR=`dirname "$0"`
+
+echo "Running $0."
+
+echo "Removing old build."
+rm -rf "$ZENMAP_DIST_DIR" "$ZENMAP_BUILD_DIR"
+
+echo "Building python-launcher"
+$CC $CPPFLAGS $CFLAGS $LDFLAGS -L$PREFIX/lib `python3-config --cflags --ldflags --embed` \
+ -o $PREFIX/bin/zenmap-launcher \
+ ~/gtk-mac-bundler/examples/python-launcher.c
+
+echo "Installing Zenmap to local system"
+python3 setup.py install vanilla --prefix "$PREFIX"
+
+echo "Generating dependencies"
+# Have to run this with ~/gtk/inst/python3 or deps have wrong paths
+export XDG_DATA_DIRS=$PREFIX/share
+export DYLD_LIBRARY_PATH=$PREFIX/lib
+export LD_LIBRARY_PATH=$PREFIX/lib
+export GTK_DATA_PREFIX=$PREFIX
+export GTK_EXE_PREFIX=$PREFIX
+export GTK_PATH=$PREFIX
+export PANGO_RC_FILE=$PREFIX/etc/pango/pangorc
+export PANGO_SYSCONFDIR=$PREFIX/etc
+export PANGO_LIBDIR=$PREFIX/lib
+export GDK_PIXBUF_MODULE_FILE=$PREFIX/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
+export GTK_IM_MODULE_FILE=$PREFIX/etc/gtk-3.0/gtk.immodules
+export GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0
+
+python3 "$SCRIPT_DIR/../utils/get_deps.py" "$SCRIPT_DIR/pyreqs.xml"
+# gtk-mac-bundler (xml.dom.minidom) doesn't expand external entities
+xmllint --format --noent "$SCRIPT_DIR/zenmap.bundle" > "$SCRIPT_DIR/tmp.bundle"
+
+echo "Building bundle"
+gtk-mac-bundler "$SCRIPT_DIR/tmp.bundle"
+
+echo "Removing unneeded items"
+# GIR files not needed, only typelib
+rm -rf $BASE/Resources/share/gir-1.0/
+
+echo "Creating caches"
+pushd "$BASE/Resources"
+export GDK_PIXBUF_MODULEDIR=$(ls - lib/gdk-pixbuf-2.0/2.*/loaders)
+gdk-pixbuf-query-loaders > "$GDK_PIXBUF_MODULEDIR".cache
+gtk-update-icon-cache share/icons/hicolor
+popd
+
+# echo "Compiling Python to bytecode"
+PYTHONLIB=$(ls -d $BASE/Resources/lib/python3.*)
+# Remove compiled bytecode, recompile in legacy locations, allowing for removal of source.
+# See PEP-3147
+find "$PYTHONLIB" -depth \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o -name __pycache__ -exec rm -rf '{}' \;
+python -m compileall -b -x 'zenmapGUI|zenmapCore|radialnet' "$PYTHONLIB"
+
+# Remove source if compiled is available, except for Zenmap itself:
+find "$PYTHONLIB" \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o \( -name '*.pyc' -print \) | while read pyc; do
+rm -f "${pyc%.pyc}.py"
+done
+
+# Now compile Zenmap using default (not legacy) location.
+# If we had used legacy location, python.exe tries to write out the PEP-3147
+# location anyway when source is available.
+python -m compileall "$PYTHONLIB"/site-packages #|| true
+echo "Stripping unoptimized Python libraries"
+
+echo "Building using distutils"
+python3 setup.py build --executable "/usr/bin/env python3"
+python3 setup.py install vanilla --prefix "$BASE/Resources"
+
+echo "Renaming main Zenmap executable."
+mv $BASE/MacOS/$APP_NAME $BASE/MacOS/zenmap.bin
+# This is a dummy script, so we'll clean it up:
+#rm $BASE/MacOS/$APP_NAME-bin
+
+echo "Compiling and installing authorization wrapper."
+echo $CC $CPPFLAGS $OBJCFLAGS $LDFLAGS -v "$SCRIPT_DIR/zenmap_auth.m" -lobjc -framework Foundation -o "$BASE/MacOS/$APP_NAME"
+$CC $CPPFLAGS $OBJCFLAGS $LDFLAGS -v "$SCRIPT_DIR/zenmap_auth.m" -lobjc -framework Foundation -o "$BASE/MacOS/$APP_NAME"
+
+echo "Filling out Info.plist"
+python3 - "$SCRIPT_DIR/Info.plist" >"$BASE/Info.plist" <<'EOF'
+import sys
+from string import Template
+from zenmapCore.Version import *
+from zenmapCore.Name import *
+with open(sys.argv[1],"r") as f:
+ sys.stdout.write(Template(f.read()).substitute(
+ VERSION=VERSION,
+ APP_WEB_SITE=APP_WEB_SITE,
+ APP_COPYRIGHT=APP_COPYRIGHT
+ ))
+EOF
diff --git a/zenmap/install_scripts/macosx/zenmap.bundle b/zenmap/install_scripts/macosx/zenmap.bundle
new file mode 100644
index 0000000..dff4c31
--- /dev/null
+++ b/zenmap/install_scripts/macosx/zenmap.bundle
@@ -0,0 +1,144 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE app-bundle [
+<!ENTITY PYVER "3.10">
+<!ENTITY pyreqs SYSTEM "pyreqs.xml">
+]>
+<app-bundle>
+
+ <meta>
+ <!-- Where to pick up the GTK+ installation, icon themes,
+ etc. Note that "${env:JHBUILD_PREFIX}" is evaluated to the
+ value of the environment variable JHBUILD_PREFIX. You can
+ define additional prefixes and refer to them in paths
+ throughout this file on the form "${prefix:name}". This is
+ useful for installing certain libraries or even the
+ application itself separately. Note that JHBUILD_PREFIX is
+ defined by jhbuild, so it you are not using jhbuild you can
+ either define your own or just hardcode the path here.
+ -->
+ <prefix name="default">${env:JHBUILD_PREFIX}</prefix>
+
+ <!-- The project directory is the default location of the created
+ app. If you leave out the path, the current directory is
+ used. Note the usage of an environment variable here again.
+ -->
+ <destination overwrite="yes">${env:ZENMAP_DIST_DIR}</destination>
+
+ <!-- Comment this out to keep the install names in binaries. -->
+ <run-install-name-tool/>
+
+ <!-- REMOVED: A launcher script is pretty much mandatory here so that we can
+ set $PYTHON to point to the python in the bundle.
+ <launcher-script>${project}/launcher.sh</launcher-script>
+ -->
+
+ <!-- Indicate the active gtk version to use. This is needed only
+ for gtk+-3.0 projects. -->
+ <gtk>gtk+-3.0</gtk>
+ </meta>
+
+ <!-- The special macro "${project}" refers to the directory where
+ this bundle file is located. The application name and bundle
+ identifier are taken from the plist file.
+ -->
+ <plist>${project}/Info.plist</plist>
+
+<!-- See examples/python-launcher.bundle for info on entitlements if needed -->
+<!-- NEW! -->
+ <!-- Build gramps-launcher with:
+ gcc -L$PREFIX/lib `python-config -\-cflags -\-ldflags` \
+ -o $PREFIX/bin/python-launcher \
+ path/to/gtk-mac-bundler/examples/python-launcher.c
+ with the obvious substitution.
+ -->
+ <main-binary>
+ ${prefix}/bin/zenmap-launcher
+ </main-binary>
+
+ <!-- We need to pack our own Python to avoid compatibility problems. -->
+ <binary dest="${bundle}/Contents/MacOS">
+ ${prefix}/bin/python3
+ </binary>
+ <!-- Copy in GTK+ modules. Note the use of the
+ "${pkg:module:variable}" macro, which evaluates to a pkg-config
+ variable in the specified module. Note that any libraries that
+ binaries link to are also copied in automatically.
+ -->
+<!-- PNG is built-in -->
+ <binary>
+ ${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/loaders/libpixbufloader-gif.so
+ </binary>
+
+<!-- Copy in the quartz input method. The rest aren't used on MacOS. -->
+ <binary>
+ ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/immodules/im-quartz.so
+ </binary>
+
+<!-- And the print backends -->
+ <binary>
+ ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
+ </binary>
+
+ <!-- Python modules other than tnese are grabbed with get_deps.py -->
+ <binary>
+ ${prefix}/lib/python&PYVER;/site-packages/gi/*.so
+ </binary>
+ <binary>
+ ${prefix}/lib/python&PYVER;/site-packages/cairo/*.so
+ </binary>
+
+&pyreqs;
+
+ <binary>
+ ${prefix}/lib/libgtkmacintegration-gtk3.dylib
+ </binary>
+
+ <gir> ${prefix}/share/gir-1.0/Atk-1.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/GLib-2.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/GModule-2.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/GObject-2.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/Gdk-3.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/GdkPixbuf-2.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/Gio-2.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/Gtk-3.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/HarfBuzz-0.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/Pango-1.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/PangoCairo-1.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/PangoOT-1.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/cairo-1.0.gir </gir>
+ <gir> ${prefix}/share/gir-1.0/freetype2-2.0.gir </gir>
+
+ <!-- This python file sets up all of the environment variables
+ needed to run your program. The example contains those
+ necessary for running a basic Gtk program. -->
+ <data dest="${bundle}/Contents/Resources">
+ ${project}/zenmap_launcher.py
+ </data>
+
+ <data>
+ ${prefix}/share/glib-2.0/schemas
+ </data>
+
+
+ <!-- Copy icons. Note that the .icns file is an Apple format which
+ contains up to 4 sizes of icon. You can use
+ /Developer/Applications/Utilities/Icon Composer.app to import
+ artwork and create the file. -->
+ <data dest="${bundle}/Contents/Resources">
+ ${project}/zenmap.icns
+ </data>
+
+ <!-- Icon themes to copy. The "icons" property can be either of
+ "auto", "all", or "none". All or none should be
+ self-explanatory, while auto means that the script will try to
+ figure out which icons are needed. This is done by getting all
+ the strings from all copied binaries, and matching them against
+ icon names. To be safe, you should use "all". "none" is useful
+ if you want just the index.theme file but no icons, mostly
+ needed for the "hicolor" base theme.
+ >
+ <icon-theme icons="none">
+ Tango
+ </icon-theme -->
+
+</app-bundle>
diff --git a/zenmap/install_scripts/macosx/zenmap.icns b/zenmap/install_scripts/macosx/zenmap.icns
new file mode 100644
index 0000000..2ea4e86
--- /dev/null
+++ b/zenmap/install_scripts/macosx/zenmap.icns
Binary files differ
diff --git a/zenmap/install_scripts/macosx/zenmap_auth.m b/zenmap/install_scripts/macosx/zenmap_auth.m
new file mode 100644
index 0000000..b42e568
--- /dev/null
+++ b/zenmap/install_scripts/macosx/zenmap_auth.m
@@ -0,0 +1,49 @@
+//
+// zenmap_auth.m
+// Objective-C
+//
+// This program attempts to run an applescript script which asks for root
+// privileges. If the authorization fails or is canceled, Zenmap is run
+// without privileges using applescript.
+//
+// This program is the first link in the chain:
+// zenmap_auth -> zenmap_wrapper.py -> zenmap.bin
+//
+
+#import <Foundation/Foundation.h>
+#import <libgen.h>
+#define EXECUTABLE_NAME "zenmap.bin"
+
+int main(int argc, const char * argv[]) {
+ @autoreleasepool {
+ NSString *executable_path;
+ NSString *cwd;
+ size_t len_cwd;
+
+ cwd = [[NSBundle mainBundle] bundlePath];
+ len_cwd = [cwd length];
+ executable_path = cwd;
+ executable_path = [NSString stringWithFormat:@"%@/Contents/MacOS/%s", executable_path, EXECUTABLE_NAME];
+ NSLog(@"%@",executable_path);
+
+ NSDictionary *error = [NSDictionary new];
+ NSString *script = [NSString stringWithFormat:@"do shell script \"%@\" with administrator privileges", executable_path];
+NSLog(@"Executing: >>%@<<", script);
+ NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:script];
+ if ([appleScript executeAndReturnError:&error]) {
+ NSLog(@"success!");
+ } else {
+ NSLog(@"Failed to execute applescript with admin privileges: %@", error[@"NSAppleScriptErrorMessage"]);
+ NSDictionary *error = [NSDictionary new];
+ NSString *script = [NSString stringWithFormat:@"do shell script \"%@\"", executable_path];
+NSLog(@"Executing: >>%@<<", script);
+ NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:script];
+ if ([appleScript executeAndReturnError:&error]) {
+ NSLog(@"success!");
+ } else {
+ NSLog(@"Failed to execute applescript: %@", error[@"NSAppleScriptErrorMessage"]);
+ }
+ }
+ }
+ return 0;
+}
diff --git a/zenmap/install_scripts/macosx/zenmap_launcher.py b/zenmap/install_scripts/macosx/zenmap_launcher.py
new file mode 100644
index 0000000..98aca78
--- /dev/null
+++ b/zenmap/install_scripts/macosx/zenmap_launcher.py
@@ -0,0 +1,43 @@
+from os.path import join, dirname, abspath, normpath
+import sys, os
+import platform
+
+
+bundlepath = sys.argv[0]
+
+bundle_contents = join(bundlepath, 'Contents')
+bundle_res = join(bundle_contents, 'Resources')
+
+bundle_lib = join(bundle_res, 'lib')
+bundle_bin = join(bundle_res, 'bin')
+bundle_data = join(bundle_res, 'share')
+bundle_etc = join(bundle_res, 'etc')
+
+os.environ['XDG_DATA_DIRS'] = bundle_data
+os.environ['DYLD_LIBRARY_PATH'] = bundle_lib
+os.environ['LD_LIBRARY_PATH'] = bundle_lib
+os.environ['GTK_DATA_PREFIX'] = bundle_res
+os.environ['GTK_EXE_PREFIX'] = bundle_res
+os.environ['GTK_PATH'] = bundle_res
+
+os.environ['PANGO_RC_FILE'] = join(bundle_etc, 'pango', 'pangorc')
+os.environ['PANGO_SYSCONFDIR'] = bundle_etc
+os.environ['PANGO_LIBDIR'] = bundle_lib
+os.environ['GDK_PIXBUF_MODULE_FILE'] = join(bundle_lib, 'gdk-pixbuf-2.0',
+ '2.10.0', 'loaders.cache')
+if int(platform.release().split('.')[0]) > 10:
+ os.environ['GTK_IM_MODULE_FILE'] = join(bundle_etc, 'gtk-3.0',
+ 'gtk.immodules')
+
+os.environ['GI_TYPELIB_PATH'] = join(bundle_lib, 'girepository-1.0')
+
+#Set $PYTHON to point inside the bundle
+PYVER = 'python3.10'
+sys.path.append(bundle_res)
+
+os.environ['USERPROFILE'] = os.environ['HOME']
+os.environ['APPDATA'] = join(os.environ['HOME'], 'Library', 'Application Support')
+# Replace my_app with the file or module with your main() function.
+from zenmapGUI import App
+App.run()
+
diff --git a/zenmap/install_scripts/unix/su-to-zenmap.sh b/zenmap/install_scripts/unix/su-to-zenmap.sh
new file mode 100755
index 0000000..9216a4e
--- /dev/null
+++ b/zenmap/install_scripts/unix/su-to-zenmap.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+#this code is bassed off of the debian su-to-root command
+#Joost Witteveen <joostje@debian.org>
+#Morten Brix Pedersen
+#Bill Allombert <ballombe@debian.org>
+
+PRIV=root
+COMMAND="zenmap"
+
+quote () { printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/" ; }
+
+for i in "$@"; do
+ COMMAND="$COMMAND $(quote "$i")"
+done
+
+euid=$(id -u)
+privid=$(id -u $PRIV)
+if test "$euid" = "$privid"; then
+ $COMMAND
+else
+ if test -z "$SU_TO_ROOT_X"; then
+ if which gksu >/dev/null 2>&1 ; then
+ SU_TO_ROOT_X=gksu
+ if test "X$KDE_FULL_SESSION" = "Xtrue" ; then
+ if which kdesu >/dev/null 2>&1 ; then
+ SU_TO_ROOT_X=kdesu
+ elif test -x /usr/lib/kde4/libexec/kdesu ; then
+ SU_TO_ROOT_X=kde4su
+ fi;
+ fi;
+ elif which kdesu >/dev/null 2>&1 ; then
+ SU_TO_ROOT_X=kdesu
+ elif test -x /usr/lib/kde4/libexec/kdesu ; then
+ SU_TO_ROOT_X=kde4su
+ elif which ktsuss >/dev/null 2>&1 ; then
+ SU_TO_ROOT_X=ktsuss
+ elif which xterm>/dev/null 2>&1 ;then
+ if which sudo>/dev/null 2>&1 ;then
+ SU_TO_ROOT_X=sdterm
+ else
+ SU_TO_ROOT_X=sterm
+ fi;
+ else
+ SU_TO_ROOT_X=su-to-root
+ fi
+ fi
+ case $SU_TO_ROOT_X in
+ gksu) gksu -u "$PRIV" "$COMMAND";;
+ kdesu) kdesu -u "$PRIV" -c "$COMMAND";;
+ kde4su) /usr/lib/kde4/libexec/kdesu -u "$PRIV" -c "$COMMAND";;
+ ktsuss) ktsuss -u "$PRIV" "$COMMAND";;
+ # As a last resort, open a new xterm use sudo/su
+ sdterm) xterm -e "sudo -u $PRIV $COMMAND";;
+ sterm) xterm -e "su -l $PRIV -c $COMMAND";;
+ esac;
+fi
+
diff --git a/zenmap/install_scripts/unix/zenmap-root.desktop b/zenmap/install_scripts/unix/zenmap-root.desktop
new file mode 100644
index 0000000..c5f4c10
--- /dev/null
+++ b/zenmap/install_scripts/unix/zenmap-root.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Zenmap (as root)
+GenericName=GUI Port Scanner
+TryExec=su-to-zenmap.sh
+Exec=su-to-zenmap.sh %F
+Terminal=false
+Icon=zenmap
+Type=Application
+Categories=Application;Network;Security;
+Comment=A cross-platform GUI for the Nmap Security Scanner.
+Keywords=network;scan;scanner;IP;security;
diff --git a/zenmap/install_scripts/unix/zenmap.desktop b/zenmap/install_scripts/unix/zenmap.desktop
new file mode 100644
index 0000000..b27d342
--- /dev/null
+++ b/zenmap/install_scripts/unix/zenmap.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Zenmap
+GenericName=GUI Port Scanner
+TryExec=zenmap
+Exec=zenmap %F
+Terminal=false
+Icon=zenmap
+Type=Application
+Categories=Application;Network;Security;
+Comment=A cross-platform GUI for the Nmap Security Scanner.
+Keywords=network;scan;scanner;IP;security;
diff --git a/zenmap/install_scripts/utils/get_deps.py b/zenmap/install_scripts/utils/get_deps.py
new file mode 100755
index 0000000..631bae6
--- /dev/null
+++ b/zenmap/install_scripts/utils/get_deps.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python3
+
+import modulefinder
+import configparser
+import sys
+import os.path
+import site
+import encodings
+
+site_package_deps = ("gi", "cairo")
+
+# These items are unneeded, large, and on macOS _ssl causes dependency problems.
+pyd_remove = ("_decimal", "_ssl", "_testcapi", "_hashlib")
+
+def module_paths(mods):
+ for m in mods:
+ if m.__name__ in pyd_remove:
+ continue
+ elif getattr(m, "__file__", None) and m.__file__.startswith(sys.prefix):
+ yield m.__file__
+
+def get_deps():
+ # Start with pygobject and zenmap itself
+ sitedirs = site.getsitepackages()
+ files = set(os.path.join(sitedirs[0], name) for name in site_package_deps)
+
+ # These items are missed by modulefinder
+ files.add(encodings.__path__[0]) # All encodings just in case
+ for path in module_paths((site, site._sitebuiltins)):
+ files.add(path)
+
+ # Now use modulefinder to get the rest
+ mfind = modulefinder.ModuleFinder()
+ mfind.run_script(os.path.normpath(__file__ + '/../../../zenmapGUI/App.py'))
+ for path in module_paths(mfind.modules.values()):
+ parent = os.path.dirname(path)
+ found_parent = False
+ # If a parent dir is already included, don't bother listing the file.
+ while parent not in sys.path and len(parent) > 2:
+ if parent in files:
+ found_parent = True
+ break
+ parent = os.path.dirname(parent)
+ if not found_parent:
+ files.add(path)
+ return files
+
+def read_cfg(filename):
+ cfg = configparser.ConfigParser()
+ cfg.read(filename)
+ return cfg
+
+def write_cfg(cfg, filename):
+ with open(filename, "w") as f:
+ cfg.write(f)
+
+def update_cfg(cfg, files):
+ filestr = "\nmingw*".join((f.removeprefix(sys.prefix) for f in files))
+ oldvalue = cfg.get('bundle', 'nodelete')
+ cfg.set('bundle', 'nodelete', oldvalue + "\nmingw*" + filestr)
+
+def write_xml(filename, files):
+ with open(filename, "w") as f:
+ for file in files:
+ fname = r"${prefix}" + file.removeprefix(sys.prefix)
+ fmt = "<data>{}</data>"
+ if file.endswith(".so"):
+ fmt = "<binary>{}</binary>"
+ print(fmt.format(fname), file=f)
+
+if __name__ == "__main__":
+ files = get_deps()
+ if sys.platform == "win32":
+ cfg = read_cfg(sys.argv[2])
+ update_cfg(cfg, files)
+ write_cfg(cfg, sys.argv[1])
+ elif sys.platform == "darwin":
+ write_xml(sys.argv[1], files)
+ else:
+ raise NotImplementedError
diff --git a/zenmap/install_scripts/utils/version_update.py b/zenmap/install_scripts/utils/version_update.py
new file mode 100644
index 0000000..8ff9d84
--- /dev/null
+++ b/zenmap/install_scripts/utils/version_update.py
@@ -0,0 +1,107 @@
+#!/usr/bin/env python3
+
+# ***********************IMPORTANT NMAP LICENSE TERMS************************
+# *
+# * The Nmap Security Scanner is (C) 1996-2023 Nmap Software LLC ("The Nmap
+# * Project"). Nmap is also a registered trademark of the Nmap Project.
+# *
+# * This program is distributed under the terms of the Nmap Public Source
+# * License (NPSL). The exact license text applying to a particular Nmap
+# * release or source code control revision is contained in the LICENSE
+# * file distributed with that version of Nmap or source code control
+# * revision. More Nmap copyright/legal information is available from
+# * https://nmap.org/book/man-legal.html, and further information on the
+# * NPSL license itself can be found at https://nmap.org/npsl/ . This
+# * header summarizes some key points from the Nmap license, but is no
+# * substitute for the actual license text.
+# *
+# * Nmap is generally free for end users to download and use themselves,
+# * including commercial use. It is available from https://nmap.org.
+# *
+# * The Nmap license generally prohibits companies from using and
+# * redistributing Nmap in commercial products, but we sell a special Nmap
+# * OEM Edition with a more permissive license and special features for
+# * this purpose. See https://nmap.org/oem/
+# *
+# * If you have received a written Nmap license agreement or contract
+# * stating terms other than these (such as an Nmap OEM license), you may
+# * choose to use and redistribute Nmap under those terms instead.
+# *
+# * The official Nmap Windows builds include the Npcap software
+# * (https://npcap.com) for packet capture and transmission. It is under
+# * separate license terms which forbid redistribution without special
+# * permission. So the official Nmap Windows builds may not be redistributed
+# * without special permission (such as an Nmap OEM license).
+# *
+# * 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.
+# *
+# * Source code also allows you to port Nmap to new platforms, fix bugs, and add
+# * new features. You are highly encouraged to submit your changes as a Github PR
+# * or by email to the dev@nmap.org mailing list for possible incorporation into
+# * the main distribution. Unless you specify otherwise, it is understood that
+# * you are offering us very broad rights to use your submissions as described in
+# * the Nmap Public Source License Contributor Agreement. This is important
+# * because we fund the project by selling licenses with various terms, and also
+# * because the inability to relicense code has caused devastating problems for
+# * other Free Software projects (such as KDE and NASM).
+# *
+# * The free version of Nmap is distributed in the hope that it will be
+# * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Warranties,
+# * indemnification and commercial support are all available through the
+# * Npcap OEM program--see https://nmap.org/oem/
+# *
+# ***************************************************************************/
+
+# This program updates the version number in all the places it needs to be
+# updated. It takes a single command-line argument, which is the new version
+# number. For example:
+# python install_scripts/utils/version_update.py X.YY
+
+import os
+import sys
+import re
+from datetime import datetime
+
+VERSION = os.path.join("share", "zenmap", "config", "zenmap_version")
+VERSION_PY = os.path.join("zenmapCore", "Version.py")
+NAME_PY = os.path.join("zenmapCore", "Name.py")
+
+
+def update_date(base_dir):
+ name_file = os.path.join(base_dir, NAME_PY)
+ print(">>> Updating %s" % name_file)
+ nf = open(name_file, "r")
+ ncontent = nf.read()
+ nf.close()
+ ncontent = re.sub(r'APP_COPYRIGHT *= *"Copyright 2005-....',
+ 'APP_COPYRIGHT = "Copyright 2005-%d' % (datetime.today().year),
+ ncontent)
+ # Write the modified file.
+ nf = open(name_file, "w")
+ nf.write(ncontent)
+ nf.close()
+
+
+def update_version(base_dir, version):
+ print(">>> Updating %s" % os.path.join(base_dir, VERSION))
+ vf = open(os.path.join(base_dir, VERSION), "w")
+ print(version, file=vf)
+ vf.close()
+ print(">>> Updating %s" % os.path.join(base_dir, VERSION_PY))
+ vf = open(os.path.join(base_dir, VERSION_PY), "w")
+ print("VERSION = \"%s\"" % version, file=vf)
+ vf.close()
+
+
+if __name__ == "__main__":
+ if len(sys.argv) != 2:
+ print("Usage: %s <version>" % sys.argv[0], file=sys.stderr)
+ sys.exit(1)
+
+ version = sys.argv[1]
+ print(">>> Updating version number to \"%s\"" % version)
+ update_version(".", version)
+ update_date(".")
diff --git a/zenmap/install_scripts/windows/Makefile b/zenmap/install_scripts/windows/Makefile
new file mode 100755
index 0000000..a1479fb
--- /dev/null
+++ b/zenmap/install_scripts/windows/Makefile
@@ -0,0 +1,15 @@
+export MSYS2_ARG_CONV_EXCL=""
+all: dist/zenmap-w64-deletelog.txt mingw-w64-x86_64-python-zenmap-*.pkg.tar.zst
+ ./build.sh
+
+mingw-w64-x86_64-python-zenmap-%.pkg.tar.zst: PKGBUILD
+ makepkg-mingw -RdfL
+
+dist/zenmap-w64-deletelog.txt: tmp.cfg mingw-w64-x86_64-python-zenmap-*.pkg.tar.zst
+ styrene -p . -o $(dir $@) tmp.cfg --no-exe --no-zip
+
+tmp.cfg: styrene.cfg ../utils/get_deps.py
+ python3 ../utils/get_deps.py $@ $<
+
+clean:
+ rm -rf tmp.cfg pkg/ src/ dist/ mingw-w64-*-package.log* mingw-w64-*.zst
diff --git a/zenmap/install_scripts/windows/PKGBUILD b/zenmap/install_scripts/windows/PKGBUILD
new file mode 100644
index 0000000..69a6eaf
--- /dev/null
+++ b/zenmap/install_scripts/windows/PKGBUILD
@@ -0,0 +1,32 @@
+# 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}")
+NMAP_DIR=$(realpath "../../..")
+pkgver=$(echo NMAP_VERSION | ${CC} -E -imacros "${NMAP_DIR}/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() {
+ cd "${NMAP_DIR}/zenmap"
+ ${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"
+}
diff --git a/zenmap/install_scripts/windows/boot_script.py b/zenmap/install_scripts/windows/boot_script.py
new file mode 100644
index 0000000..db0be73
--- /dev/null
+++ b/zenmap/install_scripts/windows/boot_script.py
@@ -0,0 +1,27 @@
+# Custom py2exe boot script
+
+# This runs after py2exe's boot_common.py. That file overrides sys.stderr and
+# sys.stdout to write to a logfile and a black hole, respectively. The location
+# for the stderr logfile is sys.executable + '.log', though, which is not
+# usually writable. We'll change it here to write to some other writable path.
+
+
+import sys
+import os
+import os.path
+
+
+#sys.stderr.write("Enter boot_script\n")
+# Only do this if py2exe installed its Stderr object
+if sys.stderr.__class__.__name__ == "Stderr":
+ logdir = os.environ.get("LOCALAPPDATA",
+ os.environ.get("APPDATA",
+ os.environ.get("TEMP", "")))
+
+ if sys.stderr._file is not None:
+ sys.stderr._file.close()
+ sys.stderr._file = open(os.path.join(logdir, "zenmap.exe.log"), 'a')
+
+
+del os
+del sys
diff --git a/zenmap/install_scripts/windows/build.sh b/zenmap/install_scripts/windows/build.sh
new file mode 100644
index 0000000..89ce43e
--- /dev/null
+++ b/zenmap/install_scripts/windows/build.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+# bash shebang because MSYS2/Styrene require Bash, not just /bin/sh
+set -x
+set -e
+
+export MSYS2_ARG_CONV_EXCL=""
+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
+
+PACKAGEDIR=$BUILDDIR/zenmap-w64/mingw64
+PYTHONLIB=$(ls -d $PACKAGEDIR/lib/python3.*)
+
+# Remove compiled bytecode, recompile in legacy locations, allowing for removal of source.
+# See PEP-3147
+find "$PYTHONLIB" -depth \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o -name __pycache__ -exec rm -rf '{}' \;
+# Exit code not reliable
+python -m compileall -b -x 'zenmapGUI|zenmapCore|radialnet' "$PYTHONLIB" #|| true
+
+# Remove source if compiled is available, except for Zenmap itself:
+find "$PYTHONLIB" \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o \( -name '*.pyc' -print \) | while read pyc; do
+rm -f "${pyc%.pyc}.py"
+done
+
+# Now compile Zenmap using default (not legacy) location.
+# If we had used legacy location, python.exe tries to write out the PEP-3147
+# location anyway when source is available.
+python -m compileall "$PYTHONLIB"/site-packages #|| true
+
+# Remove some of the larger unused items
+rm -f "$PACKAGEDIR"/bin/win7appid.exe
+
+# strip binaries
+find "$PACKAGEDIR" \( -name '*.exe' -o -name '*.dll' -o -name '*.pyd' \) -exec strip -g '{}' \;
+
+# Create cache files as needed
+cd "$PACKAGEDIR"
+export GDK_PIXBUF_MODULEDIR=$(ls -d lib/gdk-pixbuf-2.0/2.*/loaders)
+gdk-pixbuf-query-loaders > "$GDK_PIXBUF_MODULEDIR".cache
+gtk-update-icon-cache share/icons/hicolor
+
diff --git a/zenmap/install_scripts/windows/copy_and_compile.bat b/zenmap/install_scripts/windows/copy_and_compile.bat
new file mode 100755
index 0000000..b6cb68a
--- /dev/null
+++ b/zenmap/install_scripts/windows/copy_and_compile.bat
@@ -0,0 +1,57 @@
+@echo off
+
+echo Setting installation variables...
+set PythonDir=..\..\nmap-mswin32-aux\Python
+set PythonEXE=%PythonDir%\python.exe
+set DistDir=dist
+set LibraryDir=%DistDir%\py2exe
+set GTKDir=%PythonDir%\Lib\site-packages\gtk-2.0\runtime
+set Output=win_install.log
+
+IF EXIST %PythonEXE% GOTO GGTK
+ECHO No Python found!
+EXIT 1
+
+:GGTK
+IF EXIST %GTKDir% GOTO GWork
+ECHO No GTK found!
+EXIT 1
+
+:GWork
+
+echo Writing output to %Output%
+
+echo Removing old compilation...
+IF EXIST %DistDir% rd %DistDir% /s /q > %Output%
+
+echo Creating dist directory tree...
+mkdir %LibraryDir%\etc
+mkdir %LibraryDir%\share
+mkdir %LibraryDir%\share\themes
+mkdir %LibraryDir%\share\icons
+mkdir %LibraryDir%\lib
+
+echo Copying GTK files to dist directory...
+xcopy %GTKDir%\bin\*.dll %LibraryDir% /S >> %Output%
+rem intl.dll is a special case; has to be in the executable directory instead of
+rem the py2exe subdirectory.
+xcopy %GTKDir%\etc %LibraryDir%\etc /S /I >> %Output%
+xcopy %GTKDir%\lib\gtk-2.0 %LibraryDir%\lib\gtk-2.0 /S /I >> %Output%
+xcopy %GTKDir%\share\themes\Default %LibraryDir%\share\themes\Default /S /I >> %Output%
+xcopy %GTKDir%\share\themes\MS-Windows %LibraryDir%\share\themes\MS-Windows /S /I >> %Output%
+xcopy %GTKDir%\share\icons\hicolor %LibraryDir%\share\icons\hicolor /S /I >> %Output%
+
+echo Compiling using py2exe...
+%PythonEXE% setup.py py2exe >> %Output%
+
+echo Removing the build directory...
+rd build /s /q >> %Output%
+
+rem Check that the gtkrc file was manually created so Zenmap will look pretty
+IF EXIST %DistDir%\etc\gtk-2.0\gtkrc GOTO gtkrc
+echo gtk-theme-name = "MS-Windows" > %DistDir%\py2exe\etc\gtk-2.0\gtkrc
+echo Created the missing file %DistDir%\py2exe\etc\gtk-2.0\gtkrc >> %Output%
+:gtkrc
+
+echo Done!
+
diff --git a/zenmap/install_scripts/windows/nmap-eye.ico b/zenmap/install_scripts/windows/nmap-eye.ico
new file mode 100644
index 0000000..7cb8b12
--- /dev/null
+++ b/zenmap/install_scripts/windows/nmap-eye.ico
Binary files differ
diff --git a/zenmap/install_scripts/windows/styrene.cfg b/zenmap/install_scripts/windows/styrene.cfg
new file mode 100755
index 0000000..b5cfd2c
--- /dev/null
+++ b/zenmap/install_scripts/windows/styrene.cfg
@@ -0,0 +1,171 @@
+# 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
+
+# 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.
+ mingw*/share/glib*/schemas
+
+ #mingw*/bin/gtk-update-icon-cache*.exe
+ #usr/bin/mkdir.exe
+ #usr/bin/msys-2*.dll
+ #usr/share/libalpm
+
+ #var/lib/pacman/local/mingw-w64-*-hicolor-icon-theme-*-*/install
+
+ # Runtime requirements for the demos etc.
+ mingw*/etc/gtk-3.0
+ # Required DLLs. Checked with:
+ # * recursive `dumpbin /imports` on known python/gtk dlls
+ # * recursive `dumpbin /imports` on pyd files in lib/python3.10
+ # * `g-ir-inspect --print-shlibs` for typelibs listed below
+ mingw*/bin/libatk-1.0-0.dll
+ mingw*/bin/libbrotlicommon.dll
+ mingw*/bin/libbrotlidec.dll
+ mingw*/bin/libbz2-1.dll
+ mingw*/bin/libcairo-2.dll
+ mingw*/bin/libcairo-gobject-2.dll
+ mingw*/bin/libdatrie-1.dll
+ mingw*/bin/libepoxy-0.dll
+ mingw*/bin/libexpat-1.dll
+ mingw*/bin/libffi-8.dll
+ mingw*/bin/libfontconfig-1.dll
+ mingw*/bin/libfreetype-6.dll
+ mingw*/bin/libfribidi-0.dll
+ mingw*/bin/libgcc_s_seh-1.dll
+ mingw*/bin/libgdk-3-0.dll
+ mingw*/bin/libgdk_pixbuf-2.0-0.dll
+ mingw*/bin/libgio-2.0-0.dll
+ mingw*/bin/libgirepository-1.0-1.dll
+ mingw*/bin/libglib-2.0-0.dll
+ mingw*/bin/libgmodule-2.0-0.dll
+ mingw*/bin/libgobject-2.0-0.dll
+ mingw*/bin/libgraphite2.dll
+ mingw*/bin/libgtk-3-0.dll
+ mingw*/bin/libharfbuzz-0.dll
+ mingw*/bin/libharfbuzz-gobject-0.dll
+ mingw*/bin/libiconv-2.dll
+ mingw*/bin/libintl-8.dll
+ mingw*/bin/libpango-1.0-0.dll
+ mingw*/bin/libpangocairo-1.0-0.dll
+ mingw*/bin/libpangoft2-1.0-0.dll
+ mingw*/bin/libpangowin32-1.0-0.dll
+ mingw*/bin/libpcre2-8-0.dll
+ mingw*/bin/libpixman-1-0.dll
+ mingw*/bin/libpng16-16.dll
+ mingw*/bin/libpython3.10.dll
+ mingw*/bin/libsqlite3-0.dll
+ mingw*/bin/libstdc++-6.dll
+ mingw*/bin/libthai-0.dll
+ mingw*/bin/libwinpthread-1.dll
+ mingw*/bin/zlib1.dll
+
+ mingw*/lib/gtk-3.0
+ mingw*/lib/gdk-pixbuf-2.0/*/loaders/libpixbufloader-png.dll
+ mingw*/lib/gdk-pixbuf-2.0/*/loaders/libpixbufloader-png.dll.a
+ mingw*/lib/gdk-pixbuf-2.0/*/loaders/libpixbufloader-gif.dll
+ mingw*/lib/gdk-pixbuf-2.0/*/loaders/libpixbufloader-gif.dll.a
+
+
+ mingw*/share/icons/hicolor/index.theme
+
+ # python-gobject stuff
+ mingw*/lib/girepository-*/Atk-1.0.typelib
+ mingw*/lib/girepository-*/GLib-2.0.typelib
+ mingw*/lib/girepository-*/GModule-2.0.typelib
+ mingw*/lib/girepository-*/GObject-2.0.typelib
+ mingw*/lib/girepository-*/Gdk-3.0.typelib
+ mingw*/lib/girepository-*/GdkPixbuf-2.0.typelib
+ mingw*/lib/girepository-*/Gio-2.0.typelib
+ mingw*/lib/girepository-*/Gtk-3.0.typelib
+ mingw*/lib/girepository-*/HarfBuzz-0.0.typelib
+ mingw*/lib/girepository-*/Pango-1.0.typelib
+ mingw*/lib/girepository-*/PangoCairo-1.0.typelib
+ mingw*/lib/girepository-*/PangoOT-1.0.typelib
+ mingw*/lib/girepository-*/cairo-1.0.typelib
+ mingw*/lib/girepository-*/freetype2-2.0.typelib
+
+ # To avoid terminal window, use pythonw.exe
+ mingw*/bin/pythonw.exe
+ # For debugging use python.exe
+ mingw*/bin/python.exe
+ # Zenmap's files (mostly in site-packages above)
+ mingw*/share/zenmap
+ # mingw*/bin/zenmap
+ mingw*/lib/python3.*/site-packages/zenmapCore
+ mingw*/lib/python3.*/site-packages/zenmapGUI
+ mingw*/lib/python3.*/site-packages/radialnet
+
+ # The python modules here will be added by script:
+ # mingw*/lib/python3.*
+ # mingw*/lib/python3.*/encodings
+ # mingw*/lib/python3.*/site.py
+ # mingw*/lib/python3.*/_sitebuiltins.py
+ # mingw*/lib/python3.*/site-packages/gi
+ # mingw*/lib/python3.*/site-packages/cairo
+
+# 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 = python.exe -c 'from zenmapGUI.App import run; run()' -vvvvv