blockcheck: use defaults if BATCH=1

This commit is contained in:
bol-van 2025-01-03 14:40:02 +03:00
parent 5e84656707
commit 12a800db97
2 changed files with 57 additions and 37 deletions

View File

@ -23,7 +23,7 @@ CURL=${CURL:-curl}
. "$ZAPRET_BASE/common/fwtype.sh" . "$ZAPRET_BASE/common/fwtype.sh"
. "$ZAPRET_BASE/common/virt.sh" . "$ZAPRET_BASE/common/virt.sh"
DOMAINS_DEFAULT="rutracker.org" DOMAINS_DEFAULT=${DOMAINS_DEFAULT:-rutracker.org}
QNUM=${QNUM:-59780} QNUM=${QNUM:-59780}
SOCKS_PORT=${SOCKS_PORT:-1993} SOCKS_PORT=${SOCKS_PORT:-1993}
TPWS_UID=${TPWS_UID:-1} TPWS_UID=${TPWS_UID:-1}
@ -1733,18 +1733,22 @@ ask_params()
local dom local dom
[ -n "$DOMAINS" ] || { [ -n "$DOMAINS" ] || {
DOMAINS="$DOMAINS_DEFAULT" DOMAINS="$DOMAINS_DEFAULT"
echo "specify domain(s) to test. multiple domains are space separated." [ "$BATCH" = 1 ] || {
printf "domain(s) (default: $DOMAINS) : " echo "specify domain(s) to test. multiple domains are space separated."
read dom printf "domain(s) (default: $DOMAINS) : "
[ -n "$dom" ] && DOMAINS="$dom" read dom
[ -n "$dom" ] && DOMAINS="$dom"
}
} }
local IPVS_def=4 local IPVS_def=4
[ -n "$IPVS" ] || { [ -n "$IPVS" ] || {
# yandex public dns # yandex public dns
pingtest 6 2a02:6b8::feed:0ff && IPVS_def=46 pingtest 6 2a02:6b8::feed:0ff && IPVS_def=46
printf "ip protocol version(s) - 4, 6 or 46 for both (default: $IPVS_def) : " [ "$BATCH" = 1 ] || {
read IPVS printf "ip protocol version(s) - 4, 6 or 46 for both (default: $IPVS_def) : "
read IPVS
}
[ -n "$IPVS" ] || IPVS=$IPVS_def [ -n "$IPVS" ] || IPVS=$IPVS_def
[ "$IPVS" = 4 -o "$IPVS" = 6 -o "$IPVS" = 46 ] || { [ "$IPVS" = 4 -o "$IPVS" = 6 -o "$IPVS" = 46 ] || {
echo 'invalid ip version(s). should be 4, 6 or 46.' echo 'invalid ip version(s). should be 4, 6 or 46.'
@ -1757,48 +1761,60 @@ ask_params()
[ -n "$ENABLE_HTTP" ] || { [ -n "$ENABLE_HTTP" ] || {
ENABLE_HTTP=1 ENABLE_HTTP=1
echo [ "$BATCH" = 1 ] || {
ask_yes_no_var ENABLE_HTTP "check http" echo
ask_yes_no_var ENABLE_HTTP "check http"
}
} }
[ -n "$ENABLE_HTTPS_TLS12" ] || { [ -n "$ENABLE_HTTPS_TLS12" ] || {
ENABLE_HTTPS_TLS12=1 ENABLE_HTTPS_TLS12=1
echo [ "$BATCH" = 1 ] || {
ask_yes_no_var ENABLE_HTTPS_TLS12 "check https tls 1.2" echo
ask_yes_no_var ENABLE_HTTPS_TLS12 "check https tls 1.2"
}
} }
[ -n "$ENABLE_HTTPS_TLS13" ] || { [ -n "$ENABLE_HTTPS_TLS13" ] || {
ENABLE_HTTPS_TLS13=0 ENABLE_HTTPS_TLS13=0
echo
if [ -n "$TLS13" ]; then if [ -n "$TLS13" ]; then
echo "TLS 1.3 uses encrypted ServerHello. DPI cannot check domain name in server response." [ "$BATCH" = 1 ] || {
echo "This can allow more bypass strategies to work." echo
echo "What works for TLS 1.2 will also work for TLS 1.3 but not vice versa." echo "TLS 1.3 uses encrypted ServerHello. DPI cannot check domain name in server response."
echo "Most sites nowadays support TLS 1.3 but not all. If you can't find a strategy for TLS 1.2 use this test." echo "This can allow more bypass strategies to work."
echo "TLS 1.3 only strategy is better than nothing." echo "What works for TLS 1.2 will also work for TLS 1.3 but not vice versa."
ask_yes_no_var ENABLE_HTTPS_TLS13 "check https tls 1.3" echo "Most sites nowadays support TLS 1.3 but not all. If you can't find a strategy for TLS 1.2 use this test."
echo "TLS 1.3 only strategy is better than nothing."
ask_yes_no_var ENABLE_HTTPS_TLS13 "check https tls 1.3"
}
else else
echo
echo "installed curl version does not support TLS 1.3 . tests disabled." echo "installed curl version does not support TLS 1.3 . tests disabled."
fi fi
} }
[ -n "$ENABLE_HTTP3" ] || { [ -n "$ENABLE_HTTP3" ] || {
ENABLE_HTTP3=0 ENABLE_HTTP3=0
echo
if [ -n "$HTTP3" ]; then if [ -n "$HTTP3" ]; then
echo "make sure target domain(s) support QUIC or result will be negative in any case"
ENABLE_HTTP3=1 ENABLE_HTTP3=1
ask_yes_no_var ENABLE_HTTP3 "check http3 QUIC" [ "$BATCH" = 1 ] || {
echo
echo "make sure target domain(s) support QUIC or result will be negative in any case"
ask_yes_no_var ENABLE_HTTP3 "check http3 QUIC"
}
else else
echo
echo "installed curl version does not support http3 QUIC. tests disabled." echo "installed curl version does not support http3 QUIC. tests disabled."
fi fi
} }
[ -n "$REPEATS" ] || { [ -n "$REPEATS" ] || {
echo [ "$BATCH" = 1 ] || {
echo "sometimes ISPs use multiple DPIs or load balancing. bypass strategies may work unstable." echo
printf "how many times to repeat each test (default: 1) : " echo "sometimes ISPs use multiple DPIs or load balancing. bypass strategies may work unstable."
read REPEATS printf "how many times to repeat each test (default: 1) : "
read REPEATS
}
REPEATS=$((0+${REPEATS:-1})) REPEATS=$((0+${REPEATS:-1}))
[ "$REPEATS" = 0 ] && { [ "$REPEATS" = 0 ] && {
echo invalid repeat count echo invalid repeat count
@ -1806,22 +1822,26 @@ ask_params()
} }
} }
[ -z "$PARALLEL" -a $REPEATS -gt 1 ] && { [ -z "$PARALLEL" -a $REPEATS -gt 1 ] && {
echo
echo "parallel scan can greatly increase speed but may also trigger DDoS protection and cause false result"
PARALLEL=0 PARALLEL=0
ask_yes_no_var PARALLEL "enable parallel scan" [ "$BATCH" = 1 ] || {
echo
echo "parallel scan can greatly increase speed but may also trigger DDoS protection and cause false result"
ask_yes_no_var PARALLEL "enable parallel scan"
}
} }
PARALLEL=${PARALLEL:-0} PARALLEL=${PARALLEL:-0}
[ -n "$SCANLEVEL" ] || { [ -n "$SCANLEVEL" ] || {
echo SCANLEVEL=standard
echo quick - scan as fast as possible to reveal any working strategy [ "$BATCH" = 1 ] || {
echo standard - do investigation what works on your DPI echo
echo force - scan maximum despite of result echo quick - scan as fast as possible to reveal any working strategy
SCANLEVEL=${SCANLEVEL:-standard} echo standard - do investigation what works on your DPI
ask_list SCANLEVEL "quick standard force" "$SCANLEVEL" echo force - scan maximum despite of result
# disable tpws checks by default in quick mode ask_list SCANLEVEL "quick standard force" "$SCANLEVEL"
[ "$SCANLEVEL" = quick -a -z "$SKIP_TPWS" -a "$UNAME" != Darwin ] && SKIP_TPWS=1 # disable tpws checks by default in quick mode
[ "$SCANLEVEL" = quick -a -z "$SKIP_TPWS" -a "$UNAME" != Darwin ] && SKIP_TPWS=1
}
} }
echo echo

View File

@ -1438,7 +1438,7 @@ ENABLE_HTTP3=0|1 - включить тест QUIC
REPEATS - количество попыток тестирования REPEATS - количество попыток тестирования
PARALLEL=0|1 - включить параллельные попытки. может обидеть сайт из-за долбежки и привести к неверному результату PARALLEL=0|1 - включить параллельные попытки. может обидеть сайт из-за долбежки и привести к неверному результату
SCANLEVEL=quick|standard|force - уровень сканирования SCANLEVEL=quick|standard|force - уровень сканирования
BATCH=1 - отключить "press enter to continue" BATCH=1 - пакетный режим без вопросов и ожидания ввода в консоли
HTTP_PORT, HTTPS_PORT, QUIC_PORT - номера портов для соответствующих протоколов HTTP_PORT, HTTPS_PORT, QUIC_PORT - номера портов для соответствующих протоколов
SKIP_DNSCHECK=1 - отказ от проверки DNS SKIP_DNSCHECK=1 - отказ от проверки DNS
SKIP_TPWS=1 - отказ от тестов tpws SKIP_TPWS=1 - отказ от тестов tpws