Compare commits

...

3 Commits

Author SHA1 Message Date
bol-van
ee44aebcc4 nfqws,tpws: remove @config from android 2024-11-16 15:19:36 +03:00
bol-van
667d32a3e7 blockcheck: summary report all working strategies, tpws limit mss check 2024-11-16 13:19:37 +03:00
bol-van
9a087fc6c9 nfqws: allow seqovl=0 to disable seqovl 2024-11-16 09:46:08 +03:00
6 changed files with 59 additions and 21 deletions

View File

@ -1011,6 +1011,15 @@ tpws_curl_test()
echo - checking tpws $3 $4 $5 $6 $7 $8 $9${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"} echo - checking tpws $3 $4 $5 $6 $7 $8 $9${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"}
local ALL_PROXY="socks5://127.0.0.1:$SOCKS_PORT" local ALL_PROXY="socks5://127.0.0.1:$SOCKS_PORT"
ws_curl_test tpws_start "$@"${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"} ws_curl_test tpws_start "$@"${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"}
local code=$?
[ "$code" = 0 ] && {
local testf=$1 dom=$2
shift; shift;
local strategy="$@"
strategy_append_extra_tpws
report_append "ipv${IPV} $dom $testf : tpws ${WF:+$WF }$strategy"
}
return $code
} }
pktws_curl_test() pktws_curl_test()
{ {
@ -1019,7 +1028,26 @@ pktws_curl_test()
# $3,$4,$5, ... - nfqws/dvtws params # $3,$4,$5, ... - nfqws/dvtws params
echo - checking $PKTWSD ${WF:+$WF }$3 $4 $5 $6 $7 $8 $9${PKTWS_EXTRA:+ $PKTWS_EXTRA}${PKTWS_EXTRA_1:+ "$PKTWS_EXTRA_1"}${PKTWS_EXTRA_2:+ "$PKTWS_EXTRA_2"}${PKTWS_EXTRA_3:+ "$PKTWS_EXTRA_3"}${PKTWS_EXTRA_4:+ "$PKTWS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S_EXTRA_3:+ "$PKTWS_EXTRA_3"}${PKTWS_EXTRA_4:+ "$PKTWS_EXTRA_4"}${PKTWS_EXTRA_5:+ "$PKTWS_EXTRA_5"}${PKTWS_EXTRA_6:+ "$PKTWS_EXTRA_6"}${PKTWS_EXTRA_7:+ "$PKTWS_EXTRA_7"}${PKTWS_EXTRA_8:+ "$PKTWS_EXTRA_8"}${PKTWS_EXTRA_9:+ "$PKTWS_EXTRA_9"}
local code=$?
[ "$code" = 0 ] && {
local testf=$1 dom=$2
shift; shift;
local strategy="$@"
strategy_append_extra_pktws
report_append "ipv${IPV} $dom $testf : $PKTWSD ${WF:+$WF }$strategy"
} }
return $code
}
strategy_append_extra_pktws()
{
strategy="${strategy:+$strategy${PKTWS_EXTRA:+ $PKTWS_EXTRA}${PKTWS_EXTRA_1:+ "$PKTWS_EXTRA_1"}${PKTWS_EXTRA_2:+ "$PKTWS_EXTRA_2"}${PKTWS_EXTRA_3:+ "$PKTWS_EXTRA_3"}${PKTWS_EXTRA_4:+ "$PKTWS_EXTRA_4"}${PKTWS_EXTRA_5:+ "$PKTWS_EXTRA_5"}${PKTWS_EXTRA_6:+ "$PKTWS_EXTRA_6"}${PKTWS_EXTRA_7:+ "$PKTWS_EXTRA_7"}${PKTWS_EXTRA_8:+ "$PKTWS_EXTRA_8"}${PKTWS_EXTRA_9:+ "$PKTWS_EXTRA_9"}}"
}
strategy_append_extra_tpws()
{
strategy="${strategy:+$strategy${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"}}"
}
xxxws_curl_test_update() xxxws_curl_test_update()
{ {
# $1 - xxx_curl_test function # $1 - xxx_curl_test function
@ -1071,7 +1099,7 @@ report_strategy()
strategy="$(echo "$strategy" | xargs)" strategy="$(echo "$strategy" | xargs)"
echo "!!!!! $1: working strategy found for ipv${IPV} $2 : $3 $strategy !!!!!" echo "!!!!! $1: working strategy found for ipv${IPV} $2 : $3 $strategy !!!!!"
echo echo
report_append "ipv${IPV} $2 $1 : $3 ${WF:+$WF }$strategy" # report_append "ipv${IPV} $2 $1 : $3 ${WF:+$WF }$strategy"
return 0 return 0
else else
echo "$1: $3 strategy for ipv${IPV} $2 not found" echo "$1: $3 strategy for ipv${IPV} $2 not found"
@ -1314,7 +1342,7 @@ pktws_check_domain_http_bypass()
local strategy local strategy
pktws_check_domain_http_bypass_ "$@" pktws_check_domain_http_bypass_ "$@"
strategy="${strategy:+$strategy${PKTWS_EXTRA:+ $PKTWS_EXTRA}${PKTWS_EXTRA_1:+ "$PKTWS_EXTRA_1"}${PKTWS_EXTRA_2:+ "$PKTWS_EXTRA_2"}${PKTWS_EXTRA_3:+ "$PKTWS_EXTRA_3"}${PKTWS_EXTRA_4:+ "$PKTWS_EXTRA_4"}${PKTWS_EXTRA_5:+ "$PKTWS_EXTRA_5"}${PKTWS_EXTRA_6:+ "$PKTWS_EXTRA_6"}${PKTWS_EXTRA_7:+ "$PKTWS_EXTRA_7"}${PKTWS_EXTRA_8:+ "$PKTWS_EXTRA_8"}${PKTWS_EXTRA_9:+ "$PKTWS_EXTRA_9"}}" strategy_append_extra_pktws
report_strategy $1 $3 $PKTWSD report_strategy $1 $3 $PKTWSD
} }
@ -1359,7 +1387,7 @@ pktws_check_domain_http3_bypass()
local strategy local strategy
pktws_check_domain_http3_bypass_ "$@" pktws_check_domain_http3_bypass_ "$@"
strategy="${strategy:+$strategy $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}" strategy_append_extra_pktws
report_strategy $1 $2 $PKTWSD report_strategy $1 $2 $PKTWSD
} }
warn_mss() warn_mss()
@ -1402,12 +1430,14 @@ tpws_check_domain_http_bypass_()
tpws_curl_test_update $1 $3 $s && [ "$SCANLEVEL" = quick ] && return tpws_curl_test_update $1 $3 $s && [ "$SCANLEVEL" = quick ] && return
done done
else else
local need_mss=1
for mss in '' 88; do for mss in '' 88; do
s3=${mss:+--mss=$mss} s3=${mss:+--mss=$mss}
for s2 in '' '--oob' '--disorder' ${oobdis:+"$oobdis"}; do for s2 in '' '--oob' '--disorder' ${oobdis:+"$oobdis"}; do
for pos in $splits_tls; do for pos in $splits_tls; do
tpws_curl_test_update $1 $3 --split-pos=$pos $s2 $s3 && warn_mss $s3 && [ "$SCANLEVEL" != force ] && { tpws_curl_test_update $1 $3 --split-pos=$pos $s2 $s3 && warn_mss $s3 && [ "$SCANLEVEL" != force ] && {
[ "$SCANLEVEL" = quick ] && return [ "$SCANLEVEL" = quick ] && return
need_mss=0
break break
} }
done done
@ -1416,12 +1446,14 @@ tpws_check_domain_http_bypass_()
for s2 in '--tlsrec=midsld' '--tlsrec=sniext+1 --split-pos=midsld' '--tlsrec=sniext+4 --split-pos=midsld' '--tlsrec=sniext+1 --split-pos=1,midsld' '--tlsrec=sniext+4 --split-pos=1,midsld' ; do for s2 in '--tlsrec=midsld' '--tlsrec=sniext+1 --split-pos=midsld' '--tlsrec=sniext+4 --split-pos=midsld' '--tlsrec=sniext+1 --split-pos=1,midsld' '--tlsrec=sniext+4 --split-pos=1,midsld' ; do
tpws_curl_test_update $1 $3 $s2 $s $s3 && warn_mss $s3 && [ "$SCANLEVEL" != force ] && { tpws_curl_test_update $1 $3 $s2 $s $s3 && warn_mss $s3 && [ "$SCANLEVEL" != force ] && {
[ "$SCANLEVEL" = quick ] && return [ "$SCANLEVEL" = quick ] && return
need_mss=0
break break
} }
done done
done done
# only linux supports mss # only linux supports mss
[ "$UNAME" = Linux -a "$sec" = 1 ] || break [ "$UNAME" = Linux -a "$sec" = 1 ] || break
[ "$SCANLEVEL" = force -o "$need_mss" = 1 ] || break
done done
fi fi
} }
@ -1433,7 +1465,7 @@ tpws_check_domain_http_bypass()
local strategy local strategy
tpws_check_domain_http_bypass_ "$@" tpws_check_domain_http_bypass_ "$@"
strategy="${strategy:+$strategy${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"}}" strategy_append_extra_tpws
report_strategy $1 $3 tpws report_strategy $1 $3 tpws
} }

