From 4733e1a15ecafcbd7ff05637c497d66d2ea9b096 Mon Sep 17 00:00:00 2001 From: bol-van Date: Wed, 2 Oct 2024 11:17:38 +0300 Subject: [PATCH 1/4] blockcheck: TPWS_EXTRA_1..9 PKTWS_EXTRA_1..9 --- blockcheck.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blockcheck.sh b/blockcheck.sh index ad47fd8..8a55dcf 100755 --- a/blockcheck.sh +++ b/blockcheck.sh @@ -885,17 +885,17 @@ tpws_curl_test() # $1 - test function # $2 - domain # $3,$4,$5, ... - tpws params - echo - checking tpws $3 $4 $5 $6 $7 $8 $9 $TPWS_EXTRA + echo - checking tpws $3 $4 $5 $6 $7 $8 $9 $TPWS_EXTRA "$TPWS_EXTRA_1" "$TPWS_EXTRA_2" "$TPWS_EXTRA_3" "$TPWS_EXTRA_4" "$TPWS_EXTRA_5" "$TPWS_EXTRA_6" "$TPWS_EXTRA_7" "$TPWS_EXTRA_8" "$TPWS_EXTRA_9" local ALL_PROXY="socks5://127.0.0.1:$SOCKS_PORT" - ws_curl_test tpws_start "$@" $TPWS_EXTRA + ws_curl_test tpws_start "$@" $TPWS_EXTRA "$TPWS_EXTRA_1" "$TPWS_EXTRA_2" "$TPWS_EXTRA_3" "$TPWS_EXTRA_4" "$TPWS_EXTRA_5" "$TPWS_EXTRA_6" "$TPWS_EXTRA_7" "$TPWS_EXTRA_8" "$TPWS_EXTRA_9" } pktws_curl_test() { # $1 - test function # $2 - domain # $3,$4,$5, ... - nfqws/dvtws params - echo - checking $PKTWSD ${WF:+$WF }$3 $4 $5 $6 $7 $8 $9 $PKTWS_EXTRA - ws_curl_test pktws_start "$@" $PKTWS_EXTRA + echo - checking $PKTWSD ${WF:+$WF }$3 $4 $5 $6 $7 $8 $9 $PKTWS_EXTRA "$PKTWS_EXTRA_1" "$PKTWS_EXTRA_2" "$PKTWS_EXTRA_3" "$PKTWS_EXTRA_4" "$PKTWS_EXTRA_5" "$PKTWS_EXTRA_6" "$PKTWS_EXTRA_7" "$PKTWS_EXTRA_8" "$PKTWS_EXTRA_9" + ws_curl_test pktws_start "$@" $PKTWS_EXTRA "$PKTWS_EXTRA_1" "$PKTWS_EXTRA_2" "$PKTWS_EXTRA_3" "$PKTWS_EXTRA_4" "$PKTWS_EXTRA_5" "$PKTWS_EXTRA_6" "$PKTWS_EXTRA_7" "$PKTWS_EXTRA_8" "$PKTWS_EXTRA_9" } xxxws_curl_test_update() { From 32158541b1d6c6e38b27a947fbee767f5883e3e4 Mon Sep 17 00:00:00 2001 From: bol-van Date: Wed, 2 Oct 2024 12:38:38 +0300 Subject: [PATCH 2/4] blockcheck: warn if zapret processes already running --- blockcheck.sh | 21 +++++++++++++++++++++ common/base.sh | 16 ++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/blockcheck.sh b/blockcheck.sh index 8a55dcf..0fe1736 100755 --- a/blockcheck.sh +++ b/blockcheck.sh @@ -348,6 +348,26 @@ check_system() echo firewall type is $FWTYPE } +zp_already_running() +{ + case "$UNAME" in + CYGWIN) + win_process_exists $PKTWSD + ;; + *) + process_exists $PKTWSD || process_exists tpws + esac +} +check_already() +{ + echo \* checking already running zapret processes + if zp_already_running; then + echo "!!! WARNING. some zapret processes already running !!!" + echo "!!! WARNING. blockcheck requires all DPI bypass methods disabled !!!" + echo "!!! WARNING. pls stop all zapret instances that may interfere with blockcheck !!!" + fi +} + freebsd_module_loaded() { # $1 - module name @@ -1796,6 +1816,7 @@ sigsilent() fsleep_setup fix_sbin_path check_system +check_already [ "$UNAME" = CYGWIN ] || require_root check_prerequisites trap sigint_cleanup INT diff --git a/common/base.sh b/common/base.sh index cdfc7d9..7c772ef 100644 --- a/common/base.sh +++ b/common/base.sh @@ -313,6 +313,22 @@ shell_name() } } +process_exists() +{ + if exists pgrep; then + pgrep ^$1$ >/dev/null + elif exists pidof; then + pidof $1 >/dev/null + else + return 1 + fi +} + +win_process_exists() +{ + tasklist /NH /FI "IMAGENAME eq ${1}.exe" | grep -q "^${1}.exe" +} + std_ports() { HTTP_PORTS=${HTTP_PORTS:-80} From 9d797f3dbc73cf643d2afd1d93c9ba3b2333d464 Mon Sep 17 00:00:00 2001 From: bol-van Date: Wed, 2 Oct 2024 13:26:18 +0300 Subject: [PATCH 3/4] blockcheck: detect goodbyedpi --- blockcheck.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blockcheck.sh b/blockcheck.sh index 0fe1736..39d84c3 100755 --- a/blockcheck.sh +++ b/blockcheck.sh @@ -352,7 +352,7 @@ zp_already_running() { case "$UNAME" in CYGWIN) - win_process_exists $PKTWSD + win_process_exists $PKTWSD || win_process_exists goodbyedpi ;; *) process_exists $PKTWSD || process_exists tpws @@ -362,9 +362,9 @@ check_already() { echo \* checking already running zapret processes if zp_already_running; then - echo "!!! WARNING. some zapret processes already running !!!" + echo "!!! WARNING. some dpi bypass processes already running !!!" echo "!!! WARNING. blockcheck requires all DPI bypass methods disabled !!!" - echo "!!! WARNING. pls stop all zapret instances that may interfere with blockcheck !!!" + echo "!!! WARNING. pls stop all dpi bypass instances that may interfere with blockcheck !!!" fi } From 88a9f16b8ad997b8f9c6a05c16e13e343fa37dff Mon Sep 17 00:00:00 2001 From: bol-van Date: Thu, 3 Oct 2024 08:39:48 +0300 Subject: [PATCH 4/4] openwrt init.d: remove command not found error --- init.d/openwrt/zapret | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.d/openwrt/zapret b/init.d/openwrt/zapret index 208dc67..46cd10b 100755 --- a/init.d/openwrt/zapret +++ b/init.d/openwrt/zapret @@ -185,7 +185,8 @@ start_daemons() } stop_daemons() { - procd_kill "$(basename ${basescript:-$initscript})" "$1" + local svc="$(basename ${basescript:-$initscript})" + procd_running "$svc" "$1" && procd_kill "$svc" "$1" } restart_daemons() {