mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-24 07:06:36 +00:00
blockcheck: optimize code
This commit is contained in:
parent
b10a0a6d88
commit
5176ba1933
@ -404,6 +404,36 @@ pktws_curl_test()
|
|||||||
echo - checking $PKTWSD $3 $4 $5 $6 $7 $8 $9
|
echo - checking $PKTWSD $3 $4 $5 $6 $7 $8 $9
|
||||||
ws_curl_test pktws_start "$@"
|
ws_curl_test pktws_start "$@"
|
||||||
}
|
}
|
||||||
|
xxxws_curl_test_update()
|
||||||
|
{
|
||||||
|
# $1 - xxx_curl_test function
|
||||||
|
# $2 - test function
|
||||||
|
# $3 - domain
|
||||||
|
# $4,$5,$6, ... - nfqws/dvtws params
|
||||||
|
local code xxxf=$1 testf=$2 dom=$3
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
$xxxf $testf $dom "$@"
|
||||||
|
code=$?
|
||||||
|
[ $code = 0 ] && strategy="${strategy:-$@}"
|
||||||
|
return $code
|
||||||
|
}
|
||||||
|
pktws_curl_test_update()
|
||||||
|
{
|
||||||
|
# $1 - test function
|
||||||
|
# $2 - domain
|
||||||
|
# $3,$4,$5, ... - nfqws/dvtws params
|
||||||
|
xxxws_curl_test_update pktws_curl_test "$@"
|
||||||
|
}
|
||||||
|
tpws_curl_test_update()
|
||||||
|
{
|
||||||
|
# $1 - test function
|
||||||
|
# $2 - domain
|
||||||
|
# $3,$4,$5, ... - nfqws/dvtws params
|
||||||
|
xxxws_curl_test_update tpws_curl_test "$@"
|
||||||
|
}
|
||||||
|
|
||||||
pktws_check_domain_bypass()
|
pktws_check_domain_bypass()
|
||||||
{
|
{
|
||||||
# $1 - test function
|
# $1 - test function
|
||||||
@ -414,61 +444,42 @@ pktws_check_domain_bypass()
|
|||||||
|
|
||||||
[ "$sec" = 0 ] && {
|
[ "$sec" = 0 ] && {
|
||||||
for s in '--hostcase' '--hostspell=hoSt' '--hostnospace' '--domcase'; do
|
for s in '--hostcase' '--hostspell=hoSt' '--hostnospace' '--domcase'; do
|
||||||
pktws_curl_test $1 $3 $s && strategy="${strategy:-$s}"
|
pktws_curl_test_update $1 $3 $s
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
s="--dpi-desync=split2"
|
s="--dpi-desync=split2"
|
||||||
if pktws_curl_test $1 $3 $s; then
|
pktws_curl_test_update $1 $3 $s || {
|
||||||
strategy="${strategy:-$s}"
|
|
||||||
else
|
|
||||||
tests="$tests split fake,split2 fake,split"
|
tests="$tests split fake,split2 fake,split"
|
||||||
[ "$sec" = 0 ] && {
|
[ "$sec" = 0 ] && pktws_curl_test_update $1 $3 $s --hostcase
|
||||||
s="$s --hostcase"
|
|
||||||
pktws_curl_test $1 $3 $s && strategy="${strategy:-$s}"
|
|
||||||
}
|
|
||||||
for pos in 1 3 4 5 10 50 100; do
|
for pos in 1 3 4 5 10 50 100; do
|
||||||
s="--dpi-desync=split2 --dpi-desync-split-pos=$pos"
|
s="--dpi-desync=split2 --dpi-desync-split-pos=$pos"
|
||||||
if pktws_curl_test $1 $3 $s; then
|
if pktws_curl_test_update $1 $3 $s; then
|
||||||
strategy="${strategy:-$s}"
|
|
||||||
break
|
break
|
||||||
elif [ "$sec" = 0 ]; then
|
elif [ "$sec" = 0 ]; then
|
||||||
s="$s --hostcase"
|
pktws_curl_test_update $1 $3 $s --hostcase
|
||||||
pktws_curl_test $1 $3 $s && strategy="${strategy:-$s}"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
}
|
||||||
|
|
||||||
s="--dpi-desync=disorder2"
|
pktws_curl_test_update $1 $3 --dpi-desync=disorder2 || tests="$tests disorder fake,disorder2 fake,disorder"
|
||||||
if pktws_curl_test $1 $3 $s; then
|
|
||||||
strategy="${strategy:-$s}"
|
|
||||||
else
|
|
||||||
tests="$tests disorder fake,disorder2 fake,disorder"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
|
ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
|
||||||
for e in '' '--wssize 1:6'; do
|
for e in '' '--wssize 1:6'; do
|
||||||
[ -n "$e" ] && {
|
[ -n "$e" ] && {
|
||||||
pktws_curl_test $1 $3 $e && strategy="${strategy:-$e}"
|
pktws_curl_test_update $1 $3 $e
|
||||||
for desync in split2 disorder2; do
|
for desync in split2 disorder2; do
|
||||||
s="--dpi-desync=$desync $e"
|
pktws_curl_test_update $1 $3 --dpi-desync=$desync $e
|
||||||
pktws_curl_test $1 $3 $s && strategy="${strategy:-$s}"
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
for desync in $tests; do
|
for desync in $tests; do
|
||||||
|
s="--dpi-desync=$desync"
|
||||||
for ttl in $ttls; do
|
for ttl in $ttls; do
|
||||||
s="--dpi-desync=$desync --dpi-desync-ttl=$ttl $e"
|
pktws_curl_test_update $1 $3 $s --dpi-desync-ttl=$ttl $e && break
|
||||||
pktws_curl_test $1 $3 $s && {
|
|
||||||
strategy="${strategy:-$s}"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
done
|
done
|
||||||
for fooling in badsum badseq md5sig; do
|
for fooling in badsum badseq md5sig; do
|
||||||
s="--dpi-desync=$desync --dpi-desync-fooling=$fooling $e"
|
pktws_curl_test_update $1 $3 $s --dpi-desync-fooling=$fooling $e && [ "$fooling" = "md5sig" ] &&
|
||||||
if pktws_curl_test $1 $3 $s ; then
|
echo 'WARNING ! although md5sig fooling worked it will not work on all sites. it typically works only on linux servers.'
|
||||||
strategy="${strategy:-$s}"
|
|
||||||
[ "$fooling" = "md5sig" ] && echo 'WARNING ! although md5sig fooling worked it will not work on all sites. it typically works only on linux servers.'
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
# do not do wssize test for http. it's useless
|
# do not do wssize test for http. it's useless
|
||||||
@ -494,15 +505,12 @@ tpws_check_domain_bypass()
|
|||||||
for s in '--hostcase' '--hostspell=hoSt' '--split-http-req=method' '--split-http-req=method --hostcase' '--split-http-req=host' '--split-http-req=host --hostcase' \
|
for s in '--hostcase' '--hostspell=hoSt' '--split-http-req=method' '--split-http-req=method --hostcase' '--split-http-req=host' '--split-http-req=host --hostcase' \
|
||||||
'--hostdot' '--hosttab' '--hostnospace' '--methodspace' '--methodeol' '--unixeol' \
|
'--hostdot' '--hosttab' '--hostnospace' '--methodspace' '--methodeol' '--unixeol' \
|
||||||
'--hostpad=1024' '--hostpad=2048' '--hostpad=4096' '--hostpad=8192' '--hostpad=16384'; do
|
'--hostpad=1024' '--hostpad=2048' '--hostpad=4096' '--hostpad=8192' '--hostpad=16384'; do
|
||||||
tpws_curl_test $1 $3 $s && strategy="${strategy:-$s}"
|
tpws_curl_test_update $1 $3 $s
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
for pos in 1 2 3 4 5 10 50 100; do
|
for pos in 1 2 3 4 5 10 50 100; do
|
||||||
s="--split-pos=$pos"
|
s="--split-pos=$pos"
|
||||||
tpws_curl_test $1 $3 $s && {
|
tpws_curl_test_update $1 $3 $s && break
|
||||||
strategy="${strategy:-$s}"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
Loading…
Reference in New Issue
Block a user