#!/usr/bin/env bash # Extract the unmodified WinPcap 3.1 installer from the official Wireshark archive. set -euo pipefail cd "$(dirname "$0")/.." cache=${MARS_TOOLCHAIN_DIR:-$PWD/.toolchains}/legacy mkdir -p "$cache" url=https://www.wireshark.org/download/win32/all-versions/wireshark-setup-0.99.4.exe bundle=wireshark-setup-0.99.4.exe bundle_sha=c9afd4c81103b62ad95cbe12a30f81f18b847f95136267ca9af3b87c12abd50f installer_sha=cc3840c1b87fb73ce0f5612403d1fc0bbf192bde8639c81388133d80db59000d # SHA256 pins measured from the official HTTPS download on 2026-11-27; # reproducibility checks, not independently published vendor signatures. verify(){ printf '%s %s\n' "$1" "$2" | sha256sum -c -; } if [[ ! -f $cache/WinPcap_3_1.exe ]]; then if [[ ! -f $cache/$bundle ]]; then [[ ${MARS_OFFLINE:-0} != 1 ]] || { echo 'WinPcap missing: run cross/fetch-winpcap.sh online first' >&2; exit 1; } tmp=$(mktemp "$cache/.winpcap.XXXXXX"); trap 'rm -f "$tmp"' EXIT curl --fail --location --show-error --retry 2 --connect-timeout 15 --max-time 300 --proto '=https' --proto-redir '=https' "$url" -o "$tmp" verify "$bundle_sha" "$tmp" mv "$tmp" "$cache/$bundle"; trap - EXIT fi verify "$bundle_sha" "$cache/$bundle" 7z e -y "-o$cache" "$cache/$bundle" WinPcap_3_1.exe >/dev/null fi verify "$installer_sha" "$cache/WinPcap_3_1.exe" printf 'source=%s\nbundle_sha256=%s\ninstaller_sha256=%s\nVerification=locally measured pins from official HTTPS archive; not vendor signature\n' "$url" "$bundle_sha" "$installer_sha" > "$cache/WinPcap_3_1.exe.origin"