blockcheck: warn if zapret processes already running

This commit is contained in:
bol-van 2024-10-02 12:38:38 +03:00
parent 4733e1a15e
commit 32158541b1
2 changed files with 37 additions and 0 deletions

View File

@ -348,6 +348,26 @@ check_system()
echo firewall type is $FWTYPE 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() freebsd_module_loaded()
{ {
# $1 - module name # $1 - module name
@ -1796,6 +1816,7 @@ sigsilent()
fsleep_setup fsleep_setup
fix_sbin_path fix_sbin_path
check_system check_system
check_already
[ "$UNAME" = CYGWIN ] || require_root [ "$UNAME" = CYGWIN ] || require_root
check_prerequisites check_prerequisites
trap sigint_cleanup INT trap sigint_cleanup INT

View File

@ -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() std_ports()
{ {
HTTP_PORTS=${HTTP_PORTS:-80} HTTP_PORTS=${HTTP_PORTS:-80}