BIN
nfq/dvtws Normal file

Binary file not shown.

View File

@ -552,7 +552,7 @@ static bool parse_ws_scale_factor(char *s, uint16_t *wsize, uint8_t *wscale)
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
static void cleanup_args() static void cleanup_args()
{ {
wordfree(&params.wexp); wordfree(&params.wexp);
@ -561,7 +561,7 @@ static void cleanup_args()
static void cleanup_params(void) static void cleanup_params(void)
{ {
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
cleanup_args(); cleanup_args();
#endif #endif
@ -985,7 +985,7 @@ static unsigned int hash_jen(const void *data,unsigned int len)
static void exithelp(void) static void exithelp(void)
{ {
printf( printf(
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
" @<config_file>|$<config_file>\t\t\t; read file for options. must be the only argument. other options are ignored.\n\n" " @<config_file>|$<config_file>\t\t\t; read file for options. must be the only argument. other options are ignored.\n\n"
#endif #endif
" --debug=0|1|syslog|@<filename>\n" " --debug=0|1|syslog|@<filename>\n"
@ -1099,7 +1099,7 @@ static void exithelp_clean(void)
exithelp(); exithelp();
} }
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
// no static to not allow optimizer to inline this func (save stack) // no static to not allow optimizer to inline this func (save stack)
void config_from_file(const char *filename) void config_from_file(const char *filename)
{ {
@ -1192,7 +1192,7 @@ int main(int argc, char **argv)
} }
#endif #endif
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$')) if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$'))
{ {
config_from_file(argv[1]+1); config_from_file(argv[1]+1);
@ -1595,7 +1595,13 @@ int main(int argc, char **argv)
dp->split_count++; dp->split_count++;
break; break;
case 26: /* dpi-desync-split-seqovl */ case 26: /* dpi-desync-split-seqovl */
if (!parse_split_pos(optarg, &dp->seqovl)) if (!strcmp(optarg,"0"))
{
// allow zero = disable seqovl
dp->seqovl.marker=PM_ABS;
dp->seqovl.pos=0;
}
else if (!parse_split_pos(optarg, &dp->seqovl))
{ {
DLOG_ERR("Invalid argument for dpi-desync-split-seqovl\n"); DLOG_ERR("Invalid argument for dpi-desync-split-seqovl\n");
exit_clean(1); exit_clean(1);
@ -1957,7 +1963,7 @@ int main(int argc, char **argv)
} }
// do not need args from file anymore // do not need args from file anymore
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
cleanup_args(); cleanup_args();
#endif #endif
argv=NULL; argc=0; argv=NULL; argc=0;

View File

@ -14,7 +14,7 @@
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <sys/queue.h> #include <sys/queue.h>
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
#include <wordexp.h> #include <wordexp.h>
#endif #endif
@ -104,7 +104,7 @@ bool dp_list_have_autohostlist(struct desync_profile_list_head *head);
struct params_s struct params_s
{ {
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
wordexp_t wexp; // for file based config wordexp_t wexp; // for file based config
#endif #endif

View File

@ -6,7 +6,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <time.h> #include <time.h>
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
#include <wordexp.h> #include <wordexp.h>
#endif #endif
@ -85,7 +85,7 @@ void dp_list_destroy(struct desync_profile_list_head *head);
struct params_s struct params_s
{ {
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
wordexp_t wexp; // for file based config wordexp_t wexp; // for file based config
#endif #endif

View File

@ -122,7 +122,7 @@ static int get_default_ttl(void)
static void exithelp(void) static void exithelp(void)
{ {
printf( printf(
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
" @<config_file>|$<config_file>\t\t; read file for options. must be the only argument. other options are ignored.\n\n" " @<config_file>|$<config_file>\t\t; read file for options. must be the only argument. other options are ignored.\n\n"
#endif #endif
" --bind-addr=<v4_addr>|<v6_addr>\t; for v6 link locals append %%interface_name\n" " --bind-addr=<v4_addr>|<v6_addr>\t; for v6 link locals append %%interface_name\n"
@ -215,7 +215,7 @@ static void exithelp(void)
); );
exit(1); exit(1);
} }
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
static void cleanup_args() static void cleanup_args()
{ {
wordfree(&params.wexp); wordfree(&params.wexp);
@ -223,7 +223,7 @@ static void cleanup_args()
#endif #endif
static void cleanup_params(void) static void cleanup_params(void)
{ {
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
cleanup_args(); cleanup_args();
#endif #endif
@ -472,7 +472,7 @@ static bool parse_pf_list(char *opt, struct port_filters_head *pfl)
return true; return true;
} }
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
// no static to not allow optimizer to inline this func (save stack) // no static to not allow optimizer to inline this func (save stack)
void config_from_file(const char *filename) void config_from_file(const char *filename)
{ {
@ -547,7 +547,7 @@ void parse_params(int argc, char *argv[])
dp = &dpl->dp; dp = &dpl->dp;
dp->n = ++desync_profile_count; dp->n = ++desync_profile_count;
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$')) if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$'))
{ {
config_from_file(argv[1]+1); config_from_file(argv[1]+1);
@ -1288,7 +1288,7 @@ void parse_params(int argc, char *argv[])
SplitDebug(); SplitDebug();
VPRINT("\n"); VPRINT("\n");
#ifndef __OpenBSD__ #if !defined( __OpenBSD__) && !defined(__ANDROID__)
// do not need args from file anymore // do not need args from file anymore
cleanup_args(); cleanup_args();
#endif #endif