SpoofDPI: remove completely as it becomes useless
This commit is contained in:
@@ -1,31 +0,0 @@
|
|||||||
From 8a370430c7d855a63d15337e9781933f6e55707f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andrey Semenov <semenov.ao@greendatasoft.ru>
|
|
||||||
Date: Thu, 19 Sep 2024 17:32:37 +0500
|
|
||||||
Subject: [PATCH] fix: write to lConn even if any error met and some bytes was
|
|
||||||
read
|
|
||||||
|
|
||||||
---
|
|
||||||
proxy/handler/https.go | 3 +--
|
|
||||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/proxy/handler/https.go b/proxy/handler/https.go
|
|
||||||
index f709925..bc320fd 100644
|
|
||||||
--- a/proxy/handler/https.go
|
|
||||||
+++ b/proxy/handler/https.go
|
|
||||||
@@ -2,7 +2,6 @@ package handler
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
- "errors"
|
|
||||||
"io"
|
|
||||||
"net"
|
|
||||||
"regexp"
|
|
||||||
@@ -134,7 +133,7 @@ func (h *HttpsHandler) communicate(ctx context.Context, from *net.TCPConn, to *n
|
|
||||||
|
|
||||||
bytesRead, err := ReadBytes(ctx, from, buf)
|
|
||||||
if err != nil {
|
|
||||||
- if errors.Is(err, io.EOF) && len(bytesRead) > 0 {
|
|
||||||
+ if len(bytesRead) > 0 {
|
|
||||||
h.write(logger, td, to, bytesRead)
|
|
||||||
}
|
|
||||||
logger.Debug().Msgf("error reading from %s: %s", fd, err)
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
Axel accelerates the HTTP/FTP downloading process by using multiple
|
|
||||||
connections for one file. It can use multiple mirrors for a download.
|
|
||||||
Axel has no dependencies and is lightweight, so it might be useful as a
|
|
||||||
wget clone on byte-critical systems. Axel is the perfect utility for
|
|
||||||
those connections to wherever you are downloading from that may have a
|
|
||||||
limit on ftp stream speeds, http sessions that burst and slow down, or
|
|
||||||
servers with a slow connection.
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Slackware build script for SpoofDPI
|
|
||||||
|
|
||||||
# Copyright 2024 Sergei Fedosoff <eleksir@gmail.com>
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use of this script, with or without modification, is
|
|
||||||
# permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of this script must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
||||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
cd $(dirname $0) ; CWD=$(pwd)
|
|
||||||
|
|
||||||
PRGNAM=SpoofDPI
|
|
||||||
VERSION=${VERSION:-0.12.0}
|
|
||||||
BUILD=${BUILD:-2}
|
|
||||||
TAG=${TAG:-_EXs}
|
|
||||||
PKGTYPE=${PKGTYPE:-tgz}
|
|
||||||
|
|
||||||
if [ -z "$ARCH" ]; then
|
|
||||||
case "$( uname -m )" in
|
|
||||||
i?86) ARCH=i586 ;;
|
|
||||||
arm*) ARCH=arm ;;
|
|
||||||
*) ARCH=$( uname -m ) ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
||||||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
TMP=${TMP:-/tmp/EXs}
|
|
||||||
PKG=$TMP/package-$PRGNAM
|
|
||||||
OUTPUT=${OUTPUT:-/tmp}
|
|
||||||
|
|
||||||
if [ "$ARCH" = "i586" ]; then
|
|
||||||
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
|
||||||
LIBDIRSUFFIX=""
|
|
||||||
elif [ "$ARCH" = "i686" ]; then
|
|
||||||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
|
||||||
LIBDIRSUFFIX=""
|
|
||||||
elif [ "$ARCH" = "x86_64" ]; then
|
|
||||||
SLKCFLAGS="-O2 -fPIC"
|
|
||||||
LIBDIRSUFFIX="64"
|
|
||||||
else
|
|
||||||
SLKCFLAGS="-O2"
|
|
||||||
LIBDIRSUFFIX=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
rm -rf $PKG
|
|
||||||
mkdir -p $TMP $PKG $OUTPUT
|
|
||||||
cd $TMP
|
|
||||||
rm -rf $PRGNAM-$VERSION
|
|
||||||
tar xf $CWD/$PRGNAM-$VERSION.tar.gz
|
|
||||||
cd $PRGNAM-$VERSION
|
|
||||||
chown -R root:root .
|
|
||||||
find -L . \
|
|
||||||
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
||||||
-exec chmod 755 {} \+ -o \
|
|
||||||
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
||||||
-exec chmod 644 {} \+
|
|
||||||
|
|
||||||
patch -p1 -i $CWD/a12a13eb4b347899b18cf8df57cc423e55313e2a.patch
|
|
||||||
patch -p1 -i $CWD/8a370430c7d855a63d15337e9781933f6e55707f.patch
|
|
||||||
|
|
||||||
CGO_ENABLED=0 go build -ldflags '-w -s -extldflags "-static"' -trimpath -tags timetzdata -o spoofdpi ./cmd/spoofdpi
|
|
||||||
|
|
||||||
install -Dpm 0755 spoofdpi $PKG/usr/sbin/spoofdpi
|
|
||||||
install -Dpm 0644 $CWD/rc.spoofdpi $PKG/etc/rc.d/rc.spoofdpi.new
|
|
||||||
install -Dpm 0644 $CWD/spoofdpi.sysconfig $PKG/etc/default/spoofdpi.new
|
|
||||||
install -Ddm 0755 $PKG/usr/doc/$PRGNAM-$VERSION
|
|
||||||
install -Dpm 0644 LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION
|
|
||||||
install -Dpm 0644 $CWD/$PRGNAM.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
||||||
install -Dpm 0644 $CWD/slack-desc $PKG/install/slack-desc
|
|
||||||
install -Dpm 0644 $CWD/doinst.sh $PKG/install/doinst.sh
|
|
||||||
|
|
||||||
cd $PKG
|
|
||||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
PRGNAM="SpoofDPI"
|
|
||||||
VERSION="0.12.0"
|
|
||||||
HOMEPAGE="https://github.com/xvzc/SpoofDPI"
|
|
||||||
DOWNLOAD="https://github.com/xvzc/SpoofDPI/archive/refs/tags/v0.12.0/SpoofDPI-0.12.0.tar.gz"
|
|
||||||
MD5SUM="d43ae5a52c3adf6825bc94775ee88f7f"
|
|
||||||
DOWNLOAD_x86_64=""
|
|
||||||
MD5SUM_x86_64=""
|
|
||||||
REQUIRES=""
|
|
||||||
BUILDREQUIRES="google-go-lang"
|
|
||||||
MAINTAINER="Sergei Fedosoff"
|
|
||||||
EMAIL="eleksir@gmail.com"
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
From a12a13eb4b347899b18cf8df57cc423e55313e2a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andrey Semenov <semenov.ao@greendatasoft.ru>
|
|
||||||
Date: Thu, 19 Sep 2024 17:21:03 +0500
|
|
||||||
Subject: [PATCH] fix: write to lConn even if io.EOF met and some bytes was
|
|
||||||
read
|
|
||||||
|
|
||||||
---
|
|
||||||
proxy/handler/https.go | 58 ++++++++++++++++++++++++++++++++----------
|
|
||||||
1 file changed, 45 insertions(+), 13 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/proxy/handler/https.go b/proxy/handler/https.go
|
|
||||||
index 857fead..f709925 100644
|
|
||||||
--- a/proxy/handler/https.go
|
|
||||||
+++ b/proxy/handler/https.go
|
|
||||||
@@ -2,10 +2,14 @@ package handler
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
+ "errors"
|
|
||||||
+ "io"
|
|
||||||
"net"
|
|
||||||
"regexp"
|
|
||||||
"strconv"
|
|
||||||
+ "sync"
|
|
||||||
|
|
||||||
+ "github.com/rs/zerolog"
|
|
||||||
"github.com/xvzc/SpoofDPI/packet"
|
|
||||||
"github.com/xvzc/SpoofDPI/util"
|
|
||||||
"github.com/xvzc/SpoofDPI/util/log"
|
|
||||||
@@ -74,36 +78,53 @@ func (h *HttpsHandler) Serve(ctx context.Context, lConn *net.TCPConn, initPkt *p
|
|
||||||
logger.Debug().Msgf("client sent hello %d bytes", len(clientHello))
|
|
||||||
|
|
||||||
// Generate a go routine that reads from the server
|
|
||||||
- go h.communicate(ctx, rConn, lConn, initPkt.Domain(), lConn.RemoteAddr().String())
|
|
||||||
- go h.communicate(ctx, lConn, rConn, lConn.RemoteAddr().String(), initPkt.Domain())
|
|
||||||
+ closeWg := sync.WaitGroup{}
|
|
||||||
+ closeWg.Add(2)
|
|
||||||
+ done := make(chan struct{})
|
|
||||||
+ doneOnce := sync.Once{}
|
|
||||||
+ closeDoneFunc := func() {
|
|
||||||
+ close(done)
|
|
||||||
+ }
|
|
||||||
+ go func() {
|
|
||||||
+ defer closeWg.Done()
|
|
||||||
+ h.communicate(ctx, rConn, lConn, initPkt.Domain(), lConn.RemoteAddr().String())
|
|
||||||
+ }()
|
|
||||||
+ go func() {
|
|
||||||
+ defer closeWg.Done()
|
|
||||||
+ h.communicate(ctx, lConn, rConn, lConn.RemoteAddr().String(), initPkt.Domain())
|
|
||||||
+ }()
|
|
||||||
+ go func(wg *sync.WaitGroup) {
|
|
||||||
+ wg.Wait()
|
|
||||||
+ doneOnce.Do(closeDoneFunc)
|
|
||||||
+ }(&closeWg)
|
|
||||||
|
|
||||||
if h.exploit {
|
|
||||||
logger.Debug().Msgf("writing chunked client hello to %s", initPkt.Domain())
|
|
||||||
chunks := splitInChunks(ctx, clientHello, h.windowsize)
|
|
||||||
if _, err := writeChunks(rConn, chunks); err != nil {
|
|
||||||
logger.Debug().Msgf("error writing chunked client hello to %s: %s", initPkt.Domain(), err)
|
|
||||||
- return
|
|
||||||
+ doneOnce.Do(closeDoneFunc)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.Debug().Msgf("writing plain client hello to %s", initPkt.Domain())
|
|
||||||
if _, err := rConn.Write(clientHello); err != nil {
|
|
||||||
logger.Debug().Msgf("error writing plain client hello to %s: %s", initPkt.Domain(), err)
|
|
||||||
- return
|
|
||||||
+ doneOnce.Do(closeDoneFunc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ // wait while conn handling routines stop, then close both connections
|
|
||||||
+ // current routine will sleep until conn handling routines works
|
|
||||||
+ <-done
|
|
||||||
+ _ = lConn.Close()
|
|
||||||
+ _ = rConn.Close()
|
|
||||||
+
|
|
||||||
+ logger.Debug().Msgf("closing proxy connection: %s -> %s", lConn.RemoteAddr(), initPkt.Domain())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HttpsHandler) communicate(ctx context.Context, from *net.TCPConn, to *net.TCPConn, fd string, td string) {
|
|
||||||
ctx = util.GetCtxWithScope(ctx, h.protocol)
|
|
||||||
logger := log.GetCtxLogger(ctx)
|
|
||||||
|
|
||||||
- defer func() {
|
|
||||||
- from.Close()
|
|
||||||
- to.Close()
|
|
||||||
-
|
|
||||||
- logger.Debug().Msgf("closing proxy connection: %s -> %s", fd, td)
|
|
||||||
- }()
|
|
||||||
-
|
|
||||||
buf := make([]byte, h.bufferSize)
|
|
||||||
for {
|
|
||||||
err := setConnectionTimeout(from, h.timeout)
|
|
||||||
@@ -113,17 +134,28 @@ func (h *HttpsHandler) communicate(ctx context.Context, from *net.TCPConn, to *n
|
|
||||||
|
|
||||||
bytesRead, err := ReadBytes(ctx, from, buf)
|
|
||||||
if err != nil {
|
|
||||||
+ if errors.Is(err, io.EOF) && len(bytesRead) > 0 {
|
|
||||||
+ h.write(logger, td, to, bytesRead)
|
|
||||||
+ }
|
|
||||||
logger.Debug().Msgf("error reading from %s: %s", fd, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
- if _, err := to.Write(bytesRead); err != nil {
|
|
||||||
- logger.Debug().Msgf("error writing to %s", td)
|
|
||||||
+ if !h.write(logger, td, to, bytesRead) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+func (h *HttpsHandler) write(logger zerolog.Logger, connName string, to io.Writer, bytes []byte) (ok bool) {
|
|
||||||
+ ok = true
|
|
||||||
+ if _, err := to.Write(bytes); err != nil {
|
|
||||||
+ logger.Debug().Msgf("error writing to %s", connName)
|
|
||||||
+ ok = false
|
|
||||||
+ }
|
|
||||||
+ return
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
func splitInChunks(ctx context.Context, bytes []byte, size int) [][]byte {
|
|
||||||
logger := log.GetCtxLogger(ctx)
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
config() {
|
|
||||||
NEW="$1"
|
|
||||||
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
|
||||||
# If there's no config file by that name, mv it over:
|
|
||||||
if [ ! -r $OLD ]; then
|
|
||||||
mv $NEW $OLD
|
|
||||||
elif [ "$(cat $OLD|md5sum)" = "$(cat $NEW|md5sum)" ]; then
|
|
||||||
# toss the redundant copy
|
|
||||||
rm $NEW
|
|
||||||
fi
|
|
||||||
# Otherwise, we leave the .new copy for the admin to consider...
|
|
||||||
}
|
|
||||||
|
|
||||||
preserve_perms() {
|
|
||||||
NEW="$1"
|
|
||||||
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
|
||||||
if [ -e $OLD ]; then
|
|
||||||
cp -a $OLD ${NEW}.incoming
|
|
||||||
cat $NEW > ${NEW}.incoming
|
|
||||||
mv ${NEW}.incoming $NEW
|
|
||||||
fi
|
|
||||||
config $NEW
|
|
||||||
}
|
|
||||||
|
|
||||||
config etc/default/spoofdpi.new
|
|
||||||
preserve_perms etc/rc.d/rc.spoofdpi.new
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Copyright 2024 Sergei Fedosoff <eleksir@gmail.com>
|
|
||||||
#
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are
|
|
||||||
# met:
|
|
||||||
#
|
|
||||||
# * Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
|
|
||||||
source /etc/defaults/spoofdpi
|
|
||||||
PIDFILE="/run/spoofdpi.pid"
|
|
||||||
|
|
||||||
_start() {
|
|
||||||
# make sure bitlbee isn't running yet
|
|
||||||
if [ ! -f $PIDFILE ]; then
|
|
||||||
/usr/sbin/daemonize -p $PIDFILE -- /usr/sbin/spoofdpi $OPTIONS
|
|
||||||
else
|
|
||||||
echo "spoofdpi is already active and running under PID: $(cat $PIDFILE)"
|
|
||||||
echo "if you think this is wrong, remove the offending PID file"
|
|
||||||
echo "and restart spoof"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_stop() {
|
|
||||||
echo -n "Stopping spoofdpi..."
|
|
||||||
|
|
||||||
if [ -r $PIDFILE ]; then
|
|
||||||
kill $(cat $PIDFILE)
|
|
||||||
|
|
||||||
for i in 1 2 3; do
|
|
||||||
if [ -f $PIDFILE ]; then
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -r $PIDFILE ]; then
|
|
||||||
kill -9 $(cat $PIDFILE) 2>/dev/null
|
|
||||||
rm $PIDFILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "done"
|
|
||||||
else
|
|
||||||
echo "Unable to find $PIDFILE and stop spoofdpi"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Let's see how we are being called.
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
_start
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
_stop
|
|
||||||
;;
|
|
||||||
restart)
|
|
||||||
_stop
|
|
||||||
sleep 3
|
|
||||||
_start
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: $(basename $0) {start|stop|restart}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# HOW TO EDIT THIS FILE:
|
|
||||||
# The "handy ruler" below makes it easier to edit a package description.
|
|
||||||
# Line up the first '|' above the ':' following the base package name, and
|
|
||||||
# the '|' on the right side marks the last column you can put a character in.
|
|
||||||
# You must make exactly 11 lines for the formatting to be correct. It's also
|
|
||||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
|
||||||
|
|
||||||
|-----handy-ruler------------------------------------------------------|
|
|
||||||
SpoofDPI: SpoofDPI
|
|
||||||
SpoofDPI:
|
|
||||||
SpoofDPI: A simple and fast software designed to bypass Deep Packet Inspection.
|
|
||||||
SpoofDPI:
|
|
||||||
SpoofDPI:
|
|
||||||
SpoofDPI:
|
|
||||||
SpoofDPI:
|
|
||||||
SpoofDPI: Homepage: https://github.com/xvzc/SpoofDPI
|
|
||||||
SpoofDPI:
|
|
||||||
SpoofDPI:
|
|
||||||
SpoofDPI:
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# Options for running SpoofDPI daemon
|
|
||||||
OPTIONS="-addr 127.0.0.1 -port 8080 -no-banner -system-proxy false"
|
|
||||||
Reference in New Issue
Block a user