Skip to content

A free, open-source alternative to Burp Suite: an intercepting proxy and web app security testing suite with Repeater, Intruder, Collaborator and a built-in OWASP ZAP scanner. Linux, AGPL-3.0.

3.7 KB
Raw Blame
#!/usr/bin/env bash
# Build Open Suite for 64-bit Windows: dist/opensuite-windows-x64.zip.
#
# The zip holds one folder, OpenSuite, with OpenSuite.exe in it. Like the
# AppImage it carries its own Java runtime, the scan engine (inside the release
# jar) and the browser with its driver, so a user unpacks it anywhere and runs
# it. Nothing is installed and nothing is fetched on first use.
#
# The program is not signed, so Windows SmartScreen asks once before the first
# start: More info > Run anyway.
#
# Run it in Git Bash on 64-bit Windows, with engine/ and browser/ fetched for it
# (./fetch-zap.sh, ./fetch-browser.sh). The JDK is fetched if missing.
set -euo pipefail
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"

case "$(uname -s)-$(uname -m)" in
    MINGW*-x86_64|MSYS*-x86_64) ;;
    *) echo "Build this in Git Bash on 64-bit Windows." >&2; exit 1 ;;
esac
[ -x "$DIR/jdk/bin/javac" ] || ./fetch-jdk.sh
export JAVA_HOME="$DIR/jdk"
export PATH="$DIR/jdk/bin:$PATH"

ls engine/zap-*.jar >/dev/null 2>&1 || { echo "engine/ is missing. Run ./fetch-zap.sh first." >&2; exit 1; }
if [ ! -f browser/chrome-win/chrome.exe ] || [ ! -f browser/chromedriver.exe ]; then
    echo "browser/ is missing or is not the Windows build. Run ./fetch-browser.sh first." >&2
    exit 1
fi

echo ">> building the self-contained release jar"
./release.sh
JAR="$(ls -t dist/opensuite_*.jar | head -1)"
JARNAME="$(basename "$JAR")"
TS="${JARNAME#opensuite_}"; TS="${TS%.jar}"
# A Windows program version is up to four numbers: 20261203-190612 -> 2026.1203.190612.
VERSION="${TS:0:4}.$((10#${TS:4:4})).$((10#${TS:9:6}))"

OUT="$DIR/build/windows"
rm -rf "$OUT"
mkdir -p "$OUT/in"
cp "$JAR" "$OUT/in/"

echo ">> Java runtime from the bundled JDK"
# As for the AppImage: the whole JDK minus what only development needs. The
# scan engine runs as its own Java process, so bin/java.exe must stay.
cp -a jdk "$OUT/runtime"
rm -rf "$OUT/runtime/lib/src.zip" "$OUT/runtime/include" "$OUT/runtime/demo" \
       "$OUT/runtime/sample" "$OUT/runtime/jmods"

echo ">> jpackage: OpenSuite"
# The same memory rule as the other launchers: half of the machine unless
# Settings > Suite > Performance says otherwise (applied by a restart).
jpackage --type app-image --name OpenSuite --app-version "$VERSION" \
    --input "$OUT/in" --main-jar "$JARNAME" --main-class opensuite.ui.Main \
    --icon icon/opensuite.ico --runtime-image "$OUT/runtime" \
    --java-options "-XX:MaxRAMPercentage=50" --java-options "-XX:+UseG1GC" \
    --java-options "-Xms64m" --java-options "-XX:MinHeapFreeRatio=10" --java-options "-XX:MaxHeapFreeRatio=30" \
    --java-options "-XX:G1PeriodicGCInterval=15000" \
    --vendor "Open Suite" --description "Open Suite" \
    --dest "$OUT"
APP="$OUT/OpenSuite"
[ -f "$APP/OpenSuite.exe" ] || { echo "jpackage did not produce OpenSuite.exe" >&2; exit 1; }

echo ">> adding the browser"
# Open Suite looks for browser/ beside the folder its jar is in, OpenSuite/app.
mkdir -p "$APP/app/browser"
cp -a browser/chrome-win browser/chromedriver.exe "$APP/app/browser/"
# A test program in the snapshot, a third of its size, that nothing here runs.
rm -f "$APP/app/browser/chrome-win/interactive_ui_tests.exe"

echo ">> zip"
mkdir -p dist
rm -f dist/.opensuite-windows-x64.new.zip
# The JDK's own jar tool writes a plain zip (M: no manifest) and is always here.
( cd "$OUT" && jar cfM "$DIR/dist/.opensuite-windows-x64.new.zip" OpenSuite )
mv -f dist/.opensuite-windows-x64.new.zip dist/opensuite-windows-x64.zip

echo
echo "Built dist/opensuite-windows-x64.zip ($(du -h dist/opensuite-windows-x64.zip | cut -f1)), version $TS"
echo "Unpack it anywhere and run OpenSuite\\OpenSuite.exe. Windows asks once before"
echo "the first start: More info > Run anyway."