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}