- hostlistRules (zapret-discord-youtube): a group of sites with its own strategy, as upstream's patch-zapret-config.py makes them: the preset's profiles for the rule's family (or another preset's, with configName; Discord's voice profile with it), pointed at the rule's own list with the standard excludes, or the rule's nfqwsArgs; ahead of the preset's own. WinDivert's filter takes the ports they add. Rules with enableDirectSync join the direct list. Names of zapret's own lists, and the instagram/soundcloud/twitter families (not in Flowseal's Windows release), are refused. Every preset with sample rules checked by winws.exe --dry-run (tools/winws-dry-run.sh); one without the profile a rule copies is refused, as upstream refuses it. - The SSH tunnel (sshProxy): Windows' own OpenSSH (System32) as ssh -N -D, with upstream's options and only the configured key offered (IdentitiesOnly: an agent's keys used up the server's tries); the key copied below the protected state root, as Windows' OpenSSH wants it and sing-box's SSH outbound reads it; the server's keys from hostKey, hostKeyFile or knownHostsFile. End to end on Linux against an sshd of the test's own: a page through each, two logins with the copied key. - The dev shell has OpenSSH, for that test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
63 lines
3.3 KiB
Bash
Executable File
63 lines
3.3 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"
|
|
|
|
# The same presets with hostlistRules (tools/zapret-rules-sample.json): their profiles ahead.
|
|
r=0 na=0
|
|
while IFS= read -r preset; do
|
|
built=$(target/debug/examples/zapret_args "$REL" "$(win "$REL")" "$(win "$WORK/lists")" "$preset" null tools/zapret-rules-sample.json "$WORK/lists" 2>&1) || {
|
|
# A preset without a profile a rule's family needs: refused, as upstream refuses it.
|
|
if grep -q "the preset has no .* profile to copy" <<<"$built"; then na=$((na + 1)); echo " $preset: $built"; continue; fi
|
|
fail=$((fail + 1)); echo "FAIL: $preset with rules: $built"; continue
|
|
}
|
|
mapfile -t args <<<"$built"
|
|
r=$((r + 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 with rules"; grep -v Cygwin <<<"$out" | tail -4
|
|
fi
|
|
done < <(ls "$REL"/*.bat | xargs -n1 -d '\n' basename | grep -vi '^service' | sed 's/\.bat$//')
|
|
echo "$r presets with hostlist rules verified by winws.exe; $na refused, lacking a profile a rule copies"
|
|
|
|
# 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 ]
|