Files
proxy-suite-flake/windows/tools/winws-dry-run.sh
T
faumarayandClaude Opus 5.5 bceb754e65 windows: zapret2 on winws2 with nfqws2-keenetic's strategies
ps-core::zapret2 reads nfqws2-keenetic's nfqws2.conf and patches it as
upstream's sources.nix does, expands the hostlist markers as zapret2's
list.sh does (autohostlist with its detector settings, the configured
domains), fills circular's unset detector settings from autoHostlist,
merges the extra ports into the profiles that tell traffic by protocol,
and gives winws2 WinDivert port filters in place of the queue's rules.
The service runs it with the learned list in a directory labelled Low
integrity, where winws2 can still write once it drops to Low. winws2
verifies the whole command line under Wine.

detect.lua, z2k and the cutoff probe are not there yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:04:21 +03:00

45 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Every preset of Flowseal's release, with the arguments and lists the service builds,
# checked by its own winws.exe (`--dry-run`) under Wine; then zapret2's command line, by
# winws2.exe.
#
# nix develop --command nix shell nixpkgs#wineWow64Packages.stable -c tools/winws-dry-run.sh STAGE_DIR
set -euo pipefail
cd "$(dirname "$0")/.."
STAGE=${1:?staged components directory}
REL="$STAGE/zapret"
WORK=$(mktemp -d)
export WINEPREFIX=${WINEPREFIX:-$WORK/prefix} WINEDEBUG=-all
trap 'wineserver -k 2>/dev/null || true; rm -rf "$WORK"' EXIT
cargo build -q -p ps-core --example zapret_args --example zapret2_args
win() { echo "Z:$(realpath "$1" | sed 's|/|\\|g')\\"; }
# The lists as the service writes them: the release's, and the user's placeholders.
mkdir -p "$WORK/lists" && cp "$REL"/lists/*.txt "$WORK/lists/"
echo domain.example.abc > "$WORK/lists/list-general-user.txt"
echo domain.example.abc > "$WORK/lists/list-exclude-user.txt"
echo 203.0.113.113/32 > "$WORK/lists/ipset-exclude-user.txt"
fail=0 n=0
while IFS= read -r preset; do
for game in null all; do
mapfile -t args < <(target/debug/examples/zapret_args "$REL" "$(win "$REL")" "$(win "$WORK/lists")" "$preset" "$game")
n=$((n + 1))
if out=$(cd "$REL/bin" && wine ./winws.exe --dry-run "${args[@]}" 2>&1) && grep -q "parameters verified" <<<"$out"; then
:
else
fail=$((fail + 1)); echo "FAIL: $preset ($game)"; grep -v Cygwin <<<"$out" | tail -4
fi
done
done < <(ls "$REL"/*.bat | xargs -n1 -d '\n' basename | grep -vi '^service' | sed 's/\.bat$//')
echo "$((n - fail))/$n preset runs verified by winws.exe"
# zapret2: nfqws2-keenetic's strategies as the service renders them, its lists in place.
Z2="$STAGE/zapret2"
mkdir -p "$WORK/z2/learned" && : > "$WORK/z2/zapret-hosts-user.txt" && : > "$WORK/z2/zapret-hosts-user-exclude.txt" && : > "$WORK/z2/learned/zapret-hosts-auto.txt"
mapfile -t args < <(target/debug/examples/zapret2_args "$Z2" "$(win "$Z2")" "$(win "$WORK/z2")")
if out=$(cd "$Z2" && wine ./winws2.exe --dry-run "${args[@]}" 2>&1) && grep -q "parameters verified" <<<"$out"; then
echo "zapret2: verified by winws2.exe"
else
fail=$((fail + 1)); echo "FAIL: zapret2"; grep -v -i cygwin <<<"$out" | tail -4
fi
[ "$fail" = 0 ]