Add go-winres integration to embed legitimate PE resource metadata (company name, product name, version, file description, copyright, and application manifest) into Windows binaries. AV heuristic engines check for PE metadata as a trust signal -- its absence is one of the triggers for Go binary false positives like Kaspersky PDM:Trojan.Win32.Generic detection. - Add cmd/bd/winres/ with PE version info config and app manifest - Add scripts/gen-winres.sh to generate .syso resource files - Update .goreleaser.yml before hooks to run gen-winres at build time - Update release.yml CI to install go-winres - Update version bump script to include winres metadata - Update ANTIVIRUS.md documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.4 KiB
Bash
Executable file
44 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# gen-winres.sh - Generate Windows PE resource files (.syso) for bd.exe
|
|
#
|
|
# Embeds version info, application manifest, and metadata into Windows binaries.
|
|
# This helps reduce antivirus false positives by making the binary look like
|
|
# professionally packaged software (legitimate PE metadata).
|
|
#
|
|
# Usage:
|
|
# ./scripts/gen-winres.sh # Use version from version.go
|
|
# ./scripts/gen-winres.sh 0.49.4 # Explicit version
|
|
#
|
|
# Requires: go-winres (go install github.com/tc-hib/go-winres@latest)
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
WINRES_DIR="$REPO_ROOT/cmd/bd/winres"
|
|
OUT_PREFIX="$REPO_ROOT/cmd/bd/rsrc"
|
|
|
|
# Determine version
|
|
if [[ $# -ge 1 ]]; then
|
|
VERSION="$1"
|
|
else
|
|
VERSION=$(grep 'Version = ' "$REPO_ROOT/cmd/bd/version.go" | sed 's/.*"\(.*\)".*/\1/')
|
|
fi
|
|
|
|
echo "[winres] Generating Windows PE resources for bd v${VERSION}"
|
|
|
|
# Check for go-winres
|
|
if ! command -v go-winres &> /dev/null; then
|
|
echo "[winres] Installing go-winres..."
|
|
go install github.com/tc-hib/go-winres@latest
|
|
fi
|
|
|
|
# Generate .syso files
|
|
go-winres make \
|
|
--in "$WINRES_DIR/winres.json" \
|
|
--out "$OUT_PREFIX" \
|
|
--product-version "$VERSION" \
|
|
--file-version "$VERSION"
|
|
|
|
echo "[winres] Generated:"
|
|
ls -la "$REPO_ROOT"/cmd/bd/rsrc_windows_*.syso 2>/dev/null || echo "[winres] (no .syso files found - check go-winres output)"
|