mirror of
https://github.com/bol-van/zapret.git
synced 2025-05-24 22:32:58 +03:00
Compare commits
24 Commits
v69.3
...
06e364a2ef
Author | SHA1 | Date | |
---|---|---|---|
|
06e364a2ef | ||
|
8324c04a41 | ||
|
166847ba92 | ||
|
1904f01cf4 | ||
|
4ae1ad053d | ||
|
7d9946b007 | ||
|
86462f4cee | ||
|
669182c133 | ||
|
f81bb51f4a | ||
|
d4ff423add | ||
|
b14ff9b647 | ||
|
277c5f9e00 | ||
|
f016e5a4dc | ||
|
fc3912b4fe | ||
|
c01a764e1f | ||
|
92ba6b439e | ||
|
4ecb40e03b | ||
|
be9c300cb3 | ||
|
839c720f60 | ||
|
127bec2f14 | ||
|
15879c82f6 | ||
|
9d188840c1 | ||
|
35a28f4efe | ||
|
78ea379e0f |
29
.github/workflows/build.yml
vendored
29
.github/workflows/build.yml
vendored
@@ -82,8 +82,6 @@ jobs:
|
|||||||
export STRIP=$TARGET-strip
|
export STRIP=$TARGET-strip
|
||||||
export PKG_CONFIG_PATH=$DEPS_DIR/lib/pkgconfig
|
export PKG_CONFIG_PATH=$DEPS_DIR/lib/pkgconfig
|
||||||
|
|
||||||
export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}"
|
|
||||||
|
|
||||||
# netfilter libs
|
# netfilter libs
|
||||||
wget -qO- https://www.netfilter.org/pub/libnfnetlink/libnfnetlink-1.0.2.tar.bz2 | tar -xj
|
wget -qO- https://www.netfilter.org/pub/libnfnetlink/libnfnetlink-1.0.2.tar.bz2 | tar -xj
|
||||||
wget -qO- https://www.netfilter.org/pub/libmnl/libmnl-1.0.5.tar.bz2 | tar -xj
|
wget -qO- https://www.netfilter.org/pub/libmnl/libmnl-1.0.5.tar.bz2 | tar -xj
|
||||||
@@ -92,6 +90,7 @@ jobs:
|
|||||||
for i in libmnl libnfnetlink libnetfilter_queue ; do
|
for i in libmnl libnfnetlink libnetfilter_queue ; do
|
||||||
(
|
(
|
||||||
cd $i-*
|
cd $i-*
|
||||||
|
CFLAGS="-Os -flto=auto" \
|
||||||
./configure --prefix= --host=$TARGET --enable-static --disable-shared --disable-dependency-tracking
|
./configure --prefix= --host=$TARGET --enable-static --disable-shared --disable-dependency-tracking
|
||||||
make install -j$(nproc) DESTDIR=$DEPS_DIR
|
make install -j$(nproc) DESTDIR=$DEPS_DIR
|
||||||
)
|
)
|
||||||
@@ -103,6 +102,7 @@ jobs:
|
|||||||
xargs -I{} wget -qO- https://github.com/madler/zlib/archive/refs/tags/{}.tar.gz | tar -xz
|
xargs -I{} wget -qO- https://github.com/madler/zlib/archive/refs/tags/{}.tar.gz | tar -xz
|
||||||
(
|
(
|
||||||
cd zlib-*
|
cd zlib-*
|
||||||
|
CFLAGS="-Os -flto=auto" \
|
||||||
./configure --prefix= --static
|
./configure --prefix= --static
|
||||||
make install -j$(nproc) DESTDIR=$DEPS_DIR
|
make install -j$(nproc) DESTDIR=$DEPS_DIR
|
||||||
)
|
)
|
||||||
@@ -113,8 +113,8 @@ jobs:
|
|||||||
install -Dm644 -t $DEPS_DIR/include/sys /usr/include/x86_64-linux-gnu/sys/queue.h /usr/include/sys/capability.h
|
install -Dm644 -t $DEPS_DIR/include/sys /usr/include/x86_64-linux-gnu/sys/queue.h /usr/include/sys/capability.h
|
||||||
|
|
||||||
# zapret
|
# zapret
|
||||||
CFLAGS="$CFLAGS -static-libgcc -static -I$DEPS_DIR/include" \
|
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -static-libgcc -static -I$DEPS_DIR/include" \
|
||||||
LDFLAGS="$LDFLAGS -L$DEPS_DIR/lib" \
|
LDFLAGS="-L$DEPS_DIR/lib" \
|
||||||
make -C zapret -j$(nproc)
|
make -C zapret -j$(nproc)
|
||||||
tar -C zapret/binaries/my -cJf zapret-linux-$ARCH.tar.xz .
|
tar -C zapret/binaries/my -cJf zapret-linux-$ARCH.tar.xz .
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ jobs:
|
|||||||
ARCH: ${{ matrix.arch }}
|
ARCH: ${{ matrix.arch }}
|
||||||
run: |
|
run: |
|
||||||
export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}"
|
export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}"
|
||||||
settarget $TARGET-freebsd11 make bsd -j$(nproc) || exit 1
|
settarget $TARGET-freebsd11 make bsd -j$(nproc)
|
||||||
tar -C binaries/my -cJf zapret-freebsd-$ARCH.tar.xz .
|
tar -C binaries/my -cJf zapret-freebsd-$ARCH.tar.xz .
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
@@ -203,9 +203,9 @@ jobs:
|
|||||||
- name: Build ip2net, mdig
|
- name: Build ip2net, mdig
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
run: |
|
run: |
|
||||||
|
export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}"
|
||||||
mkdir -p output
|
mkdir -p output
|
||||||
cd zapret
|
cd zapret
|
||||||
export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}"
|
|
||||||
mingw32-make -C ip2net win
|
mingw32-make -C ip2net win
|
||||||
mingw32-make -C mdig win
|
mingw32-make -C mdig win
|
||||||
cp -a {ip2net/ip2net,mdig/mdig}.exe ../output
|
cp -a {ip2net/ip2net,mdig/mdig}.exe ../output
|
||||||
@@ -319,8 +319,6 @@ jobs:
|
|||||||
export STRIP=$TOOLCHAIN/bin/llvm-strip
|
export STRIP=$TOOLCHAIN/bin/llvm-strip
|
||||||
export PKG_CONFIG_PATH=$DEPS_DIR/lib/pkgconfig
|
export PKG_CONFIG_PATH=$DEPS_DIR/lib/pkgconfig
|
||||||
|
|
||||||
export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}"
|
|
||||||
|
|
||||||
# netfilter libs
|
# netfilter libs
|
||||||
wget -qO- https://www.netfilter.org/pub/libnfnetlink/libnfnetlink-1.0.2.tar.bz2 | tar -xj
|
wget -qO- https://www.netfilter.org/pub/libnfnetlink/libnfnetlink-1.0.2.tar.bz2 | tar -xj
|
||||||
wget -qO- https://www.netfilter.org/pub/libmnl/libmnl-1.0.5.tar.bz2 | tar -xj
|
wget -qO- https://www.netfilter.org/pub/libmnl/libmnl-1.0.5.tar.bz2 | tar -xj
|
||||||
@@ -330,7 +328,7 @@ jobs:
|
|||||||
for i in libmnl libnfnetlink libnetfilter_queue ; do
|
for i in libmnl libnfnetlink libnetfilter_queue ; do
|
||||||
(
|
(
|
||||||
cd $i-*
|
cd $i-*
|
||||||
CFLAGS="$CFLAGS -Wno-implicit-function-declaration" \
|
CFLAGS="-Os -flto=auto -Wno-implicit-function-declaration" \
|
||||||
./configure --prefix= --host=$TARGET --enable-static --disable-shared --disable-dependency-tracking
|
./configure --prefix= --host=$TARGET --enable-static --disable-shared --disable-dependency-tracking
|
||||||
make install -j$(nproc) DESTDIR=$DEPS_DIR
|
make install -j$(nproc) DESTDIR=$DEPS_DIR
|
||||||
)
|
)
|
||||||
@@ -338,7 +336,8 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
# zapret
|
# zapret
|
||||||
CFLAGS="$CFLAGS -I$DEPS_DIR/include" LDFLAGS="$LDFLAGS -L$DEPS_DIR/lib" \
|
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -I$DEPS_DIR/include" \
|
||||||
|
LDFLAGS="-L$DEPS_DIR/lib" \
|
||||||
make -C zapret android -j$(nproc)
|
make -C zapret android -j$(nproc)
|
||||||
zip zapret-android-$ABI.zip -j zapret/binaries/my/*
|
zip zapret-android-$ABI.zip -j zapret/binaries/my/*
|
||||||
|
|
||||||
@@ -437,10 +436,12 @@ jobs:
|
|||||||
find ${{ env.repo_dir }}/binaries -type f -exec sha256sum {} \; >sha256sum.txt
|
find ${{ env.repo_dir }}/binaries -type f -exec sha256sum {} \; >sha256sum.txt
|
||||||
tar --owner=0 --group=0 -czf ${{ env.repo_dir }}.tar.gz ${{ env.repo_dir }}
|
tar --owner=0 --group=0 -czf ${{ env.repo_dir }}.tar.gz ${{ env.repo_dir }}
|
||||||
zip -qr ${{ env.repo_dir }}.zip ${{ env.repo_dir }}
|
zip -qr ${{ env.repo_dir }}.zip ${{ env.repo_dir }}
|
||||||
rm -rf ${{ env.repo_dir }}/tpws ${{ env.repo_dir }}/nfq ${{ env.repo_dir }}/ip2net ${{ env.repo_dir }}/mdig ${{ env.repo_dir }}/docs ${{ env.repo_dir }}/files/huawei
|
(
|
||||||
rm -rf ${{ env.repo_dir }}/init.d/openrc ${{ env.repo_dir }}/init.d/macos ${{ env.repo_dir }}/init.d/pfsense ${{ env.repo_dir }}/init.d/runit ${{ env.repo_dir }}/init.d/s6 ${{ env.repo_dir }}/init.d/systemd
|
cd ${{ env.repo_dir }}
|
||||||
rm -rf ${{ env.repo_dir }}/binaries/android* -rf ${{ env.repo_dir }}/binaries/win* ${{ env.repo_dir }}/binaries/mac* ${{ env.repo_dir }}/binaries/freebsd*
|
rm -rf binaries/{android*,freebsd*,mac*,win*,x86_64/tpws_wsl.tgz} \
|
||||||
rm -f ${{ env.repo_dir }}/Makefile ${{ env.repo_dir }}/binaries/x86_64/tpws_wsl.tgz
|
init.d/{openrc,macos,pfsense,runit,s6,systemd} \
|
||||||
|
tpws nfq ip2net mdig docs files/huawei Makefile
|
||||||
|
)
|
||||||
tar --owner=0 --group=0 -czf ${{ env.repo_dir }}-openwrt-embedded.tar.gz ${{ env.repo_dir }}
|
tar --owner=0 --group=0 -czf ${{ env.repo_dir }}-openwrt-embedded.tar.gz ${{ env.repo_dir }}
|
||||||
|
|
||||||
- name: Upload release assets
|
- name: Upload release assets
|
||||||
|
@@ -1011,11 +1011,10 @@ 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=$?
|
local testf=$1 dom=$2 strategy code=$?
|
||||||
[ "$code" = 0 ] && {
|
[ "$code" = 0 ] && {
|
||||||
local testf=$1 dom=$2
|
|
||||||
shift; shift;
|
shift; shift;
|
||||||
local strategy="$@"
|
strategy="$@"
|
||||||
strategy_append_extra_tpws
|
strategy_append_extra_tpws
|
||||||
report_append "ipv${IPV} $dom $testf : tpws ${WF:+$WF }$strategy"
|
report_append "ipv${IPV} $dom $testf : tpws ${WF:+$WF }$strategy"
|
||||||
}
|
}
|
||||||
@@ -1028,11 +1027,10 @@ 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_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"}
|
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_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"}
|
||||||
ws_curl_test pktws_start "$@"${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"}
|
ws_curl_test pktws_start "$@"${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"}
|
||||||
local code=$?
|
local testf=$1 dom=$2 strategy code=$?
|
||||||
[ "$code" = 0 ] && {
|
[ "$code" = 0 ] && {
|
||||||
local testf=$1 dom=$2
|
|
||||||
shift; shift;
|
shift; shift;
|
||||||
local strategy="$@"
|
strategy="$@"
|
||||||
strategy_append_extra_pktws
|
strategy_append_extra_pktws
|
||||||
report_append "ipv${IPV} $dom $testf : $PKTWSD ${WF:+$WF }$strategy"
|
report_append "ipv${IPV} $dom $testf : $PKTWSD ${WF:+$WF }$strategy"
|
||||||
}
|
}
|
||||||
@@ -1112,6 +1110,10 @@ test_has_split()
|
|||||||
{
|
{
|
||||||
contains "$1" split || contains "$1" disorder
|
contains "$1" split || contains "$1" disorder
|
||||||
}
|
}
|
||||||
|
test_has_fakedsplit()
|
||||||
|
{
|
||||||
|
contains "$1" fakedsplit || contains "$1" fakeddisorder
|
||||||
|
}
|
||||||
test_has_fake()
|
test_has_fake()
|
||||||
{
|
{
|
||||||
[ "$1" = fake ] || starts_with "$1" fake,
|
[ "$1" = fake ] || starts_with "$1" fake,
|
||||||
@@ -1138,10 +1140,13 @@ pktws_curl_test_update_vary()
|
|||||||
proto=http
|
proto=http
|
||||||
[ "$sec" = 0 ] || proto=tls
|
[ "$sec" = 0 ] || proto=tls
|
||||||
test_has_fake $desync && zerofake="--dpi-desync-fake-$proto=0x00000000"
|
test_has_fake $desync && zerofake="--dpi-desync-fake-$proto=0x00000000"
|
||||||
test_has_split $desync && {
|
if test_has_fakedsplit $desync ; then
|
||||||
|
splits="method+2 midsld"
|
||||||
|
[ "$sec" = 0 ] || splits="1 midsld"
|
||||||
|
elif test_has_split $desync ; then
|
||||||
splits="method+2 midsld"
|
splits="method+2 midsld"
|
||||||
[ "$sec" = 0 ] || splits="1 midsld 1,midsld"
|
[ "$sec" = 0 ] || splits="1 midsld 1,midsld"
|
||||||
}
|
fi
|
||||||
for fake in '' $zerofake ; do
|
for fake in '' $zerofake ; do
|
||||||
if [ -n "$splits" ]; then
|
if [ -n "$splits" ]; then
|
||||||
for pos in $splits ; do
|
for pos in $splits ; do
|
||||||
|
@@ -140,7 +140,7 @@ echo_var()
|
|||||||
eval v="\$$1"
|
eval v="\$$1"
|
||||||
if find_str_in_list $1 "$EDITVAR_NEWLINE_VARS"; then
|
if find_str_in_list $1 "$EDITVAR_NEWLINE_VARS"; then
|
||||||
echo "$1=\""
|
echo "$1=\""
|
||||||
echo "$v\"" | sed "s/$EDITVAR_NEWLINE_DELIMETER /$EDITVAR_NEWLINE_DELIMETER\n/g"
|
echo "$v\"" | tr '\n' ' ' | tr -d '\r' | sed -e 's/^ *//' -e 's/ *$//' -e "s/$EDITVAR_NEWLINE_DELIMETER /$EDITVAR_NEWLINE_DELIMETER\n/g"
|
||||||
else
|
else
|
||||||
if contains "$v" " "; then
|
if contains "$v" " "; then
|
||||||
echo $1=\"$v\"
|
echo $1=\"$v\"
|
||||||
@@ -170,6 +170,7 @@ list_vars()
|
|||||||
echo_var $1
|
echo_var $1
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
openrc_test()
|
openrc_test()
|
||||||
@@ -837,3 +838,37 @@ select_fwtype()
|
|||||||
echo select firewall type :
|
echo select firewall type :
|
||||||
ask_list FWTYPE "iptables nftables" "$FWTYPE" && write_config_var FWTYPE
|
ask_list FWTYPE "iptables nftables" "$FWTYPE" && write_config_var FWTYPE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dry_run_tpws_()
|
||||||
|
{
|
||||||
|
local TPWS="$ZAPRET_BASE/tpws/tpws"
|
||||||
|
echo verifying tpws options
|
||||||
|
"$TPWS" --dry-run "$@"
|
||||||
|
}
|
||||||
|
dry_run_nfqws_()
|
||||||
|
{
|
||||||
|
local NFQWS="$ZAPRET_BASE/nfq/nfqws"
|
||||||
|
echo verifying nfqws options
|
||||||
|
"$NFQWS" --dry-run "$@"
|
||||||
|
}
|
||||||
|
dry_run_tpws()
|
||||||
|
{
|
||||||
|
[ "$TPWS_ENABLE" = 1 ] || return 0
|
||||||
|
local opt="$TPWS_OPT" port=${TPPORT_SOCKS:-988}
|
||||||
|
filter_apply_hostlist_target opt
|
||||||
|
dry_run_tpws_ --port=$port $opt
|
||||||
|
}
|
||||||
|
dry_run_tpws_socks()
|
||||||
|
{
|
||||||
|
[ "$TPWS_SOCKS_ENABLE" = 1 ] || return 0
|
||||||
|
local opt="$TPWS_SOCKS_OPT" port=${TPPORT:-987}
|
||||||
|
filter_apply_hostlist_target opt
|
||||||
|
dry_run_tpws_ --port=$port --socks $opt
|
||||||
|
}
|
||||||
|
dry_run_nfqws()
|
||||||
|
{
|
||||||
|
[ "$NFQWS_ENABLE" = 1 ] || return 0
|
||||||
|
local opt="$NFQWS_OPT" qn=${QNUM:-200}
|
||||||
|
filter_apply_hostlist_target opt
|
||||||
|
dry_run_nfqws_ --qnum=$qn $opt
|
||||||
|
}
|
||||||
|
@@ -407,3 +407,13 @@ nfqws,tpws: fixed ipsets and hostlists
|
|||||||
all progs: version numbers for github, build date/time for self built
|
all progs: version numbers for github, build date/time for self built
|
||||||
repo: light release for openwrt and embedded systems
|
repo: light release for openwrt and embedded systems
|
||||||
repo: sha256sum
|
repo: sha256sum
|
||||||
|
|
||||||
|
v69.4
|
||||||
|
|
||||||
|
nfqws: fakedsplit/fakeddisorder fakes for both split segments
|
||||||
|
nfqws: --dpi-desync-fakedsplit-pattern
|
||||||
|
|
||||||
|
v69.5
|
||||||
|
|
||||||
|
nfqws,tpws: --dry-run
|
||||||
|
install_easy: check tpws and nfqws options validity
|
||||||
|
@@ -50,6 +50,8 @@
|
|||||||
> образ `squashfs` с помощью `image builder` и перешить этим вариантом роутер.
|
> образ `squashfs` с помощью `image builder` и перешить этим вариантом роутер.
|
||||||
|
|
||||||
1. Скачайте последний [tar.gz релиз](https://github.com/bol-van/zapret/releases) в /tmp, распакуйте его, затем удалите архив.
|
1. Скачайте последний [tar.gz релиз](https://github.com/bol-van/zapret/releases) в /tmp, распакуйте его, затем удалите архив.
|
||||||
|
Для openwrt и прошивок используйте вариант `openwrt-embedded`.
|
||||||
|
Для экономия места в /tmp можно качать через curl в stdout и сразу распаковывать.
|
||||||
|
|
||||||
2. Убедитесь, что у вас отключены все средства обхода блокировок, в том числе и
|
2. Убедитесь, что у вас отключены все средства обхода блокировок, в том числе и
|
||||||
сам zapret. Гарантированно уберет zapret скрипт `uninstall_easy.sh`.
|
сам zapret. Гарантированно уберет zapret скрипт `uninstall_easy.sh`.
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# zapret v69.3
|
# zapret v69.5
|
||||||
|
|
||||||
# SCAMMER WARNING
|
# SCAMMER WARNING
|
||||||
|
|
||||||
@@ -131,6 +131,7 @@ nfqws takes the following parameters:
|
|||||||
@<config_file> ; read file for options. must be the only argument. other options are ignored.
|
@<config_file> ; read file for options. must be the only argument. other options are ignored.
|
||||||
|
|
||||||
--debug=0|1
|
--debug=0|1
|
||||||
|
--dry-run ; verify parameters and exit with code 0 if successful
|
||||||
--qnum=<nfqueue_number>
|
--qnum=<nfqueue_number>
|
||||||
--daemon ; daemonize
|
--daemon ; daemonize
|
||||||
--pidfile=<filename> ; write pid to file
|
--pidfile=<filename> ; write pid to file
|
||||||
@@ -162,6 +163,7 @@ nfqws takes the following parameters:
|
|||||||
; fakedsplit/fakeddisorder use first l7-protocol-compatible parameter if present, first abs value otherwise
|
; fakedsplit/fakeddisorder use first l7-protocol-compatible parameter if present, first abs value otherwise
|
||||||
--dpi-desync-split-seqovl=N|-N|marker+N|marker-N ; use sequence overlap before first sent original split segment
|
--dpi-desync-split-seqovl=N|-N|marker+N|marker-N ; use sequence overlap before first sent original split segment
|
||||||
--dpi-desync-split-seqovl-pattern=<filename>|0xHEX ; pattern for the fake part of overlap
|
--dpi-desync-split-seqovl-pattern=<filename>|0xHEX ; pattern for the fake part of overlap
|
||||||
|
--dpi-desync-fakedsplit-pattern=<filename>|0xHEX ; fake pattern for fakedsplit/fakeddisorder
|
||||||
--dpi-desync-ipfrag-pos-tcp=<8..9216> ; ip frag position starting from the transport header. multiple of 8, default 8.
|
--dpi-desync-ipfrag-pos-tcp=<8..9216> ; ip frag position starting from the transport header. multiple of 8, default 8.
|
||||||
--dpi-desync-ipfrag-pos-udp=<8..9216> ; ip frag position starting from the transport header. multiple of 8, default 32.
|
--dpi-desync-ipfrag-pos-udp=<8..9216> ; ip frag position starting from the transport header. multiple of 8, default 32.
|
||||||
--dpi-desync-badseq-increment=<int|0xHEX> ; badseq fooling seq signed increment. default -10000
|
--dpi-desync-badseq-increment=<int|0xHEX> ; badseq fooling seq signed increment. default -10000
|
||||||
@@ -262,8 +264,8 @@ Fakes are separate generated by nfqws packets carrying false information for DPI
|
|||||||
|
|
||||||
* `multisplit`. split request at specified in `--dpi-desync-split-pos` positions
|
* `multisplit`. split request at specified in `--dpi-desync-split-pos` positions
|
||||||
* `multidisorder`. same as `multisplit` but send in reverse order
|
* `multidisorder`. same as `multisplit` but send in reverse order
|
||||||
* `fakedsplit`. split request into 2 segments adding fakes in the middle of them : fake 1st segment, 1st segment, fake 1st segment, 2nd segment
|
* `fakedsplit`. split request into 2 segments adding fakes in the middle of them : fake 1st segment, 1st segment, fake 1st segment, fake 2nd segment, 2nd segment, fake 2nd segment
|
||||||
* `fakeddisorder`. same as `fakedsplit` but with another order : 2nd segment, fake 1st segment, 1st segment, fake 1st segment
|
* `fakeddisorder`. same as `fakedsplit` but with another order : fake 2nd segment, 2nd segment, fake 2nd segment, fake 1st segment, 1st segment, fake 1st segment
|
||||||
|
|
||||||
Positions are defined by markers.
|
Positions are defined by markers.
|
||||||
|
|
||||||
@@ -638,6 +640,7 @@ tpws is transparent proxy.
|
|||||||
|
|
||||||
--debug=0|1|2|syslog|@<filename> ; 1 and 2 means log to console and set debug level. for other targets use --debug-level.
|
--debug=0|1|2|syslog|@<filename> ; 1 and 2 means log to console and set debug level. for other targets use --debug-level.
|
||||||
--debug-level=0|1|2 ; specify debug level for syslog and @<filename>
|
--debug-level=0|1|2 ; specify debug level for syslog and @<filename>
|
||||||
|
--dry-run ; verify parameters and exit with code 0 if successful
|
||||||
--bind-addr=<v4_addr>|<v6_addr> ; for v6 link locals append %interface_name : fe80::1%br-lan
|
--bind-addr=<v4_addr>|<v6_addr> ; for v6 link locals append %interface_name : fe80::1%br-lan
|
||||||
--bind-iface4=<interface_name> ; bind to the first ipv4 addr of interface
|
--bind-iface4=<interface_name> ; bind to the first ipv4 addr of interface
|
||||||
--bind-iface6=<interface_name> ; bind to the first ipv6 addr of interface
|
--bind-iface6=<interface_name> ; bind to the first ipv6 addr of interface
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# zapret v69.3
|
# zapret v69.5
|
||||||
|
|
||||||
# ВНИМАНИЕ, остерегайтесь мошенников
|
# ВНИМАНИЕ, остерегайтесь мошенников
|
||||||
|
|
||||||
@@ -162,6 +162,7 @@ dvtws, собираемый из тех же исходников (см. [док
|
|||||||
@<config_file>|$<config_file> ; читать конфигурацию из файла. опция должна быть первой. остальные опции игнорируются.
|
@<config_file>|$<config_file> ; читать конфигурацию из файла. опция должна быть первой. остальные опции игнорируются.
|
||||||
|
|
||||||
--debug=0|1 ; 1=выводить отладочные сообщения
|
--debug=0|1 ; 1=выводить отладочные сообщения
|
||||||
|
--dry-run ; проверить опции командной строки и выйти. код 0 - успешная проверка.
|
||||||
--daemon ; демонизировать прогу
|
--daemon ; демонизировать прогу
|
||||||
--pidfile=<file> ; сохранить PID в файл
|
--pidfile=<file> ; сохранить PID в файл
|
||||||
--user=<username> ; менять uid процесса
|
--user=<username> ; менять uid процесса
|
||||||
@@ -190,6 +191,7 @@ dvtws, собираемый из тех же исходников (см. [док
|
|||||||
--dpi-desync-split-pos=N|-N|marker+N|marker-N ; список через запятую маркеров для tcp сегментации в режимах split и disorder
|
--dpi-desync-split-pos=N|-N|marker+N|marker-N ; список через запятую маркеров для tcp сегментации в режимах split и disorder
|
||||||
--dpi-desync-split-seqovl=N|-N|marker+N|marker-N ; единичный маркер, определяющий величину перекрытия sequence в режимах split и disorder. для split поддерживается только положительное число.
|
--dpi-desync-split-seqovl=N|-N|marker+N|marker-N ; единичный маркер, определяющий величину перекрытия sequence в режимах split и disorder. для split поддерживается только положительное число.
|
||||||
--dpi-desync-split-seqovl-pattern=<filename>|0xHEX ; чем заполнять фейковую часть overlap
|
--dpi-desync-split-seqovl-pattern=<filename>|0xHEX ; чем заполнять фейковую часть overlap
|
||||||
|
--dpi-desync-fakedsplit-pattern=<filename>|0xHEX ; чем заполнять фейки в fakedsplit/fakeddisorder
|
||||||
--dpi-desync-badseq-increment=<int|0xHEX> ; инкремент sequence number для badseq. по умолчанию -10000
|
--dpi-desync-badseq-increment=<int|0xHEX> ; инкремент sequence number для badseq. по умолчанию -10000
|
||||||
--dpi-desync-badack-increment=<int|0xHEX> ; инкремент ack sequence number для badseq. по умолчанию -66000
|
--dpi-desync-badack-increment=<int|0xHEX> ; инкремент ack sequence number для badseq. по умолчанию -66000
|
||||||
--dpi-desync-any-protocol=0|1 ; 0(default)=работать только по http request и tls clienthello 1=по всем непустым пакетам данных
|
--dpi-desync-any-protocol=0|1 ; 0(default)=работать только по http request и tls clienthello 1=по всем непустым пакетам данных
|
||||||
@@ -318,8 +320,13 @@ dvtws, собираемый из тех же исходников (см. [док
|
|||||||
|
|
||||||
* `multisplit`. нарезаем запрос на указанных в `--dpi-desync-split-pos` позициях.
|
* `multisplit`. нарезаем запрос на указанных в `--dpi-desync-split-pos` позициях.
|
||||||
* `multidisorder`. нарезаем запрос на указанных в `--dpi-desync-split-pos` позициях и отправляем в обратном порядке.
|
* `multidisorder`. нарезаем запрос на указанных в `--dpi-desync-split-pos` позициях и отправляем в обратном порядке.
|
||||||
* `fakedsplit`. нарезаем запрос на 2 части, обрамляя его фейками : фейк 1-й части, 1 часть, фейк 1-й части, 2 часть
|
* `fakedsplit`. нарезаем запрос на 2 части, обрамляя каждую часть фейками : фейк 1-й части, 1 часть, фейк 1-й части, фейк 2-й части, 2 часть, фейк 2-й части
|
||||||
* `fakeddisorder`. нарезаем запрос на 2 части, обрамляя его фейками : 2 часть, фейк 1-й части, 1 часть, фейк 1 части.
|
* `fakeddisorder`. аналогично `fakedsplit`, только в обратном порядке : фейк 2-й части, 2 часть, фейк 2-й части, фейк 1-й части, 1 часть, фейк 1 части.
|
||||||
|
|
||||||
|
Содержимое фейков в `fakedsplit`/`fakeddisorder` определяется параметром `--dpi-desync-fakedsplit-pattern` (по умолчанию 0x00).
|
||||||
|
Данные фейков берутся из паттерна со смещением, соответствующим смещению отсылаемых частей.
|
||||||
|
Размеры фейков соответствуют длинам отсылаемых частей.
|
||||||
|
Цель этих режимов - максимально усложнить выявление оригинальных данных среди фейков.
|
||||||
|
|
||||||
Для определения позиций нарезки используются маркеры.
|
Для определения позиций нарезки используются маркеры.
|
||||||
|
|
||||||
@@ -752,20 +759,21 @@ tpws - это transparent proxy.
|
|||||||
|
|
||||||
--debug=0|1|2|syslog|@<filename> ; 0,1,2 = логирование на косоль : 0=тихо, 1(default)=подробно, 2=отладка.
|
--debug=0|1|2|syslog|@<filename> ; 0,1,2 = логирование на косоль : 0=тихо, 1(default)=подробно, 2=отладка.
|
||||||
--debug-level=0|1|2 ; указать уровень логирования для syslog и @<filename>
|
--debug-level=0|1|2 ; указать уровень логирования для syslog и @<filename>
|
||||||
|
--dry-run ; проверить опции командной строки и выйти. код 0 - успешная проверка.
|
||||||
|
|
||||||
--daemon ; демонизировать прогу
|
--daemon ; демонизировать прогу
|
||||||
--pidfile=<file> ; сохранить PID в файл
|
--pidfile=<file> ; сохранить PID в файл
|
||||||
--user=<username> ; менять uid процесса
|
--user=<username> ; менять uid процесса
|
||||||
--uid=uid[:gid] ; менять uid процесса
|
--uid=uid[:gid] ; менять uid процесса
|
||||||
--bind-addr ; на каком адресе слушать. может быть ipv4 или ipv6 адрес
|
--bind-addr ; на каком адресе слушать. может быть ipv4 или ipv6 адрес
|
||||||
; если указан ipv6 link local, то требуется указать с какого он интерфейса : fe80::1%br-lan
|
; если указан ipv6 link local, то требуется указать с какого он интерфейса : fe80::1%br-lan
|
||||||
--bind-linklocal=no|unwanted|prefer|force
|
--bind-linklocal=no|unwanted|prefer|force ; no : биндаться только на global ipv6
|
||||||
; no : биндаться только на global ipv6
|
|
||||||
; unwanted (default) : предпочтительно global, если нет - LL
|
; unwanted (default) : предпочтительно global, если нет - LL
|
||||||
; prefer : предпочтительно LL, если нет - global
|
; prefer : предпочтительно LL, если нет - global
|
||||||
; force : биндаться только на LL
|
; force : биндаться только на LL
|
||||||
--bind-iface4=<iface> ; слушать на первом ipv4 интерфейса iface
|
--bind-iface4=<iface> ; слушать на первом ipv4 интерфейса iface
|
||||||
--bind-iface6=<iface> ; слушать на первом ipv6 интерфейса iface
|
--bind-iface6=<iface> ; слушать на первом ipv6 интерфейса iface
|
||||||
--bind-wait-ifup=<sec ; ждать до N секунд появления и поднятия интерфейса
|
--bind-wait-ifup=<sec> ; ждать до N секунд появления и поднятия интерфейса
|
||||||
--bind-wait-ip=<sec> ; ждать до N секунд получения IP адреса (если задан --bind-wait-ifup - время идет после поднятия интерфейса)
|
--bind-wait-ip=<sec> ; ждать до N секунд получения IP адреса (если задан --bind-wait-ifup - время идет после поднятия интерфейса)
|
||||||
--bind-wait-ip-linklocal=<sec>
|
--bind-wait-ip-linklocal=<sec>
|
||||||
; имеет смысл только при задании --bind-wait-ip
|
; имеет смысл только при задании --bind-wait-ip
|
||||||
@@ -828,7 +836,7 @@ tpws - это transparent proxy.
|
|||||||
; хосты извлекаются из Host: хедера обычных http запросов и из SNI в TLS ClientHello.
|
; хосты извлекаются из Host: хедера обычных http запросов и из SNI в TLS ClientHello.
|
||||||
--hostlist-domains=<domain_list> ; фиксированный список доменов через зяпятую. можно использовать # в начале для комментирования отдельных доменов.
|
--hostlist-domains=<domain_list> ; фиксированный список доменов через зяпятую. можно использовать # в начале для комментирования отдельных доменов.
|
||||||
--hostlist-exclude=<filename> ; не применять дурение к доменам из листа. может быть множество листов. схема аналогична include листам.
|
--hostlist-exclude=<filename> ; не применять дурение к доменам из листа. может быть множество листов. схема аналогична include листам.
|
||||||
--hostlist-exclude-domains=<domain_list>; фиксированный список доменов через зяпятую. можно использовать # в начале для комментирования отдельных доменов.
|
--hostlist-exclude-domains=<domain_list> ; фиксированный список доменов через зяпятую. можно использовать # в начале для комментирования отдельных доменов.
|
||||||
--hostlist-auto=<filename> ; обнаруживать автоматически блокировки и заполнять автоматический hostlist (требует перенаправления входящего трафика)
|
--hostlist-auto=<filename> ; обнаруживать автоматически блокировки и заполнять автоматический hostlist (требует перенаправления входящего трафика)
|
||||||
--hostlist-auto-fail-threshold=<int> ; сколько раз нужно обнаружить ситуацию, похожую на блокировку, чтобы добавить хост в лист (по умолчанию: 3)
|
--hostlist-auto-fail-threshold=<int> ; сколько раз нужно обнаружить ситуацию, похожую на блокировку, чтобы добавить хост в лист (по умолчанию: 3)
|
||||||
--hostlist-auto-fail-time=<int> ; все эти ситуации должны быть в пределах указанного количества секунд (по умолчанию: 60)
|
--hostlist-auto-fail-time=<int> ; все эти ситуации должны быть в пределах указанного количества секунд (по умолчанию: 60)
|
||||||
|
@@ -101,10 +101,11 @@ There are several options :
|
|||||||
Replace these 2 files in every location they are present.
|
Replace these 2 files in every location they are present.
|
||||||
In `zapret-win-bundle` they are in `zapret-winws` и `blockcheck/zapret/nfq` folders.
|
In `zapret-win-bundle` they are in `zapret-winws` и `blockcheck/zapret/nfq` folders.
|
||||||
However this option still requires 10+ year old patch that enables SHA256 signatures.
|
However this option still requires 10+ year old patch that enables SHA256 signatures.
|
||||||
|
If you're using win bundle you can simply run `win7\install_win7.cmd`
|
||||||
|
|
||||||
2. [Hack ESU](https://hackandpwn.com/windows-7-esu-patching)
|
3. [Hack ESU](https://hackandpwn.com/windows-7-esu-patching)
|
||||||
|
|
||||||
3. Use `UpdatePack7R2` from simplix : https://blog.simplix.info
|
4. Use `UpdatePack7R2` from simplix : https://blog.simplix.info
|
||||||
If you are in Russia or Belarus temporary change region in Control Panel.
|
If you are in Russia or Belarus temporary change region in Control Panel.
|
||||||
|
|
||||||
### blockcheck
|
### blockcheck
|
||||||
|
@@ -159,6 +159,7 @@ _windivert 2.2.2-A_, который идет в поставке zapret.
|
|||||||
и заменить эти 2 файла.
|
и заменить эти 2 файла.
|
||||||
В [zapret-win-bundle](https://github.com/bol-van/zapret-win-bundle) есть отдельных 2 места, где находится **winws** : [_zapret-winws_](https://github.com/bol-van/zapret-win-bundle/tree/master/zapret-winws) и [_blockcheck/zapret/nfq_](https://github.com/bol-van/zapret-win-bundle/tree/master/blockcheck).
|
В [zapret-win-bundle](https://github.com/bol-van/zapret-win-bundle) есть отдельных 2 места, где находится **winws** : [_zapret-winws_](https://github.com/bol-van/zapret-win-bundle/tree/master/zapret-winws) и [_blockcheck/zapret/nfq_](https://github.com/bol-van/zapret-win-bundle/tree/master/blockcheck).
|
||||||
Надо менять в обоих местах.
|
Надо менять в обоих местах.
|
||||||
|
Альтернативный вариант при использовании win bundle - запустить `win7\install_win7.cmd`
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Этот вариант проверен и должен работать. Тем не менее патч 10 летней давности, который включает SHA256 сигнатуры, все еще необходим.
|
> Этот вариант проверен и должен работать. Тем не менее патч 10 летней давности, который включает SHA256 сигнатуры, все еще необходим.
|
||||||
|
@@ -102,7 +102,7 @@ dnat6_target()
|
|||||||
}
|
}
|
||||||
set_route_localnet()
|
set_route_localnet()
|
||||||
{
|
{
|
||||||
_set_route_localnet $1 "$IFACE_LAN"
|
_set_route_localnet $1 $IFACE_LAN
|
||||||
}
|
}
|
||||||
|
|
||||||
fw_nfqws_post4()
|
fw_nfqws_post4()
|
||||||
|
@@ -26,6 +26,7 @@ IPSET_DIR="$ZAPRET_BASE/ipset"
|
|||||||
. "$ZAPRET_BASE/common/ipt.sh"
|
. "$ZAPRET_BASE/common/ipt.sh"
|
||||||
. "$ZAPRET_BASE/common/installer.sh"
|
. "$ZAPRET_BASE/common/installer.sh"
|
||||||
. "$ZAPRET_BASE/common/virt.sh"
|
. "$ZAPRET_BASE/common/virt.sh"
|
||||||
|
. "$ZAPRET_BASE/common/list.sh"
|
||||||
|
|
||||||
GET_LIST="$IPSET_DIR/get_config.sh"
|
GET_LIST="$IPSET_DIR/get_config.sh"
|
||||||
|
|
||||||
@@ -115,6 +116,30 @@ ws_opt_validate()
|
|||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
tpws_opt_validate()
|
||||||
|
{
|
||||||
|
ws_opt_validate "$1" || return 1
|
||||||
|
dry_run_tpws || {
|
||||||
|
echo invalid tpws options
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tpws_socks_opt_validate()
|
||||||
|
{
|
||||||
|
# --ipset allowed here
|
||||||
|
dry_run_tpws_socks || {
|
||||||
|
echo invalid tpws options
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nfqws_opt_validate()
|
||||||
|
{
|
||||||
|
ws_opt_validate "$1" || return 1
|
||||||
|
dry_run_nfqws || {
|
||||||
|
echo invalid nfqws options
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
select_mode_group()
|
select_mode_group()
|
||||||
{
|
{
|
||||||
@@ -162,18 +187,17 @@ select_mode_group()
|
|||||||
select_mode_tpws_socks()
|
select_mode_tpws_socks()
|
||||||
{
|
{
|
||||||
local EDITVAR_NEWLINE_DELIMETER="--new" EDITVAR_NEWLINE_VARS="TPWS_SOCKS_OPT"
|
local EDITVAR_NEWLINE_DELIMETER="--new" EDITVAR_NEWLINE_VARS="TPWS_SOCKS_OPT"
|
||||||
# --ipset allowed here
|
select_mode_group TPWS_SOCKS_ENABLE "enable tpws socks mode on port $TPPORT_SOCKS ?" "TPPORT_SOCKS TPWS_SOCKS_OPT" tpws_socks_opt_validate TPWS_SOCKS_OPT
|
||||||
select_mode_group TPWS_SOCKS_ENABLE "enable tpws socks mode on port $TPPORT_SOCKS ?" "TPPORT_SOCKS TPWS_SOCKS_OPT"
|
|
||||||
}
|
}
|
||||||
select_mode_tpws()
|
select_mode_tpws()
|
||||||
{
|
{
|
||||||
local EDITVAR_NEWLINE_DELIMETER="--new" EDITVAR_NEWLINE_VARS="TPWS_OPT"
|
local EDITVAR_NEWLINE_DELIMETER="--new" EDITVAR_NEWLINE_VARS="TPWS_OPT"
|
||||||
select_mode_group TPWS_ENABLE "enable tpws transparent mode ?" "TPWS_PORTS TPWS_OPT" ws_opt_validate TPWS_OPT
|
select_mode_group TPWS_ENABLE "enable tpws transparent mode ?" "TPWS_PORTS TPWS_OPT" tpws_opt_validate TPWS_OPT
|
||||||
}
|
}
|
||||||
select_mode_nfqws()
|
select_mode_nfqws()
|
||||||
{
|
{
|
||||||
local EDITVAR_NEWLINE_DELIMETER="--new" EDITVAR_NEWLINE_VARS="NFQWS_OPT"
|
local EDITVAR_NEWLINE_DELIMETER="--new" EDITVAR_NEWLINE_VARS="NFQWS_OPT"
|
||||||
select_mode_group NFQWS_ENABLE "enable nfqws ?" "NFQWS_PORTS_TCP NFQWS_PORTS_UDP NFQWS_TCP_PKT_OUT NFQWS_TCP_PKT_IN NFQWS_UDP_PKT_OUT NFQWS_UDP_PKT_IN NFQWS_PORTS_TCP_KEEPALIVE NFQWS_PORTS_UDP_KEEPALIVE NFQWS_OPT" ws_opt_validate NFQWS_OPT
|
select_mode_group NFQWS_ENABLE "enable nfqws ?" "NFQWS_PORTS_TCP NFQWS_PORTS_UDP NFQWS_TCP_PKT_OUT NFQWS_TCP_PKT_IN NFQWS_UDP_PKT_OUT NFQWS_UDP_PKT_IN NFQWS_PORTS_TCP_KEEPALIVE NFQWS_PORTS_UDP_KEEPALIVE NFQWS_OPT" nfqws_opt_validate NFQWS_OPT
|
||||||
}
|
}
|
||||||
|
|
||||||
select_mode_mode()
|
select_mode_mode()
|
||||||
|
40
ipset/get_antifilter_domains.sh
Normal file
40
ipset/get_antifilter_domains.sh
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IPSET_DIR="$(dirname "$0")"
|
||||||
|
IPSET_DIR="$(cd "$IPSET_DIR"; pwd)"
|
||||||
|
|
||||||
|
. "$IPSET_DIR/def.sh"
|
||||||
|
|
||||||
|
TMPLIST="$TMPDIR/list.txt"
|
||||||
|
|
||||||
|
URL="https://antifilter.download/list/domains.lst"
|
||||||
|
|
||||||
|
dl()
|
||||||
|
{
|
||||||
|
# $1 - url
|
||||||
|
# $2 - file
|
||||||
|
# $3 - minsize
|
||||||
|
# $4 - maxsize
|
||||||
|
curl -L -H "Accept-Encoding: gzip" -k --fail --max-time 60 --connect-timeout 10 --retry 4 --max-filesize 251658240 -o "$TMPLIST" "$1" ||
|
||||||
|
{
|
||||||
|
echo list download failed : $1
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
dlsize=$(LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ')
|
||||||
|
if test $dlsize -lt $3; then
|
||||||
|
echo list is too small : $dlsize bytes. can be bad.
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
zzcat "$TMPLIST" | tr -d '\015' | zz "$2"
|
||||||
|
rm -f "$TMPLIST"
|
||||||
|
}
|
||||||
|
|
||||||
|
# useful in case ipban set is used in custom scripts
|
||||||
|
FAIL=
|
||||||
|
getipban || FAIL=1
|
||||||
|
"$IPSET_DIR/create_ipset.sh"
|
||||||
|
[ -n "$FAIL" ] && exit
|
||||||
|
|
||||||
|
dl "$URL" "$ZHOSTLIST" 32768 4194304
|
||||||
|
|
||||||
|
exit 0
|
73
nfq/desync.c
73
nfq/desync.c
@@ -1449,10 +1449,17 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
|
|||||||
case DESYNC_FAKEDDISORDER:
|
case DESYNC_FAKEDDISORDER:
|
||||||
if (split_pos)
|
if (split_pos)
|
||||||
{
|
{
|
||||||
uint8_t fakeseg[DPI_DESYNC_MAX_FAKE_LEN+100], *seg;
|
uint8_t fakeseg[DPI_DESYNC_MAX_FAKE_LEN+100], fakeseg2[DPI_DESYNC_MAX_FAKE_LEN+100], pat[DPI_DESYNC_MAX_FAKE_LEN], *seg;
|
||||||
size_t seg_len;
|
size_t seg_len,fakeseg2_len;
|
||||||
unsigned int seqovl;
|
unsigned int seqovl;
|
||||||
|
|
||||||
|
if (dis->len_payload > sizeof(pat))
|
||||||
|
{
|
||||||
|
DLOG("packet is too large\n");
|
||||||
|
return verdict;
|
||||||
|
}
|
||||||
|
fill_pattern(pat,dis->len_payload,dp->fsplit_pattern,sizeof(dp->fsplit_pattern));
|
||||||
|
|
||||||
ip_id = IP4_IP_ID_FIX(dis->ip);
|
ip_id = IP4_IP_ID_FIX(dis->ip);
|
||||||
|
|
||||||
if (seqovl_pos>=split_pos)
|
if (seqovl_pos>=split_pos)
|
||||||
@@ -1480,6 +1487,19 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
|
|||||||
seg = dis->data_payload+split_pos;
|
seg = dis->data_payload+split_pos;
|
||||||
seg_len = dis->len_payload-split_pos;
|
seg_len = dis->len_payload-split_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fakeseg2_len = sizeof(fakeseg2);
|
||||||
|
if (!prepare_tcp_segment((struct sockaddr *)&src, (struct sockaddr *)&dst, flags_orig, net32_add(dis->tcp->th_seq,split_pos), dis->tcp->th_ack, dis->tcp->th_win, scale_factor, timestamps,
|
||||||
|
ttl_fake,IP4_TOS(dis->ip),ip_id,IP6_FLOW(dis->ip6),
|
||||||
|
dp->desync_fooling_mode,dp->desync_badseq_increment,dp->desync_badseq_ack_increment,
|
||||||
|
pat+split_pos, dis->len_payload-split_pos, fakeseg2, &fakeseg2_len))
|
||||||
|
return verdict;
|
||||||
|
ip_id=IP4_IP_ID_PREV(ip_id);
|
||||||
|
DLOG("sending fake(1) 2nd out-of-order tcp segment %zu-%zu len=%zu : ",split_pos,dis->len_payload-1, dis->len_payload-split_pos);
|
||||||
|
hexdump_limited_dlog(pat+split_pos,dis->len_payload-split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
||||||
|
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg2, fakeseg2_len))
|
||||||
|
return verdict;
|
||||||
|
|
||||||
pkt1_len = sizeof(pkt1);
|
pkt1_len = sizeof(pkt1);
|
||||||
if (!prepare_tcp_segment((struct sockaddr *)&src, (struct sockaddr *)&dst, flags_orig, net32_add(dis->tcp->th_seq , split_pos - seqovl), dis->tcp->th_ack, dis->tcp->th_win, scale_factor, timestamps,
|
if (!prepare_tcp_segment((struct sockaddr *)&src, (struct sockaddr *)&dst, flags_orig, net32_add(dis->tcp->th_seq , split_pos - seqovl), dis->tcp->th_ack, dis->tcp->th_win, scale_factor, timestamps,
|
||||||
ttl_orig,IP4_TOS(dis->ip),ip_id,IP6_FLOW(dis->ip6),
|
ttl_orig,IP4_TOS(dis->ip),ip_id,IP6_FLOW(dis->ip6),
|
||||||
@@ -1492,15 +1512,23 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
|
|||||||
if (!rawsend((struct sockaddr *)&dst, desync_fwmark, ifout , pkt1, pkt1_len))
|
if (!rawsend((struct sockaddr *)&dst, desync_fwmark, ifout , pkt1, pkt1_len))
|
||||||
return verdict;
|
return verdict;
|
||||||
|
|
||||||
|
if (dis->ip) ((struct ip*)fakeseg2)->ip_id = ip_id;
|
||||||
|
ip_id=IP4_IP_ID_PREV(ip_id);
|
||||||
|
|
||||||
|
DLOG("sending fake(2) 2nd out-of-order tcp segment %zu-%zu len=%zu : ",split_pos,dis->len_payload-1, dis->len_payload-split_pos);
|
||||||
|
hexdump_limited_dlog(pat+split_pos,dis->len_payload-split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
||||||
|
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg2, fakeseg2_len))
|
||||||
|
return verdict;
|
||||||
|
|
||||||
seg_len = sizeof(fakeseg);
|
seg_len = sizeof(fakeseg);
|
||||||
if (!prepare_tcp_segment((struct sockaddr *)&src, (struct sockaddr *)&dst, flags_orig, dis->tcp->th_seq, dis->tcp->th_ack, dis->tcp->th_win, scale_factor, timestamps,
|
if (!prepare_tcp_segment((struct sockaddr *)&src, (struct sockaddr *)&dst, flags_orig, dis->tcp->th_seq, dis->tcp->th_ack, dis->tcp->th_win, scale_factor, timestamps,
|
||||||
ttl_fake,IP4_TOS(dis->ip),ip_id,IP6_FLOW(dis->ip6),
|
ttl_fake,IP4_TOS(dis->ip),ip_id,IP6_FLOW(dis->ip6),
|
||||||
dp->desync_fooling_mode,dp->desync_badseq_increment,dp->desync_badseq_ack_increment,
|
dp->desync_fooling_mode,dp->desync_badseq_increment,dp->desync_badseq_ack_increment,
|
||||||
zeropkt, split_pos, fakeseg, &seg_len))
|
pat, split_pos, fakeseg, &seg_len))
|
||||||
return verdict;
|
return verdict;
|
||||||
ip_id=IP4_IP_ID_PREV(ip_id);
|
ip_id=IP4_IP_ID_PREV(ip_id);
|
||||||
DLOG("sending fake(1) 1st out-of-order tcp segment 0-%zu len=%zu : ",split_pos-1, split_pos);
|
DLOG("sending fake(1) 1st out-of-order tcp segment 0-%zu len=%zu : ",split_pos-1, split_pos);
|
||||||
hexdump_limited_dlog(zeropkt,split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
hexdump_limited_dlog(pat,split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
||||||
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, seg_len))
|
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, seg_len))
|
||||||
return verdict;
|
return verdict;
|
||||||
|
|
||||||
@@ -1518,7 +1546,7 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
|
|||||||
|
|
||||||
if (dis->ip) ((struct ip*)fakeseg)->ip_id = ip_id;
|
if (dis->ip) ((struct ip*)fakeseg)->ip_id = ip_id;
|
||||||
DLOG("sending fake(2) 1st out-of-order tcp segment 0-%zu len=%zu : ",split_pos-1, split_pos);
|
DLOG("sending fake(2) 1st out-of-order tcp segment 0-%zu len=%zu : ",split_pos-1, split_pos);
|
||||||
hexdump_limited_dlog(zeropkt,split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
hexdump_limited_dlog(pat,split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
||||||
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, seg_len))
|
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, seg_len))
|
||||||
return verdict;
|
return verdict;
|
||||||
|
|
||||||
@@ -1528,20 +1556,27 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
|
|||||||
case DESYNC_FAKEDSPLIT:
|
case DESYNC_FAKEDSPLIT:
|
||||||
if (split_pos)
|
if (split_pos)
|
||||||
{
|
{
|
||||||
uint8_t fakeseg[DPI_DESYNC_MAX_FAKE_LEN+100],ovlseg[DPI_DESYNC_MAX_FAKE_LEN+100], *seg;
|
uint8_t fakeseg[DPI_DESYNC_MAX_FAKE_LEN+100],ovlseg[DPI_DESYNC_MAX_FAKE_LEN+100],pat[DPI_DESYNC_MAX_FAKE_LEN], *seg;
|
||||||
size_t fakeseg_len,seg_len;
|
size_t fakeseg_len,seg_len;
|
||||||
|
|
||||||
|
if (dis->len_payload > sizeof(pat))
|
||||||
|
{
|
||||||
|
DLOG("packet is too large\n");
|
||||||
|
return verdict;
|
||||||
|
}
|
||||||
|
fill_pattern(pat,dis->len_payload,dp->fsplit_pattern,sizeof(dp->fsplit_pattern));
|
||||||
|
|
||||||
ip_id = IP4_IP_ID_FIX(dis->ip);
|
ip_id = IP4_IP_ID_FIX(dis->ip);
|
||||||
|
|
||||||
fakeseg_len = sizeof(fakeseg);
|
fakeseg_len = sizeof(fakeseg);
|
||||||
if (!prepare_tcp_segment((struct sockaddr *)&src, (struct sockaddr *)&dst, flags_orig, dis->tcp->th_seq, dis->tcp->th_ack, dis->tcp->th_win, scale_factor, timestamps,
|
if (!prepare_tcp_segment((struct sockaddr *)&src, (struct sockaddr *)&dst, flags_orig, dis->tcp->th_seq, dis->tcp->th_ack, dis->tcp->th_win, scale_factor, timestamps,
|
||||||
ttl_fake,IP4_TOS(dis->ip),ip_id,IP6_FLOW(dis->ip6),
|
ttl_fake,IP4_TOS(dis->ip),ip_id,IP6_FLOW(dis->ip6),
|
||||||
dp->desync_fooling_mode,dp->desync_badseq_increment,dp->desync_badseq_ack_increment,
|
dp->desync_fooling_mode,dp->desync_badseq_increment,dp->desync_badseq_ack_increment,
|
||||||
zeropkt, split_pos, fakeseg, &fakeseg_len))
|
pat, split_pos, fakeseg, &fakeseg_len))
|
||||||
return verdict;
|
return verdict;
|
||||||
ip_id=IP4_IP_ID_NEXT(ip_id);
|
ip_id=IP4_IP_ID_NEXT(ip_id);
|
||||||
DLOG("sending fake(1) 1st tcp segment 0-%zu len=%zu : ",split_pos-1, split_pos);
|
DLOG("sending fake(1) 1st tcp segment 0-%zu len=%zu : ",split_pos-1, split_pos);
|
||||||
hexdump_limited_dlog(zeropkt,split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
hexdump_limited_dlog(pat,split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
||||||
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, fakeseg_len))
|
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, fakeseg_len))
|
||||||
return verdict;
|
return verdict;
|
||||||
|
|
||||||
@@ -1596,7 +1631,19 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
|
|||||||
if (dis->ip) ((struct ip*)fakeseg)->ip_id = ip_id;
|
if (dis->ip) ((struct ip*)fakeseg)->ip_id = ip_id;
|
||||||
ip_id=IP4_IP_ID_NEXT(ip_id);
|
ip_id=IP4_IP_ID_NEXT(ip_id);
|
||||||
DLOG("sending fake(2) 1st tcp segment 0-%zu len=%zu : ",split_pos-1, split_pos);
|
DLOG("sending fake(2) 1st tcp segment 0-%zu len=%zu : ",split_pos-1, split_pos);
|
||||||
hexdump_limited_dlog(zeropkt,split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
hexdump_limited_dlog(pat,split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
||||||
|
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, fakeseg_len))
|
||||||
|
return verdict;
|
||||||
|
|
||||||
|
fakeseg_len = sizeof(fakeseg);
|
||||||
|
if (!prepare_tcp_segment((struct sockaddr *)&src, (struct sockaddr *)&dst, flags_orig, net32_add(dis->tcp->th_seq,split_pos), dis->tcp->th_ack, dis->tcp->th_win, scale_factor, timestamps,
|
||||||
|
ttl_fake,IP4_TOS(dis->ip),ip_id,IP6_FLOW(dis->ip6),
|
||||||
|
dp->desync_fooling_mode,dp->desync_badseq_increment,dp->desync_badseq_ack_increment,
|
||||||
|
pat+split_pos, dis->len_payload-split_pos, fakeseg, &fakeseg_len))
|
||||||
|
return verdict;
|
||||||
|
ip_id=IP4_IP_ID_NEXT(ip_id);
|
||||||
|
DLOG("sending fake(1) 2nd tcp segment %zu-%zu len=%zu : ",split_pos,dis->len_payload-1, dis->len_payload-split_pos);
|
||||||
|
hexdump_limited_dlog(pat+split_pos,dis->len_payload-split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
||||||
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, fakeseg_len))
|
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, fakeseg_len))
|
||||||
return verdict;
|
return verdict;
|
||||||
|
|
||||||
@@ -1606,11 +1653,19 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
|
|||||||
fooling_orig,dp->desync_badseq_increment,dp->desync_badseq_ack_increment,
|
fooling_orig,dp->desync_badseq_increment,dp->desync_badseq_ack_increment,
|
||||||
dis->data_payload+split_pos, dis->len_payload-split_pos, pkt1, &pkt1_len))
|
dis->data_payload+split_pos, dis->len_payload-split_pos, pkt1, &pkt1_len))
|
||||||
return verdict;
|
return verdict;
|
||||||
|
ip_id=IP4_IP_ID_NEXT(ip_id);
|
||||||
DLOG("sending 2nd tcp segment %zu-%zu len=%zu : ",split_pos,dis->len_payload-1, dis->len_payload-split_pos);
|
DLOG("sending 2nd tcp segment %zu-%zu len=%zu : ",split_pos,dis->len_payload-1, dis->len_payload-split_pos);
|
||||||
hexdump_limited_dlog(dis->data_payload+split_pos,dis->len_payload-split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
hexdump_limited_dlog(dis->data_payload+split_pos,dis->len_payload-split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
||||||
if (!rawsend((struct sockaddr *)&dst, desync_fwmark, ifout , pkt1, pkt1_len))
|
if (!rawsend((struct sockaddr *)&dst, desync_fwmark, ifout , pkt1, pkt1_len))
|
||||||
return verdict;
|
return verdict;
|
||||||
|
|
||||||
|
if (dis->ip) ((struct ip*)fakeseg)->ip_id = ip_id;
|
||||||
|
|
||||||
|
DLOG("sending fake(2) 2nd tcp segment %zu-%zu len=%zu : ",split_pos,dis->len_payload-1, dis->len_payload-split_pos);
|
||||||
|
hexdump_limited_dlog(pat+split_pos,dis->len_payload-split_pos,PKTDATA_MAXDUMP); DLOG("\n");
|
||||||
|
if (!rawsend_rep(dp->desync_repeats,(struct sockaddr *)&dst, desync_fwmark, ifout , fakeseg, fakeseg_len))
|
||||||
|
return verdict;
|
||||||
|
|
||||||
return VERDICT_DROP;
|
return VERDICT_DROP;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
343
nfq/nfqws.c
343
nfq/nfqws.c
@@ -1030,6 +1030,7 @@ static void exithelp(void)
|
|||||||
" @<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"
|
||||||
|
" --dry-run\t\t\t\t\t; verify parameters and exit with code 0 if successful\n"
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
" --qnum=<nfqueue_number>\n"
|
" --qnum=<nfqueue_number>\n"
|
||||||
#elif defined(BSD)
|
#elif defined(BSD)
|
||||||
@@ -1110,6 +1111,7 @@ static void exithelp(void)
|
|||||||
"\t\t\t\t\t\t; fakedsplit/fakeddisorder use first l7-protocol-compatible parameter if present, first abs value otherwise\n"
|
"\t\t\t\t\t\t; fakedsplit/fakeddisorder use first l7-protocol-compatible parameter if present, first abs value otherwise\n"
|
||||||
" --dpi-desync-split-seqovl=N|-N|marker+N|marker-N ; use sequence overlap before first sent original split segment\n"
|
" --dpi-desync-split-seqovl=N|-N|marker+N|marker-N ; use sequence overlap before first sent original split segment\n"
|
||||||
" --dpi-desync-split-seqovl-pattern=<filename>|0xHEX ; pattern for the fake part of overlap\n"
|
" --dpi-desync-split-seqovl-pattern=<filename>|0xHEX ; pattern for the fake part of overlap\n"
|
||||||
|
" --dpi-desync-fakedsplit-pattern=<filename>|0xHEX ; fake pattern for fakedsplit/fakeddisorder\n"
|
||||||
" --dpi-desync-ipfrag-pos-tcp=<8..%u>\t\t; ip frag position starting from the transport header. multiple of 8, default %u.\n"
|
" --dpi-desync-ipfrag-pos-tcp=<8..%u>\t\t; ip frag position starting from the transport header. multiple of 8, default %u.\n"
|
||||||
" --dpi-desync-ipfrag-pos-udp=<8..%u>\t\t; ip frag position starting from the transport header. multiple of 8, default %u.\n"
|
" --dpi-desync-ipfrag-pos-udp=<8..%u>\t\t; ip frag position starting from the transport header. multiple of 8, default %u.\n"
|
||||||
" --dpi-desync-badseq-increment=<int|0xHEX>\t; badseq fooling seq signed increment. default %d\n"
|
" --dpi-desync-badseq-increment=<int|0xHEX>\t; badseq fooling seq signed increment. default %d\n"
|
||||||
@@ -1194,7 +1196,7 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
int result, v;
|
int result, v;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
bool daemon = false, bSkip = false;
|
bool daemon = false, bSkip = false, bDry = false;
|
||||||
char pidfile[256];
|
char pidfile[256];
|
||||||
struct hostlist_file *anon_hl = NULL, *anon_hl_exclude = NULL;
|
struct hostlist_file *anon_hl = NULL, *anon_hl_exclude = NULL;
|
||||||
struct ipset_file *anon_ips = NULL, *anon_ips_exclude = NULL;
|
struct ipset_file *anon_ips = NULL, *anon_ips_exclude = NULL;
|
||||||
@@ -1262,107 +1264,113 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
const struct option long_options[] = {
|
const struct option long_options[] = {
|
||||||
{"debug",optional_argument,0,0}, // optidx=0
|
{"debug",optional_argument,0,0}, // optidx=0
|
||||||
|
{"dry-run",no_argument,0,0}, // optidx=1
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
{"qnum",required_argument,0,0}, // optidx=1
|
{"qnum",required_argument,0,0}, // optidx=2
|
||||||
#elif defined(BSD)
|
#elif defined(BSD)
|
||||||
{"port",required_argument,0,0}, // optidx=1
|
{"port",required_argument,0,0}, // optidx=2
|
||||||
#else
|
#else
|
||||||
{"disabled_argument_1",no_argument,0,0},// optidx=1
|
{"disabled_argument_1",no_argument,0,0},// optidx=2
|
||||||
#endif
|
#endif
|
||||||
{"daemon",no_argument,0,0}, // optidx=2
|
{"daemon",no_argument,0,0}, // optidx=3
|
||||||
{"pidfile",required_argument,0,0}, // optidx=3
|
{"pidfile",required_argument,0,0}, // optidx=4
|
||||||
#ifndef __CYGWIN__
|
#ifndef __CYGWIN__
|
||||||
{"user",required_argument,0,0 }, // optidx=4
|
{"user",required_argument,0,0 }, // optidx=5
|
||||||
{"uid",required_argument,0,0 }, // optidx=5
|
{"uid",required_argument,0,0 }, // optidx=6
|
||||||
#else
|
#else
|
||||||
{"disabled_argument_2",no_argument,0,0}, // optidx=4
|
{"disabled_argument_2",no_argument,0,0}, // optidx=5
|
||||||
{"disabled_argument_3",no_argument,0,0}, // optidx=5
|
{"disabled_argument_3",no_argument,0,0}, // optidx=6
|
||||||
#endif
|
#endif
|
||||||
{"wsize",required_argument,0,0}, // optidx=6
|
{"wsize",required_argument,0,0}, // optidx=7
|
||||||
{"wssize",required_argument,0,0}, // optidx=7
|
{"wssize",required_argument,0,0}, // optidx=8
|
||||||
{"wssize-cutoff",required_argument,0,0},// optidx=8
|
{"wssize-cutoff",required_argument,0,0},// optidx=9
|
||||||
{"ctrack-timeouts",required_argument,0,0},// optidx=9
|
{"ctrack-timeouts",required_argument,0,0},// optidx=10
|
||||||
{"hostcase",no_argument,0,0}, // optidx=10
|
{"hostcase",no_argument,0,0}, // optidx=11
|
||||||
{"hostspell",required_argument,0,0}, // optidx=11
|
{"hostspell",required_argument,0,0}, // optidx=12
|
||||||
{"hostnospace",no_argument,0,0}, // optidx=12
|
{"hostnospace",no_argument,0,0}, // optidx=13
|
||||||
{"domcase",no_argument,0,0 }, // optidx=13
|
{"domcase",no_argument,0,0 }, // optidx=14
|
||||||
{"methodeol",no_argument,0,0 }, // optidx=14
|
{"methodeol",no_argument,0,0 }, // optidx=15
|
||||||
{"dpi-desync",required_argument,0,0}, // optidx=15
|
{"dpi-desync",required_argument,0,0}, // optidx=17
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
{"dpi-desync-fwmark",required_argument,0,0}, // optidx=16
|
{"dpi-desync-fwmark",required_argument,0,0}, // optidx=17
|
||||||
#elif defined(SO_USER_COOKIE)
|
#elif defined(SO_USER_COOKIE)
|
||||||
{"dpi-desync-sockarg",required_argument,0,0}, // optidx=16
|
{"dpi-desync-sockarg",required_argument,0,0}, // optidx=17
|
||||||
#else
|
#else
|
||||||
{"disabled_argument_4",no_argument,0,0}, // optidx=16
|
{"disabled_argument_4",no_argument,0,0}, // optidx=17
|
||||||
#endif
|
#endif
|
||||||
{"dpi-desync-ttl",required_argument,0,0}, // optidx=17
|
{"dpi-desync-ttl",required_argument,0,0}, // optidx=18
|
||||||
{"dpi-desync-ttl6",required_argument,0,0}, // optidx=18
|
{"dpi-desync-ttl6",required_argument,0,0}, // optidx=19
|
||||||
{"dpi-desync-autottl",optional_argument,0,0}, // optidx=19
|
{"dpi-desync-autottl",optional_argument,0,0}, // optidx=20
|
||||||
{"dpi-desync-autottl6",optional_argument,0,0}, // optidx=20
|
{"dpi-desync-autottl6",optional_argument,0,0}, // optidx=21
|
||||||
{"dpi-desync-fooling",required_argument,0,0}, // optidx=21
|
{"dpi-desync-fooling",required_argument,0,0}, // optidx=22
|
||||||
{"dpi-desync-repeats",required_argument,0,0}, // optidx=22
|
{"dpi-desync-repeats",required_argument,0,0}, // optidx=23
|
||||||
{"dpi-desync-skip-nosni",optional_argument,0,0},// optidx=23
|
{"dpi-desync-skip-nosni",optional_argument,0,0},// optidx=24
|
||||||
{"dpi-desync-split-pos",required_argument,0,0},// optidx=24
|
{"dpi-desync-split-pos",required_argument,0,0},// optidx=25
|
||||||
{"dpi-desync-split-http-req",required_argument,0,0 },// optidx=25
|
{"dpi-desync-split-http-req",required_argument,0,0 },// optidx=26
|
||||||
{"dpi-desync-split-tls",required_argument,0,0 },// optidx=26
|
{"dpi-desync-split-tls",required_argument,0,0 },// optidx=27
|
||||||
{"dpi-desync-split-seqovl",required_argument,0,0 },// optidx=27
|
{"dpi-desync-split-seqovl",required_argument,0,0 },// optidx=28
|
||||||
{"dpi-desync-split-seqovl-pattern",required_argument,0,0 },// optidx=28
|
{"dpi-desync-split-seqovl-pattern",required_argument,0,0 },// optidx=29
|
||||||
{"dpi-desync-ipfrag-pos-tcp",required_argument,0,0},// optidx=29
|
{"dpi-desync-fakedsplit-pattern",required_argument,0,0 },// optidx=30
|
||||||
{"dpi-desync-ipfrag-pos-udp",required_argument,0,0},// optidx=30
|
{"dpi-desync-ipfrag-pos-tcp",required_argument,0,0},// optidx=31
|
||||||
{"dpi-desync-badseq-increment",required_argument,0,0},// optidx=31
|
{"dpi-desync-ipfrag-pos-udp",required_argument,0,0},// optidx=32
|
||||||
{"dpi-desync-badack-increment",required_argument,0,0},// optidx=32
|
{"dpi-desync-badseq-increment",required_argument,0,0},// optidx=33
|
||||||
{"dpi-desync-any-protocol",optional_argument,0,0},// optidx=33
|
{"dpi-desync-badack-increment",required_argument,0,0},// optidx=34
|
||||||
{"dpi-desync-fake-http",required_argument,0,0},// optidx=34
|
{"dpi-desync-any-protocol",optional_argument,0,0},// optidx=35
|
||||||
{"dpi-desync-fake-tls",required_argument,0,0},// optidx=35
|
{"dpi-desync-fake-http",required_argument,0,0},// optidx=36
|
||||||
{"dpi-desync-fake-unknown",required_argument,0,0},// optidx=36
|
{"dpi-desync-fake-tls",required_argument,0,0},// optidx=37
|
||||||
{"dpi-desync-fake-syndata",required_argument,0,0},// optidx=37
|
{"dpi-desync-fake-unknown",required_argument,0,0},// optidx=38
|
||||||
{"dpi-desync-fake-quic",required_argument,0,0},// optidx=38
|
{"dpi-desync-fake-syndata",required_argument,0,0},// optidx=39
|
||||||
{"dpi-desync-fake-wireguard",required_argument,0,0},// optidx=39
|
{"dpi-desync-fake-quic",required_argument,0,0},// optidx=40
|
||||||
{"dpi-desync-fake-dht",required_argument,0,0},// optidx=40
|
{"dpi-desync-fake-wireguard",required_argument,0,0},// optidx=41
|
||||||
{"dpi-desync-fake-unknown-udp",required_argument,0,0},// optidx=41
|
{"dpi-desync-fake-dht",required_argument,0,0},// optidx=42
|
||||||
{"dpi-desync-udplen-increment",required_argument,0,0},// optidx=42
|
{"dpi-desync-fake-unknown-udp",required_argument,0,0},// optidx=43
|
||||||
{"dpi-desync-udplen-pattern",required_argument,0,0},// optidx=43
|
{"dpi-desync-udplen-increment",required_argument,0,0},// optidx=44
|
||||||
{"dpi-desync-cutoff",required_argument,0,0},// optidx=44
|
{"dpi-desync-udplen-pattern",required_argument,0,0},// optidx=45
|
||||||
{"dpi-desync-start",required_argument,0,0},// optidx=45
|
{"dpi-desync-cutoff",required_argument,0,0},// optidx=46
|
||||||
{"hostlist",required_argument,0,0}, // optidx=46
|
{"dpi-desync-start",required_argument,0,0},// optidx=47
|
||||||
{"hostlist-domains",required_argument,0,0},// optidx=47
|
{"hostlist",required_argument,0,0}, // optidx=48
|
||||||
{"hostlist-exclude",required_argument,0,0}, // optidx=48
|
{"hostlist-domains",required_argument,0,0},// optidx=49
|
||||||
{"hostlist-exclude-domains",required_argument,0,0},// optidx=49
|
{"hostlist-exclude",required_argument,0,0}, // optidx=50
|
||||||
{"hostlist-auto",required_argument,0,0}, // optidx=50
|
{"hostlist-exclude-domains",required_argument,0,0},// optidx=51
|
||||||
{"hostlist-auto-fail-threshold",required_argument,0,0}, // optidx=51
|
{"hostlist-auto",required_argument,0,0}, // optidx=52
|
||||||
{"hostlist-auto-fail-time",required_argument,0,0}, // optidx=52
|
{"hostlist-auto-fail-threshold",required_argument,0,0}, // optidx=53
|
||||||
{"hostlist-auto-retrans-threshold",required_argument,0,0}, // optidx=53
|
{"hostlist-auto-fail-time",required_argument,0,0}, // optidx=54
|
||||||
{"hostlist-auto-debug",required_argument,0,0}, // optidx=54
|
{"hostlist-auto-retrans-threshold",required_argument,0,0}, // optidx=55
|
||||||
{"new",no_argument,0,0}, // optidx=55
|
{"hostlist-auto-debug",required_argument,0,0}, // optidx=56
|
||||||
{"skip",no_argument,0,0}, // optidx=56
|
{"new",no_argument,0,0}, // optidx=57
|
||||||
{"filter-l3",required_argument,0,0}, // optidx=57
|
{"skip",no_argument,0,0}, // optidx=58
|
||||||
{"filter-tcp",required_argument,0,0}, // optidx=58
|
{"filter-l3",required_argument,0,0}, // optidx=59
|
||||||
{"filter-udp",required_argument,0,0}, // optidx=59
|
{"filter-tcp",required_argument,0,0}, // optidx=60
|
||||||
{"filter-l7",required_argument,0,0}, // optidx=60
|
{"filter-udp",required_argument,0,0}, // optidx=61
|
||||||
{"ipset",required_argument,0,0}, // optidx=61
|
{"filter-l7",required_argument,0,0}, // optidx=62
|
||||||
{"ipset-ip",required_argument,0,0}, // optidx=62
|
{"ipset",required_argument,0,0}, // optidx=63
|
||||||
{"ipset-exclude",required_argument,0,0},// optidx=63
|
{"ipset-ip",required_argument,0,0}, // optidx=64
|
||||||
{"ipset-exclude-ip",required_argument,0,0}, // optidx=64
|
{"ipset-exclude",required_argument,0,0},// optidx=65
|
||||||
|
{"ipset-exclude-ip",required_argument,0,0}, // optidx=66
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
{"bind-fix4",no_argument,0,0}, // optidx=65
|
{"bind-fix4",no_argument,0,0}, // optidx=67
|
||||||
{"bind-fix6",no_argument,0,0}, // optidx=66
|
{"bind-fix6",no_argument,0,0}, // optidx=68
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
{"wf-iface",required_argument,0,0}, // optidx=65
|
{"wf-iface",required_argument,0,0}, // optidx=67
|
||||||
{"wf-l3",required_argument,0,0}, // optidx=66
|
{"wf-l3",required_argument,0,0}, // optidx=68
|
||||||
{"wf-tcp",required_argument,0,0}, // optidx=67
|
{"wf-tcp",required_argument,0,0}, // optidx=69
|
||||||
{"wf-udp",required_argument,0,0}, // optidx=68
|
{"wf-udp",required_argument,0,0}, // optidx=70
|
||||||
{"wf-raw",required_argument,0,0}, // optidx=69
|
{"wf-raw",required_argument,0,0}, // optidx=71
|
||||||
{"wf-save",required_argument,0,0}, // optidx=70
|
{"wf-save",required_argument,0,0}, // optidx=72
|
||||||
{"ssid-filter",required_argument,0,0}, // optidx=71
|
{"ssid-filter",required_argument,0,0}, // optidx=73
|
||||||
{"nlm-filter",required_argument,0,0}, // optidx=72
|
{"nlm-filter",required_argument,0,0}, // optidx=74
|
||||||
{"nlm-list",optional_argument,0,0}, // optidx=73
|
{"nlm-list",optional_argument,0,0}, // optidx=75
|
||||||
#endif
|
#endif
|
||||||
{NULL,0,NULL,0}
|
{NULL,0,NULL,0}
|
||||||
};
|
};
|
||||||
if (argc < 2) exithelp();
|
if (argc < 2) exithelp_clean();
|
||||||
while ((v = getopt_long_only(argc, argv, "", long_options, &option_index)) != -1)
|
while ((v = getopt_long_only(argc, argv, "", long_options, &option_index)) != -1)
|
||||||
{
|
{
|
||||||
if (v) exithelp();
|
if (v)
|
||||||
|
if (bDry)
|
||||||
|
exit_clean(1);
|
||||||
|
else
|
||||||
|
exithelp_clean();
|
||||||
switch (option_index)
|
switch (option_index)
|
||||||
{
|
{
|
||||||
case 0: /* debug */
|
case 0: /* debug */
|
||||||
@@ -1400,7 +1408,10 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifndef __CYGWIN__
|
#ifndef __CYGWIN__
|
||||||
case 1: /* qnum or port */
|
case 1: /* dry-run */
|
||||||
|
bDry=true;
|
||||||
|
break;
|
||||||
|
case 2: /* qnum or port */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
params.qnum = atoi(optarg);
|
params.qnum = atoi(optarg);
|
||||||
if (params.qnum < 0 || params.qnum>65535)
|
if (params.qnum < 0 || params.qnum>65535)
|
||||||
@@ -1421,15 +1432,15 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 2: /* daemon */
|
case 3: /* daemon */
|
||||||
daemon = true;
|
daemon = true;
|
||||||
break;
|
break;
|
||||||
case 3: /* pidfile */
|
case 4: /* pidfile */
|
||||||
strncpy(pidfile, optarg, sizeof(pidfile));
|
strncpy(pidfile, optarg, sizeof(pidfile));
|
||||||
pidfile[sizeof(pidfile) - 1] = '\0';
|
pidfile[sizeof(pidfile) - 1] = '\0';
|
||||||
break;
|
break;
|
||||||
#ifndef __CYGWIN__
|
#ifndef __CYGWIN__
|
||||||
case 4: /* user */
|
case 5: /* user */
|
||||||
{
|
{
|
||||||
struct passwd *pwd = getpwnam(optarg);
|
struct passwd *pwd = getpwnam(optarg);
|
||||||
if (!pwd)
|
if (!pwd)
|
||||||
@@ -1442,7 +1453,7 @@ int main(int argc, char **argv)
|
|||||||
params.droproot = true;
|
params.droproot = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5: /* uid */
|
case 6: /* uid */
|
||||||
params.gid = 0x7FFFFFFF; // default gid. drop gid=0
|
params.gid = 0x7FFFFFFF; // default gid. drop gid=0
|
||||||
params.droproot = true;
|
params.droproot = true;
|
||||||
if (sscanf(optarg, "%u:%u", ¶ms.uid, ¶ms.gid)<1)
|
if (sscanf(optarg, "%u:%u", ¶ms.uid, ¶ms.gid)<1)
|
||||||
@@ -1452,32 +1463,32 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 6: /* wsize */
|
case 7: /* wsize */
|
||||||
if (!parse_ws_scale_factor(optarg,&dp->wsize,&dp->wscale))
|
if (!parse_ws_scale_factor(optarg,&dp->wsize,&dp->wscale))
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
break;
|
break;
|
||||||
case 7: /* wssize */
|
case 8: /* wssize */
|
||||||
if (!parse_ws_scale_factor(optarg,&dp->wssize,&dp->wsscale))
|
if (!parse_ws_scale_factor(optarg,&dp->wssize,&dp->wsscale))
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
break;
|
break;
|
||||||
case 8: /* wssize-cutoff */
|
case 9: /* wssize-cutoff */
|
||||||
if (!parse_cutoff(optarg, &dp->wssize_cutoff, &dp->wssize_cutoff_mode))
|
if (!parse_cutoff(optarg, &dp->wssize_cutoff, &dp->wssize_cutoff_mode))
|
||||||
{
|
{
|
||||||
DLOG_ERR("invalid wssize-cutoff value\n");
|
DLOG_ERR("invalid wssize-cutoff value\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9: /* ctrack-timeouts */
|
case 10: /* ctrack-timeouts */
|
||||||
if (sscanf(optarg, "%u:%u:%u:%u", ¶ms.ctrack_t_syn, ¶ms.ctrack_t_est, ¶ms.ctrack_t_fin, ¶ms.ctrack_t_udp)<3)
|
if (sscanf(optarg, "%u:%u:%u:%u", ¶ms.ctrack_t_syn, ¶ms.ctrack_t_est, ¶ms.ctrack_t_fin, ¶ms.ctrack_t_udp)<3)
|
||||||
{
|
{
|
||||||
DLOG_ERR("invalid ctrack-timeouts value\n");
|
DLOG_ERR("invalid ctrack-timeouts value\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 10: /* hostcase */
|
case 11: /* hostcase */
|
||||||
dp->hostcase = true;
|
dp->hostcase = true;
|
||||||
break;
|
break;
|
||||||
case 11: /* hostspell */
|
case 12: /* hostspell */
|
||||||
if (strlen(optarg) != 4)
|
if (strlen(optarg) != 4)
|
||||||
{
|
{
|
||||||
DLOG_ERR("hostspell must be exactly 4 chars long\n");
|
DLOG_ERR("hostspell must be exactly 4 chars long\n");
|
||||||
@@ -1486,7 +1497,7 @@ int main(int argc, char **argv)
|
|||||||
dp->hostcase = true;
|
dp->hostcase = true;
|
||||||
memcpy(dp->hostspell, optarg, 4);
|
memcpy(dp->hostspell, optarg, 4);
|
||||||
break;
|
break;
|
||||||
case 12: /* hostnospace */
|
case 13: /* hostnospace */
|
||||||
if (dp->methodeol)
|
if (dp->methodeol)
|
||||||
{
|
{
|
||||||
DLOG_ERR("--hostnospace and --methodeol are incompatible\n");
|
DLOG_ERR("--hostnospace and --methodeol are incompatible\n");
|
||||||
@@ -1494,10 +1505,10 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
dp->hostnospace = true;
|
dp->hostnospace = true;
|
||||||
break;
|
break;
|
||||||
case 13: /* domcase */
|
case 14: /* domcase */
|
||||||
dp->domcase = true;
|
dp->domcase = true;
|
||||||
break;
|
break;
|
||||||
case 14: /* methodeol */
|
case 15: /* methodeol */
|
||||||
if (dp->hostnospace)
|
if (dp->hostnospace)
|
||||||
{
|
{
|
||||||
DLOG_ERR("--hostnospace and --methodeol are incompatible\n");
|
DLOG_ERR("--hostnospace and --methodeol are incompatible\n");
|
||||||
@@ -1505,7 +1516,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
dp->methodeol = true;
|
dp->methodeol = true;
|
||||||
break;
|
break;
|
||||||
case 15: /* dpi-desync */
|
case 16: /* dpi-desync */
|
||||||
{
|
{
|
||||||
char *mode=optarg,*mode2,*mode3;
|
char *mode=optarg,*mode2,*mode3;
|
||||||
mode2 = mode ? strchr(mode,',') : NULL;
|
mode2 = mode ? strchr(mode,',') : NULL;
|
||||||
@@ -1551,7 +1562,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifndef __CYGWIN__
|
#ifndef __CYGWIN__
|
||||||
case 16: /* dpi-desync-fwmark/dpi-desync-sockarg */
|
case 17: /* dpi-desync-fwmark/dpi-desync-sockarg */
|
||||||
#if defined(__linux__) || defined(SO_USER_COOKIE)
|
#if defined(__linux__) || defined(SO_USER_COOKIE)
|
||||||
params.desync_fwmark = 0;
|
params.desync_fwmark = 0;
|
||||||
if (sscanf(optarg, "0x%X", ¶ms.desync_fwmark)<=0) sscanf(optarg, "%u", ¶ms.desync_fwmark);
|
if (sscanf(optarg, "0x%X", ¶ms.desync_fwmark)<=0) sscanf(optarg, "%u", ¶ms.desync_fwmark);
|
||||||
@@ -1566,27 +1577,27 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 17: /* dpi-desync-ttl */
|
case 18: /* dpi-desync-ttl */
|
||||||
dp->desync_ttl = (uint8_t)atoi(optarg);
|
dp->desync_ttl = (uint8_t)atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 18: /* dpi-desync-ttl6 */
|
case 19: /* dpi-desync-ttl6 */
|
||||||
dp->desync_ttl6 = (uint8_t)atoi(optarg);
|
dp->desync_ttl6 = (uint8_t)atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 19: /* dpi-desync-autottl */
|
case 20: /* dpi-desync-autottl */
|
||||||
if (!parse_autottl(optarg, &dp->desync_autottl))
|
if (!parse_autottl(optarg, &dp->desync_autottl))
|
||||||
{
|
{
|
||||||
DLOG_ERR("dpi-desync-autottl value error\n");
|
DLOG_ERR("dpi-desync-autottl value error\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 20: /* dpi-desync-autottl6 */
|
case 21: /* dpi-desync-autottl6 */
|
||||||
if (!parse_autottl(optarg, &dp->desync_autottl6))
|
if (!parse_autottl(optarg, &dp->desync_autottl6))
|
||||||
{
|
{
|
||||||
DLOG_ERR("dpi-desync-autottl6 value error\n");
|
DLOG_ERR("dpi-desync-autottl6 value error\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 21: /* dpi-desync-fooling */
|
case 22: /* dpi-desync-fooling */
|
||||||
{
|
{
|
||||||
char *e,*p = optarg;
|
char *e,*p = optarg;
|
||||||
while (p)
|
while (p)
|
||||||
@@ -1621,17 +1632,17 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 22: /* dpi-desync-repeats */
|
case 23: /* dpi-desync-repeats */
|
||||||
if (sscanf(optarg,"%u",&dp->desync_repeats)<1 || !dp->desync_repeats || dp->desync_repeats>20)
|
if (sscanf(optarg,"%u",&dp->desync_repeats)<1 || !dp->desync_repeats || dp->desync_repeats>20)
|
||||||
{
|
{
|
||||||
DLOG_ERR("dpi-desync-repeats must be within 1..20\n");
|
DLOG_ERR("dpi-desync-repeats must be within 1..20\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 23: /* dpi-desync-skip-nosni */
|
case 24: /* dpi-desync-skip-nosni */
|
||||||
dp->desync_skip_nosni = !optarg || atoi(optarg);
|
dp->desync_skip_nosni = !optarg || atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 24: /* dpi-desync-split-pos */
|
case 25: /* dpi-desync-split-pos */
|
||||||
{
|
{
|
||||||
int ct;
|
int ct;
|
||||||
if (!parse_split_pos_list(optarg,dp->splits+dp->split_count,MAX_SPLITS-dp->split_count,&ct))
|
if (!parse_split_pos_list(optarg,dp->splits+dp->split_count,MAX_SPLITS-dp->split_count,&ct))
|
||||||
@@ -1642,7 +1653,7 @@ int main(int argc, char **argv)
|
|||||||
dp->split_count += ct;
|
dp->split_count += ct;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 25: /* dpi-desync-split-http-req */
|
case 26: /* dpi-desync-split-http-req */
|
||||||
// obsolete arg
|
// obsolete arg
|
||||||
DLOG_CONDUP("WARNING ! --dpi-desync-split-http-req is deprecated. use --dpi-desync-split-pos with markers.\n",MAX_SPLITS);
|
DLOG_CONDUP("WARNING ! --dpi-desync-split-http-req is deprecated. use --dpi-desync-split-pos with markers.\n",MAX_SPLITS);
|
||||||
if (dp->split_count>=MAX_SPLITS)
|
if (dp->split_count>=MAX_SPLITS)
|
||||||
@@ -1657,7 +1668,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
dp->split_count++;
|
dp->split_count++;
|
||||||
break;
|
break;
|
||||||
case 26: /* dpi-desync-split-tls */
|
case 27: /* dpi-desync-split-tls */
|
||||||
// obsolete arg
|
// obsolete arg
|
||||||
DLOG_CONDUP("WARNING ! --dpi-desync-split-tls is deprecated. use --dpi-desync-split-pos with markers.\n",MAX_SPLITS);
|
DLOG_CONDUP("WARNING ! --dpi-desync-split-tls is deprecated. use --dpi-desync-split-pos with markers.\n",MAX_SPLITS);
|
||||||
if (dp->split_count>=MAX_SPLITS)
|
if (dp->split_count>=MAX_SPLITS)
|
||||||
@@ -1672,7 +1683,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
dp->split_count++;
|
dp->split_count++;
|
||||||
break;
|
break;
|
||||||
case 27: /* dpi-desync-split-seqovl */
|
case 28: /* dpi-desync-split-seqovl */
|
||||||
if (!strcmp(optarg,"0"))
|
if (!strcmp(optarg,"0"))
|
||||||
{
|
{
|
||||||
// allow zero = disable seqovl
|
// allow zero = disable seqovl
|
||||||
@@ -1685,7 +1696,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 28: /* dpi-desync-split-seqovl-pattern */
|
case 29: /* dpi-desync-split-seqovl-pattern */
|
||||||
{
|
{
|
||||||
char buf[sizeof(dp->seqovl_pattern)];
|
char buf[sizeof(dp->seqovl_pattern)];
|
||||||
size_t sz=sizeof(buf);
|
size_t sz=sizeof(buf);
|
||||||
@@ -1693,7 +1704,15 @@ int main(int argc, char **argv)
|
|||||||
fill_pattern(dp->seqovl_pattern,sizeof(dp->seqovl_pattern),buf,sz);
|
fill_pattern(dp->seqovl_pattern,sizeof(dp->seqovl_pattern),buf,sz);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 29: /* dpi-desync-ipfrag-pos-tcp */
|
case 30: /* dpi-desync-fakedsplit-pattern */
|
||||||
|
{
|
||||||
|
char buf[sizeof(dp->fsplit_pattern)];
|
||||||
|
size_t sz=sizeof(buf);
|
||||||
|
load_file_or_exit(optarg,buf,&sz);
|
||||||
|
fill_pattern(dp->fsplit_pattern,sizeof(dp->fsplit_pattern),buf,sz);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 31: /* dpi-desync-ipfrag-pos-tcp */
|
||||||
if (sscanf(optarg,"%u",&dp->desync_ipfrag_pos_tcp)<1 || dp->desync_ipfrag_pos_tcp<1 || dp->desync_ipfrag_pos_tcp>DPI_DESYNC_MAX_FAKE_LEN)
|
if (sscanf(optarg,"%u",&dp->desync_ipfrag_pos_tcp)<1 || dp->desync_ipfrag_pos_tcp<1 || dp->desync_ipfrag_pos_tcp>DPI_DESYNC_MAX_FAKE_LEN)
|
||||||
{
|
{
|
||||||
DLOG_ERR("dpi-desync-ipfrag-pos-tcp must be within 1..%u range\n",DPI_DESYNC_MAX_FAKE_LEN);
|
DLOG_ERR("dpi-desync-ipfrag-pos-tcp must be within 1..%u range\n",DPI_DESYNC_MAX_FAKE_LEN);
|
||||||
@@ -1705,7 +1724,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 30: /* dpi-desync-ipfrag-pos-udp */
|
case 32: /* dpi-desync-ipfrag-pos-udp */
|
||||||
if (sscanf(optarg,"%u",&dp->desync_ipfrag_pos_udp)<1 || dp->desync_ipfrag_pos_udp<1 || dp->desync_ipfrag_pos_udp>DPI_DESYNC_MAX_FAKE_LEN)
|
if (sscanf(optarg,"%u",&dp->desync_ipfrag_pos_udp)<1 || dp->desync_ipfrag_pos_udp<1 || dp->desync_ipfrag_pos_udp>DPI_DESYNC_MAX_FAKE_LEN)
|
||||||
{
|
{
|
||||||
DLOG_ERR("dpi-desync-ipfrag-pos-udp must be within 1..%u range\n",DPI_DESYNC_MAX_FAKE_LEN);
|
DLOG_ERR("dpi-desync-ipfrag-pos-udp must be within 1..%u range\n",DPI_DESYNC_MAX_FAKE_LEN);
|
||||||
@@ -1717,63 +1736,63 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 31: /* dpi-desync-badseq-increments */
|
case 33: /* dpi-desync-badseq-increments */
|
||||||
if (!parse_badseq_increment(optarg,&dp->desync_badseq_increment))
|
if (!parse_badseq_increment(optarg,&dp->desync_badseq_increment))
|
||||||
{
|
{
|
||||||
DLOG_ERR("dpi-desync-badseq-increment should be signed decimal or signed 0xHEX\n");
|
DLOG_ERR("dpi-desync-badseq-increment should be signed decimal or signed 0xHEX\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 32: /* dpi-desync-badack-increment */
|
case 34: /* dpi-desync-badack-increment */
|
||||||
if (!parse_badseq_increment(optarg,&dp->desync_badseq_ack_increment))
|
if (!parse_badseq_increment(optarg,&dp->desync_badseq_ack_increment))
|
||||||
{
|
{
|
||||||
DLOG_ERR("dpi-desync-badack-increment should be signed decimal or signed 0xHEX\n");
|
DLOG_ERR("dpi-desync-badack-increment should be signed decimal or signed 0xHEX\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 33: /* dpi-desync-any-protocol */
|
case 35: /* dpi-desync-any-protocol */
|
||||||
dp->desync_any_proto = !optarg || atoi(optarg);
|
dp->desync_any_proto = !optarg || atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 34: /* dpi-desync-fake-http */
|
case 36: /* dpi-desync-fake-http */
|
||||||
dp->fake_http_size = sizeof(dp->fake_http);
|
dp->fake_http_size = sizeof(dp->fake_http);
|
||||||
load_file_or_exit(optarg,dp->fake_http,&dp->fake_http_size);
|
load_file_or_exit(optarg,dp->fake_http,&dp->fake_http_size);
|
||||||
break;
|
break;
|
||||||
case 35: /* dpi-desync-fake-tls */
|
case 37: /* dpi-desync-fake-tls */
|
||||||
dp->fake_tls_size = sizeof(dp->fake_tls);
|
dp->fake_tls_size = sizeof(dp->fake_tls);
|
||||||
load_file_or_exit(optarg,dp->fake_tls,&dp->fake_tls_size);
|
load_file_or_exit(optarg,dp->fake_tls,&dp->fake_tls_size);
|
||||||
break;
|
break;
|
||||||
case 36: /* dpi-desync-fake-unknown */
|
case 38: /* dpi-desync-fake-unknown */
|
||||||
dp->fake_unknown_size = sizeof(dp->fake_unknown);
|
dp->fake_unknown_size = sizeof(dp->fake_unknown);
|
||||||
load_file_or_exit(optarg,dp->fake_unknown,&dp->fake_unknown_size);
|
load_file_or_exit(optarg,dp->fake_unknown,&dp->fake_unknown_size);
|
||||||
break;
|
break;
|
||||||
case 37: /* dpi-desync-fake-syndata */
|
case 39: /* dpi-desync-fake-syndata */
|
||||||
dp->fake_syndata_size = sizeof(dp->fake_syndata);
|
dp->fake_syndata_size = sizeof(dp->fake_syndata);
|
||||||
load_file_or_exit(optarg,dp->fake_syndata,&dp->fake_syndata_size);
|
load_file_or_exit(optarg,dp->fake_syndata,&dp->fake_syndata_size);
|
||||||
break;
|
break;
|
||||||
case 38: /* dpi-desync-fake-quic */
|
case 40: /* dpi-desync-fake-quic */
|
||||||
dp->fake_quic_size = sizeof(dp->fake_quic);
|
dp->fake_quic_size = sizeof(dp->fake_quic);
|
||||||
load_file_or_exit(optarg,dp->fake_quic,&dp->fake_quic_size);
|
load_file_or_exit(optarg,dp->fake_quic,&dp->fake_quic_size);
|
||||||
break;
|
break;
|
||||||
case 39: /* dpi-desync-fake-wireguard */
|
case 41: /* dpi-desync-fake-wireguard */
|
||||||
dp->fake_wg_size = sizeof(dp->fake_wg);
|
dp->fake_wg_size = sizeof(dp->fake_wg);
|
||||||
load_file_or_exit(optarg,dp->fake_wg,&dp->fake_wg_size);
|
load_file_or_exit(optarg,dp->fake_wg,&dp->fake_wg_size);
|
||||||
break;
|
break;
|
||||||
case 40: /* dpi-desync-fake-dht */
|
case 42: /* dpi-desync-fake-dht */
|
||||||
dp->fake_dht_size = sizeof(dp->fake_dht);
|
dp->fake_dht_size = sizeof(dp->fake_dht);
|
||||||
load_file_or_exit(optarg,dp->fake_dht,&dp->fake_dht_size);
|
load_file_or_exit(optarg,dp->fake_dht,&dp->fake_dht_size);
|
||||||
break;
|
break;
|
||||||
case 41: /* dpi-desync-fake-unknown-udp */
|
case 43: /* dpi-desync-fake-unknown-udp */
|
||||||
dp->fake_unknown_udp_size = sizeof(dp->fake_unknown_udp);
|
dp->fake_unknown_udp_size = sizeof(dp->fake_unknown_udp);
|
||||||
load_file_or_exit(optarg,dp->fake_unknown_udp,&dp->fake_unknown_udp_size);
|
load_file_or_exit(optarg,dp->fake_unknown_udp,&dp->fake_unknown_udp_size);
|
||||||
break;
|
break;
|
||||||
case 42: /* dpi-desync-udplen-increment */
|
case 44: /* dpi-desync-udplen-increment */
|
||||||
if (sscanf(optarg,"%d",&dp->udplen_increment)<1 || dp->udplen_increment>0x7FFF || dp->udplen_increment<-0x8000)
|
if (sscanf(optarg,"%d",&dp->udplen_increment)<1 || dp->udplen_increment>0x7FFF || dp->udplen_increment<-0x8000)
|
||||||
{
|
{
|
||||||
DLOG_ERR("dpi-desync-udplen-increment must be integer within -32768..32767 range\n");
|
DLOG_ERR("dpi-desync-udplen-increment must be integer within -32768..32767 range\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 43: /* dpi-desync-udplen-pattern */
|
case 45: /* dpi-desync-udplen-pattern */
|
||||||
{
|
{
|
||||||
char buf[sizeof(dp->udplen_pattern)];
|
char buf[sizeof(dp->udplen_pattern)];
|
||||||
size_t sz=sizeof(buf);
|
size_t sz=sizeof(buf);
|
||||||
@@ -1781,21 +1800,21 @@ int main(int argc, char **argv)
|
|||||||
fill_pattern(dp->udplen_pattern,sizeof(dp->udplen_pattern),buf,sz);
|
fill_pattern(dp->udplen_pattern,sizeof(dp->udplen_pattern),buf,sz);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 44: /* desync-cutoff */
|
case 46: /* desync-cutoff */
|
||||||
if (!parse_cutoff(optarg, &dp->desync_cutoff, &dp->desync_cutoff_mode))
|
if (!parse_cutoff(optarg, &dp->desync_cutoff, &dp->desync_cutoff_mode))
|
||||||
{
|
{
|
||||||
DLOG_ERR("invalid desync-cutoff value\n");
|
DLOG_ERR("invalid desync-cutoff value\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 45: /* desync-start */
|
case 47: /* desync-start */
|
||||||
if (!parse_cutoff(optarg, &dp->desync_start, &dp->desync_start_mode))
|
if (!parse_cutoff(optarg, &dp->desync_start, &dp->desync_start_mode))
|
||||||
{
|
{
|
||||||
DLOG_ERR("invalid desync-start value\n");
|
DLOG_ERR("invalid desync-start value\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 46: /* hostlist */
|
case 48: /* hostlist */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!RegisterHostlist(dp, false, optarg))
|
if (!RegisterHostlist(dp, false, optarg))
|
||||||
{
|
{
|
||||||
@@ -1803,7 +1822,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 47: /* hostlist-domains */
|
case 49: /* hostlist-domains */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!anon_hl && !(anon_hl=RegisterHostlist(dp, false, NULL)))
|
if (!anon_hl && !(anon_hl=RegisterHostlist(dp, false, NULL)))
|
||||||
{
|
{
|
||||||
@@ -1816,7 +1835,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 48: /* hostlist-exclude */
|
case 50: /* hostlist-exclude */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!RegisterHostlist(dp, true, optarg))
|
if (!RegisterHostlist(dp, true, optarg))
|
||||||
{
|
{
|
||||||
@@ -1824,7 +1843,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 49: /* hostlist-exclude-domains */
|
case 51: /* hostlist-exclude-domains */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!anon_hl_exclude && !(anon_hl_exclude=RegisterHostlist(dp, true, NULL)))
|
if (!anon_hl_exclude && !(anon_hl_exclude=RegisterHostlist(dp, true, NULL)))
|
||||||
{
|
{
|
||||||
@@ -1837,7 +1856,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 50: /* hostlist-auto */
|
case 52: /* hostlist-auto */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (dp->hostlist_auto)
|
if (dp->hostlist_auto)
|
||||||
{
|
{
|
||||||
@@ -1865,7 +1884,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 51: /* hostlist-auto-fail-threshold */
|
case 53: /* hostlist-auto-fail-threshold */
|
||||||
dp->hostlist_auto_fail_threshold = (uint8_t)atoi(optarg);
|
dp->hostlist_auto_fail_threshold = (uint8_t)atoi(optarg);
|
||||||
if (dp->hostlist_auto_fail_threshold<1 || dp->hostlist_auto_fail_threshold>20)
|
if (dp->hostlist_auto_fail_threshold<1 || dp->hostlist_auto_fail_threshold>20)
|
||||||
{
|
{
|
||||||
@@ -1873,7 +1892,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 52: /* hostlist-auto-fail-time */
|
case 54: /* hostlist-auto-fail-time */
|
||||||
dp->hostlist_auto_fail_time = (uint8_t)atoi(optarg);
|
dp->hostlist_auto_fail_time = (uint8_t)atoi(optarg);
|
||||||
if (dp->hostlist_auto_fail_time<1)
|
if (dp->hostlist_auto_fail_time<1)
|
||||||
{
|
{
|
||||||
@@ -1881,7 +1900,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 53: /* hostlist-auto-retrans-threshold */
|
case 55: /* hostlist-auto-retrans-threshold */
|
||||||
dp->hostlist_auto_retrans_threshold = (uint8_t)atoi(optarg);
|
dp->hostlist_auto_retrans_threshold = (uint8_t)atoi(optarg);
|
||||||
if (dp->hostlist_auto_retrans_threshold<2 || dp->hostlist_auto_retrans_threshold>10)
|
if (dp->hostlist_auto_retrans_threshold<2 || dp->hostlist_auto_retrans_threshold>10)
|
||||||
{
|
{
|
||||||
@@ -1889,7 +1908,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 54: /* hostlist-auto-debug */
|
case 56: /* hostlist-auto-debug */
|
||||||
{
|
{
|
||||||
FILE *F = fopen(optarg,"a+t");
|
FILE *F = fopen(optarg,"a+t");
|
||||||
if (!F)
|
if (!F)
|
||||||
@@ -1903,7 +1922,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 55: /* new */
|
case 57: /* new */
|
||||||
if (bSkip)
|
if (bSkip)
|
||||||
{
|
{
|
||||||
dp_clear(dp);
|
dp_clear(dp);
|
||||||
@@ -1924,18 +1943,18 @@ int main(int argc, char **argv)
|
|||||||
anon_hl = anon_hl_exclude = NULL;
|
anon_hl = anon_hl_exclude = NULL;
|
||||||
anon_ips = anon_ips_exclude = NULL;
|
anon_ips = anon_ips_exclude = NULL;
|
||||||
break;
|
break;
|
||||||
case 56: /* skip */
|
case 58: /* skip */
|
||||||
bSkip = true;
|
bSkip = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 57: /* filter-l3 */
|
case 59: /* filter-l3 */
|
||||||
if (!wf_make_l3(optarg,&dp->filter_ipv4,&dp->filter_ipv6))
|
if (!wf_make_l3(optarg,&dp->filter_ipv4,&dp->filter_ipv6))
|
||||||
{
|
{
|
||||||
DLOG_ERR("bad value for --filter-l3\n");
|
DLOG_ERR("bad value for --filter-l3\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 58: /* filter-tcp */
|
case 60: /* filter-tcp */
|
||||||
if (!parse_pf_list(optarg,&dp->pf_tcp))
|
if (!parse_pf_list(optarg,&dp->pf_tcp))
|
||||||
{
|
{
|
||||||
DLOG_ERR("Invalid port filter : %s\n",optarg);
|
DLOG_ERR("Invalid port filter : %s\n",optarg);
|
||||||
@@ -1945,7 +1964,7 @@ int main(int argc, char **argv)
|
|||||||
if (!port_filters_deny_if_empty(&dp->pf_udp))
|
if (!port_filters_deny_if_empty(&dp->pf_udp))
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
break;
|
break;
|
||||||
case 59: /* filter-udp */
|
case 61: /* filter-udp */
|
||||||
if (!parse_pf_list(optarg,&dp->pf_udp))
|
if (!parse_pf_list(optarg,&dp->pf_udp))
|
||||||
{
|
{
|
||||||
DLOG_ERR("Invalid port filter : %s\n",optarg);
|
DLOG_ERR("Invalid port filter : %s\n",optarg);
|
||||||
@@ -1955,14 +1974,14 @@ int main(int argc, char **argv)
|
|||||||
if (!port_filters_deny_if_empty(&dp->pf_tcp))
|
if (!port_filters_deny_if_empty(&dp->pf_tcp))
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
break;
|
break;
|
||||||
case 60: /* filter-l7 */
|
case 62: /* filter-l7 */
|
||||||
if (!parse_l7_list(optarg,&dp->filter_l7))
|
if (!parse_l7_list(optarg,&dp->filter_l7))
|
||||||
{
|
{
|
||||||
DLOG_ERR("Invalid l7 filter : %s\n",optarg);
|
DLOG_ERR("Invalid l7 filter : %s\n",optarg);
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 61: /* ipset */
|
case 63: /* ipset */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!RegisterIpset(dp, false, optarg))
|
if (!RegisterIpset(dp, false, optarg))
|
||||||
{
|
{
|
||||||
@@ -1970,7 +1989,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 62: /* ipset-ip */
|
case 64: /* ipset-ip */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!anon_ips && !(anon_ips=RegisterIpset(dp, false, NULL)))
|
if (!anon_ips && !(anon_ips=RegisterIpset(dp, false, NULL)))
|
||||||
{
|
{
|
||||||
@@ -1983,7 +2002,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 63: /* ipset-exclude */
|
case 65: /* ipset-exclude */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!RegisterIpset(dp, true, optarg))
|
if (!RegisterIpset(dp, true, optarg))
|
||||||
{
|
{
|
||||||
@@ -1991,7 +2010,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 64: /* ipset-exclude-ip */
|
case 66: /* ipset-exclude-ip */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!anon_ips_exclude && !(anon_ips_exclude=RegisterIpset(dp, true, NULL)))
|
if (!anon_ips_exclude && !(anon_ips_exclude=RegisterIpset(dp, true, NULL)))
|
||||||
{
|
{
|
||||||
@@ -2007,28 +2026,28 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
case 65: /* bind-fix4 */
|
case 67: /* bind-fix4 */
|
||||||
params.bind_fix4 = true;
|
params.bind_fix4 = true;
|
||||||
break;
|
break;
|
||||||
case 66: /* bind-fix6 */
|
case 68: /* bind-fix6 */
|
||||||
params.bind_fix6 = true;
|
params.bind_fix6 = true;
|
||||||
break;
|
break;
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
case 65: /* wf-iface */
|
case 67: /* wf-iface */
|
||||||
if (!sscanf(optarg,"%u.%u",&IfIdx,&SubIfIdx))
|
if (!sscanf(optarg,"%u.%u",&IfIdx,&SubIfIdx))
|
||||||
{
|
{
|
||||||
DLOG_ERR("bad value for --wf-iface\n");
|
DLOG_ERR("bad value for --wf-iface\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 66: /* wf-l3 */
|
case 68: /* wf-l3 */
|
||||||
if (!wf_make_l3(optarg,&wf_ipv4,&wf_ipv6))
|
if (!wf_make_l3(optarg,&wf_ipv4,&wf_ipv6))
|
||||||
{
|
{
|
||||||
DLOG_ERR("bad value for --wf-l3\n");
|
DLOG_ERR("bad value for --wf-l3\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 67: /* wf-tcp */
|
case 69: /* wf-tcp */
|
||||||
hash_wf_tcp=hash_jen(optarg,strlen(optarg));
|
hash_wf_tcp=hash_jen(optarg,strlen(optarg));
|
||||||
if (!wf_make_pf(optarg,"tcp","SrcPort",wf_pf_tcp_src,sizeof(wf_pf_tcp_src)) ||
|
if (!wf_make_pf(optarg,"tcp","SrcPort",wf_pf_tcp_src,sizeof(wf_pf_tcp_src)) ||
|
||||||
!wf_make_pf(optarg,"tcp","DstPort",wf_pf_tcp_dst,sizeof(wf_pf_tcp_dst)))
|
!wf_make_pf(optarg,"tcp","DstPort",wf_pf_tcp_dst,sizeof(wf_pf_tcp_dst)))
|
||||||
@@ -2037,7 +2056,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 68: /* wf-udp */
|
case 70: /* wf-udp */
|
||||||
hash_wf_udp=hash_jen(optarg,strlen(optarg));
|
hash_wf_udp=hash_jen(optarg,strlen(optarg));
|
||||||
if (!wf_make_pf(optarg,"udp","SrcPort",wf_pf_udp_src,sizeof(wf_pf_udp_src)) ||
|
if (!wf_make_pf(optarg,"udp","SrcPort",wf_pf_udp_src,sizeof(wf_pf_udp_src)) ||
|
||||||
!wf_make_pf(optarg,"udp","DstPort",wf_pf_udp_dst,sizeof(wf_pf_udp_dst)))
|
!wf_make_pf(optarg,"udp","DstPort",wf_pf_udp_dst,sizeof(wf_pf_udp_dst)))
|
||||||
@@ -2046,7 +2065,7 @@ int main(int argc, char **argv)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 69: /* wf-raw */
|
case 71: /* wf-raw */
|
||||||
hash_wf_raw=hash_jen(optarg,strlen(optarg));
|
hash_wf_raw=hash_jen(optarg,strlen(optarg));
|
||||||
if (optarg[0]=='@')
|
if (optarg[0]=='@')
|
||||||
{
|
{
|
||||||
@@ -2060,11 +2079,11 @@ int main(int argc, char **argv)
|
|||||||
windivert_filter[sizeof(windivert_filter) - 1] = '\0';
|
windivert_filter[sizeof(windivert_filter) - 1] = '\0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 70: /* wf-save */
|
case 72: /* wf-save */
|
||||||
strncpy(wf_save_file, optarg, sizeof(wf_save_file));
|
strncpy(wf_save_file, optarg, sizeof(wf_save_file));
|
||||||
wf_save_file[sizeof(wf_save_file) - 1] = '\0';
|
wf_save_file[sizeof(wf_save_file) - 1] = '\0';
|
||||||
break;
|
break;
|
||||||
case 71: /* ssid-filter */
|
case 73: /* ssid-filter */
|
||||||
hash_ssid_filter=hash_jen(optarg,strlen(optarg));
|
hash_ssid_filter=hash_jen(optarg,strlen(optarg));
|
||||||
{
|
{
|
||||||
char *e,*p = optarg;
|
char *e,*p = optarg;
|
||||||
@@ -2082,7 +2101,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 72: /* nlm-filter */
|
case 74: /* nlm-filter */
|
||||||
hash_nlm_filter=hash_jen(optarg,strlen(optarg));
|
hash_nlm_filter=hash_jen(optarg,strlen(optarg));
|
||||||
{
|
{
|
||||||
char *e,*p = optarg;
|
char *e,*p = optarg;
|
||||||
@@ -2100,7 +2119,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 73: /* nlm-list */
|
case 75: /* nlm-list */
|
||||||
if (!nlm_list(optarg && !strcmp(optarg,"all")))
|
if (!nlm_list(optarg && !strcmp(optarg,"all")))
|
||||||
{
|
{
|
||||||
DLOG_ERR("could not get list of NLM networks\n");
|
DLOG_ERR("could not get list of NLM networks\n");
|
||||||
@@ -2232,6 +2251,12 @@ int main(int argc, char **argv)
|
|||||||
SplitDebug();
|
SplitDebug();
|
||||||
DLOG("\n");
|
DLOG("\n");
|
||||||
|
|
||||||
|
if (bDry)
|
||||||
|
{
|
||||||
|
DLOG_CONDUP("command line parameters verified\n");
|
||||||
|
exit_clean(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (daemon) daemonize();
|
if (daemon) daemonize();
|
||||||
|
|
||||||
if (*pidfile && !writepid(pidfile))
|
if (*pidfile && !writepid(pidfile))
|
||||||
|
@@ -68,7 +68,7 @@ struct desync_profile
|
|||||||
autottl desync_autottl, desync_autottl6;
|
autottl desync_autottl, desync_autottl6;
|
||||||
uint32_t desync_fooling_mode;
|
uint32_t desync_fooling_mode;
|
||||||
uint32_t desync_badseq_increment, desync_badseq_ack_increment;
|
uint32_t desync_badseq_increment, desync_badseq_ack_increment;
|
||||||
uint8_t fake_http[1460],fake_tls[1460],fake_unknown[1460],fake_syndata[1460],seqovl_pattern[1460];
|
uint8_t fake_http[1460],fake_tls[1460],fake_unknown[1460],fake_syndata[1460],seqovl_pattern[1460],fsplit_pattern[1460];
|
||||||
uint8_t fake_unknown_udp[1472],udplen_pattern[1472],fake_quic[1472],fake_wg[1472],fake_dht[1472];
|
uint8_t fake_unknown_udp[1472],udplen_pattern[1472],fake_quic[1472],fake_wg[1472],fake_dht[1472];
|
||||||
size_t fake_http_size,fake_tls_size,fake_quic_size,fake_wg_size,fake_dht_size,fake_unknown_size,fake_syndata_size,fake_unknown_udp_size;
|
size_t fake_http_size,fake_tls_size,fake_quic_size,fake_wg_size,fake_dht_size,fake_unknown_size,fake_syndata_size,fake_unknown_udp_size;
|
||||||
int udplen_increment;
|
int udplen_increment;
|
||||||
|
126
tpws/tpws.c
126
tpws/tpws.c
@@ -175,6 +175,7 @@ static void exithelp(void)
|
|||||||
#endif
|
#endif
|
||||||
" --debug=0|1|2|syslog|@<filename>\t; 1 and 2 means log to console and set debug level. for other targets use --debug-level.\n"
|
" --debug=0|1|2|syslog|@<filename>\t; 1 and 2 means log to console and set debug level. for other targets use --debug-level.\n"
|
||||||
" --debug-level=0|1|2\t\t\t; specify debug level\n"
|
" --debug-level=0|1|2\t\t\t; specify debug level\n"
|
||||||
|
" --dry-run\t\t\t\t; verify parameters and exit with code 0 if successful\n"
|
||||||
"\nMULTI-STRATEGY:\n"
|
"\nMULTI-STRATEGY:\n"
|
||||||
" --new\t\t\t\t\t; begin new strategy\n"
|
" --new\t\t\t\t\t; begin new strategy\n"
|
||||||
" --skip\t\t\t\t\t; do not use this strategy\n"
|
" --skip\t\t\t\t\t; do not use this strategy\n"
|
||||||
@@ -569,7 +570,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
int v, i;
|
int v, i;
|
||||||
bool bSkip=false;
|
bool bSkip=false, bDry=false;
|
||||||
struct hostlist_file *anon_hl = NULL, *anon_hl_exclude = NULL;
|
struct hostlist_file *anon_hl = NULL, *anon_hl_exclude = NULL;
|
||||||
struct ipset_file *anon_ips = NULL, *anon_ips_exclude = NULL;
|
struct ipset_file *anon_ips = NULL, *anon_ips_exclude = NULL;
|
||||||
|
|
||||||
@@ -667,40 +668,41 @@ void parse_params(int argc, char *argv[])
|
|||||||
{ "pidfile",required_argument,0,0 },// optidx=44
|
{ "pidfile",required_argument,0,0 },// optidx=44
|
||||||
{ "debug",optional_argument,0,0 },// optidx=45
|
{ "debug",optional_argument,0,0 },// optidx=45
|
||||||
{ "debug-level",required_argument,0,0 },// optidx=46
|
{ "debug-level",required_argument,0,0 },// optidx=46
|
||||||
{ "local-rcvbuf",required_argument,0,0 },// optidx=47
|
{ "dry-run",no_argument,0,0 },// optidx=47
|
||||||
{ "local-sndbuf",required_argument,0,0 },// optidx=48
|
{ "local-rcvbuf",required_argument,0,0 },// optidx=48
|
||||||
{ "remote-rcvbuf",required_argument,0,0 },// optidx=49
|
{ "local-sndbuf",required_argument,0,0 },// optidx=49
|
||||||
{ "remote-sndbuf",required_argument,0,0 },// optidx=50
|
{ "remote-rcvbuf",required_argument,0,0 },// optidx=50
|
||||||
{ "socks",no_argument,0,0 },// optidx=51
|
{ "remote-sndbuf",required_argument,0,0 },// optidx=51
|
||||||
{ "no-resolve",no_argument,0,0 },// optidx=52
|
{ "socks",no_argument,0,0 },// optidx=52
|
||||||
{ "resolver-threads",required_argument,0,0 },// optidx=53
|
{ "no-resolve",no_argument,0,0 },// optidx=53
|
||||||
{ "skip-nodelay",no_argument,0,0 },// optidx=54
|
{ "resolver-threads",required_argument,0,0 },// optidx=54
|
||||||
{ "tamper-start",required_argument,0,0 },// optidx=55
|
{ "skip-nodelay",no_argument,0,0 },// optidx=55
|
||||||
{ "tamper-cutoff",required_argument,0,0 },// optidx=56
|
{ "tamper-start",required_argument,0,0 },// optidx=56
|
||||||
{ "connect-bind-addr",required_argument,0,0 },// optidx=57
|
{ "tamper-cutoff",required_argument,0,0 },// optidx=57
|
||||||
|
{ "connect-bind-addr",required_argument,0,0 },// optidx=58
|
||||||
|
|
||||||
{ "new",no_argument,0,0 }, // optidx=58
|
{ "new",no_argument,0,0 }, // optidx=59
|
||||||
{ "skip",no_argument,0,0 }, // optidx=59
|
{ "skip",no_argument,0,0 }, // optidx=60
|
||||||
{ "filter-l3",required_argument,0,0 }, // optidx=60
|
{ "filter-l3",required_argument,0,0 }, // optidx=61
|
||||||
{ "filter-tcp",required_argument,0,0 }, // optidx=61
|
{ "filter-tcp",required_argument,0,0 }, // optidx=63
|
||||||
{ "filter-l7",required_argument,0,0 }, // optidx=62
|
{ "filter-l7",required_argument,0,0 }, // optidx=64
|
||||||
{ "ipset",required_argument,0,0 }, // optidx=63
|
{ "ipset",required_argument,0,0 }, // optidx=65
|
||||||
{ "ipset-ip",required_argument,0,0 }, // optidx=64
|
{ "ipset-ip",required_argument,0,0 }, // optidx=66
|
||||||
{ "ipset-exclude",required_argument,0,0 }, // optidx=65
|
{ "ipset-exclude",required_argument,0,0 }, // optidx=67
|
||||||
{ "ipset-exclude-ip",required_argument,0,0 }, // optidx=66
|
{ "ipset-exclude-ip",required_argument,0,0 }, // optidx=68
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
{ "enable-pf",no_argument,0,0 },// optidx=67
|
{ "enable-pf",no_argument,0,0 },// optidx=68
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
{ "local-tcp-user-timeout",required_argument,0,0 }, // optidx=67
|
{ "local-tcp-user-timeout",required_argument,0,0 }, // optidx=68
|
||||||
{ "remote-tcp-user-timeout",required_argument,0,0 }, // optidx=68
|
{ "remote-tcp-user-timeout",required_argument,0,0 }, // optidx=69
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
{ "local-tcp-user-timeout",required_argument,0,0 }, // optidx=67
|
{ "local-tcp-user-timeout",required_argument,0,0 }, // optidx=68
|
||||||
{ "remote-tcp-user-timeout",required_argument,0,0 }, // optidx=68
|
{ "remote-tcp-user-timeout",required_argument,0,0 }, // optidx=69
|
||||||
{ "mss",required_argument,0,0 }, // optidx=69
|
{ "mss",required_argument,0,0 }, // optidx=70
|
||||||
{ "fix-seg",optional_argument,0,0 }, // optidx=70
|
{ "fix-seg",optional_argument,0,0 }, // optidx=71
|
||||||
#ifdef SPLICE_PRESENT
|
#ifdef SPLICE_PRESENT
|
||||||
{ "nosplice",no_argument,0,0 }, // optidx=71
|
{ "nosplice",no_argument,0,0 }, // optidx=72
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{ "hostlist-auto-retrans-threshold",optional_argument,0,0}, // ignored. for nfqws command line compatibility
|
{ "hostlist-auto-retrans-threshold",optional_argument,0,0}, // ignored. for nfqws command line compatibility
|
||||||
@@ -708,7 +710,11 @@ void parse_params(int argc, char *argv[])
|
|||||||
};
|
};
|
||||||
while ((v = getopt_long_only(argc, argv, "", long_options, &option_index)) != -1)
|
while ((v = getopt_long_only(argc, argv, "", long_options, &option_index)) != -1)
|
||||||
{
|
{
|
||||||
if (v) exithelp_clean();
|
if (v)
|
||||||
|
if (bDry)
|
||||||
|
exit_clean(1);
|
||||||
|
else
|
||||||
|
exithelp_clean();
|
||||||
switch (option_index)
|
switch (option_index)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@@ -1142,41 +1148,44 @@ void parse_params(int argc, char *argv[])
|
|||||||
case 46: /* debug-level */
|
case 46: /* debug-level */
|
||||||
params.debug = atoi(optarg);
|
params.debug = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 47: /* local-rcvbuf */
|
case 47: /* dry-run */
|
||||||
|
bDry = true;
|
||||||
|
break;
|
||||||
|
case 48: /* local-rcvbuf */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
params.local_rcvbuf = atoi(optarg)/2;
|
params.local_rcvbuf = atoi(optarg)/2;
|
||||||
#else
|
#else
|
||||||
params.local_rcvbuf = atoi(optarg);
|
params.local_rcvbuf = atoi(optarg);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 48: /* local-sndbuf */
|
case 49: /* local-sndbuf */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
params.local_sndbuf = atoi(optarg)/2;
|
params.local_sndbuf = atoi(optarg)/2;
|
||||||
#else
|
#else
|
||||||
params.local_sndbuf = atoi(optarg);
|
params.local_sndbuf = atoi(optarg);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 49: /* remote-rcvbuf */
|
case 50: /* remote-rcvbuf */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
params.remote_rcvbuf = atoi(optarg)/2;
|
params.remote_rcvbuf = atoi(optarg)/2;
|
||||||
#else
|
#else
|
||||||
params.remote_rcvbuf = atoi(optarg);
|
params.remote_rcvbuf = atoi(optarg);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 50: /* remote-sndbuf */
|
case 51: /* remote-sndbuf */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
params.remote_sndbuf = atoi(optarg)/2;
|
params.remote_sndbuf = atoi(optarg)/2;
|
||||||
#else
|
#else
|
||||||
params.remote_sndbuf = atoi(optarg);
|
params.remote_sndbuf = atoi(optarg);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 51: /* socks */
|
case 52: /* socks */
|
||||||
params.proxy_type = CONN_TYPE_SOCKS;
|
params.proxy_type = CONN_TYPE_SOCKS;
|
||||||
break;
|
break;
|
||||||
case 52: /* no-resolve */
|
case 53: /* no-resolve */
|
||||||
params.no_resolve = true;
|
params.no_resolve = true;
|
||||||
break;
|
break;
|
||||||
case 53: /* resolver-threads */
|
case 54: /* resolver-threads */
|
||||||
params.resolver_threads = atoi(optarg);
|
params.resolver_threads = atoi(optarg);
|
||||||
if (params.resolver_threads<1 || params.resolver_threads>300)
|
if (params.resolver_threads<1 || params.resolver_threads>300)
|
||||||
{
|
{
|
||||||
@@ -1184,10 +1193,10 @@ void parse_params(int argc, char *argv[])
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 54: /* skip-nodelay */
|
case 55: /* skip-nodelay */
|
||||||
params.skip_nodelay = true;
|
params.skip_nodelay = true;
|
||||||
break;
|
break;
|
||||||
case 55: /* tamper-start */
|
case 56: /* tamper-start */
|
||||||
{
|
{
|
||||||
const char *p=optarg;
|
const char *p=optarg;
|
||||||
if (*p=='n')
|
if (*p=='n')
|
||||||
@@ -1201,7 +1210,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
params.tamper_lim = true;
|
params.tamper_lim = true;
|
||||||
break;
|
break;
|
||||||
case 56: /* tamper-cutoff */
|
case 57: /* tamper-cutoff */
|
||||||
{
|
{
|
||||||
const char *p=optarg;
|
const char *p=optarg;
|
||||||
if (*p=='n')
|
if (*p=='n')
|
||||||
@@ -1215,7 +1224,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
params.tamper_lim = true;
|
params.tamper_lim = true;
|
||||||
break;
|
break;
|
||||||
case 57: /* connect-bind-addr */
|
case 58: /* connect-bind-addr */
|
||||||
{
|
{
|
||||||
char *p = strchr(optarg,'%');
|
char *p = strchr(optarg,'%');
|
||||||
if (p) *p++=0;
|
if (p) *p++=0;
|
||||||
@@ -1243,7 +1252,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 58: /* new */
|
case 59: /* new */
|
||||||
if (bSkip)
|
if (bSkip)
|
||||||
{
|
{
|
||||||
dp_clear(dp);
|
dp_clear(dp);
|
||||||
@@ -1264,31 +1273,31 @@ void parse_params(int argc, char *argv[])
|
|||||||
anon_hl = anon_hl_exclude = NULL;
|
anon_hl = anon_hl_exclude = NULL;
|
||||||
anon_ips = anon_ips_exclude = NULL;
|
anon_ips = anon_ips_exclude = NULL;
|
||||||
break;
|
break;
|
||||||
case 59: /* skip */
|
case 60: /* skip */
|
||||||
bSkip = true;
|
bSkip = true;
|
||||||
break;
|
break;
|
||||||
case 60: /* filter-l3 */
|
case 61: /* filter-l3 */
|
||||||
if (!wf_make_l3(optarg,&dp->filter_ipv4,&dp->filter_ipv6))
|
if (!wf_make_l3(optarg,&dp->filter_ipv4,&dp->filter_ipv6))
|
||||||
{
|
{
|
||||||
DLOG_ERR("bad value for --filter-l3\n");
|
DLOG_ERR("bad value for --filter-l3\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 61: /* filter-tcp */
|
case 62: /* filter-tcp */
|
||||||
if (!parse_pf_list(optarg,&dp->pf_tcp))
|
if (!parse_pf_list(optarg,&dp->pf_tcp))
|
||||||
{
|
{
|
||||||
DLOG_ERR("Invalid port filter : %s\n",optarg);
|
DLOG_ERR("Invalid port filter : %s\n",optarg);
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 62: /* filter-l7 */
|
case 63: /* filter-l7 */
|
||||||
if (!parse_l7_list(optarg,&dp->filter_l7))
|
if (!parse_l7_list(optarg,&dp->filter_l7))
|
||||||
{
|
{
|
||||||
DLOG_ERR("Invalid l7 filter : %s\n",optarg);
|
DLOG_ERR("Invalid l7 filter : %s\n",optarg);
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 63: /* ipset */
|
case 64: /* ipset */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!RegisterIpset(dp, false, optarg))
|
if (!RegisterIpset(dp, false, optarg))
|
||||||
{
|
{
|
||||||
@@ -1297,7 +1306,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
params.tamper = true;
|
params.tamper = true;
|
||||||
break;
|
break;
|
||||||
case 64: /* ipset-ip */
|
case 65: /* ipset-ip */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!anon_ips && !(anon_ips=RegisterIpset(dp, false, NULL)))
|
if (!anon_ips && !(anon_ips=RegisterIpset(dp, false, NULL)))
|
||||||
{
|
{
|
||||||
@@ -1311,7 +1320,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
params.tamper = true;
|
params.tamper = true;
|
||||||
break;
|
break;
|
||||||
case 65: /* ipset-exclude */
|
case 66: /* ipset-exclude */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!RegisterIpset(dp, true, optarg))
|
if (!RegisterIpset(dp, true, optarg))
|
||||||
{
|
{
|
||||||
@@ -1320,7 +1329,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
params.tamper = true;
|
params.tamper = true;
|
||||||
break;
|
break;
|
||||||
case 66: /* ipset-exclude-ip */
|
case 67: /* ipset-exclude-ip */
|
||||||
if (bSkip) break;
|
if (bSkip) break;
|
||||||
if (!anon_ips_exclude && !(anon_ips_exclude=RegisterIpset(dp, true, NULL)))
|
if (!anon_ips_exclude && !(anon_ips_exclude=RegisterIpset(dp, true, NULL)))
|
||||||
{
|
{
|
||||||
@@ -1336,11 +1345,11 @@ void parse_params(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
case 67: /* enable-pf */
|
case 68: /* enable-pf */
|
||||||
params.pf_enable = true;
|
params.pf_enable = true;
|
||||||
break;
|
break;
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
#elif defined(__linux__) || defined(__APPLE__)
|
||||||
case 67: /* local-tcp-user-timeout */
|
case 68: /* local-tcp-user-timeout */
|
||||||
params.tcp_user_timeout_local = atoi(optarg);
|
params.tcp_user_timeout_local = atoi(optarg);
|
||||||
if (params.tcp_user_timeout_local<0 || params.tcp_user_timeout_local>86400)
|
if (params.tcp_user_timeout_local<0 || params.tcp_user_timeout_local>86400)
|
||||||
{
|
{
|
||||||
@@ -1348,7 +1357,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 68: /* remote-tcp-user-timeout */
|
case 69: /* remote-tcp-user-timeout */
|
||||||
params.tcp_user_timeout_remote = atoi(optarg);
|
params.tcp_user_timeout_remote = atoi(optarg);
|
||||||
if (params.tcp_user_timeout_remote<0 || params.tcp_user_timeout_remote>86400)
|
if (params.tcp_user_timeout_remote<0 || params.tcp_user_timeout_remote>86400)
|
||||||
{
|
{
|
||||||
@@ -1359,7 +1368,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
case 69: /* mss */
|
case 70: /* mss */
|
||||||
// this option does not work in any BSD and MacOS. OS may accept but it changes nothing
|
// this option does not work in any BSD and MacOS. OS may accept but it changes nothing
|
||||||
dp->mss = atoi(optarg);
|
dp->mss = atoi(optarg);
|
||||||
if (dp->mss<88 || dp->mss>32767)
|
if (dp->mss<88 || dp->mss>32767)
|
||||||
@@ -1368,7 +1377,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 70: /* fix-seg */
|
case 71: /* fix-seg */
|
||||||
if (!params.fix_seg_avail)
|
if (!params.fix_seg_avail)
|
||||||
{
|
{
|
||||||
DLOG_ERR("--fix-seg is supported since kernel 4.6\n");
|
DLOG_ERR("--fix-seg is supported since kernel 4.6\n");
|
||||||
@@ -1388,7 +1397,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
params.fix_seg = FIX_SEG_DEFAULT_MAX_WAIT;
|
params.fix_seg = FIX_SEG_DEFAULT_MAX_WAIT;
|
||||||
break;
|
break;
|
||||||
#ifdef SPLICE_PRESENT
|
#ifdef SPLICE_PRESENT
|
||||||
case 71: /* nosplice */
|
case 72: /* nosplice */
|
||||||
params.nosplice = true;
|
params.nosplice = true;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -1463,6 +1472,11 @@ void parse_params(int argc, char *argv[])
|
|||||||
// do not need args from file anymore
|
// do not need args from file anymore
|
||||||
cleanup_args();
|
cleanup_args();
|
||||||
#endif
|
#endif
|
||||||
|
if (bDry)
|
||||||
|
{
|
||||||
|
DLOG_CONDUP("command line parameters verified\n");
|
||||||
|
exit_clean(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user