Skip to content

Instantly share code, notes, and snippets.

@shvchk
Last active November 7, 2024 05:50
Show Gist options
  • Save shvchk/aefc2536a5e4e4d048328c8f12628c92 to your computer and use it in GitHub Desktop.
Save shvchk/aefc2536a5e4e4d048328c8f12628c92 to your computer and use it in GitHub Desktop.
ByeDPI
#! /bin/busybox sh
echo "Loading hostlists..."
tmp_list="/tmp/byedpi-$(head -c 512 < /dev/urandom | md5sum).list"
for l in $HOSTLISTS; do
[ -z "$l" ] && continue
[ "${l:0:1}" = "#" ] && continue
if [ "${l:0:4}" = "http" ]; then
echo "Downloading hostlist $l"
wget -qO- -T 10 "$l" >> "$tmp_list"
else
cat "$l" >> "$tmp_list"
fi
done
sed -i '/^$/d' "$tmp_list"
mv -f "$tmp_list" "$HOSTLIST"
echo "Loading hostlists: done"
ggpht.com
googleusercontent.com
googlevideo.com
gstatic.com
l.google.com
nhacmp3youtube.com
play.google.com
youtu.be
youtube.com
youtubei.googleapis.com
ytimg.com
#! /bin/busybox sh
DIR="$(dirname -- "$0")"
PROXY_PORT=9080
APP="$DIR/ciadpi"
PIDFILE=/var/run/byedpi-socks-dummy.pid
ARGS="-i 192.168.1.1 -p $PROXY_PORT"
start() {
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")"; then
echo "ByeDPI is already running" >&2
return 1
fi
echo "Starting ByeDPI..."
$APP $ARGS > /dev/null 2>&1 &
echo $! > "$PIDFILE"
echo "Starting ByeDPI: done"
}
stop() {
if [ ! -f "$PIDFILE" ] || ! kill -0 "$(cat "$PIDFILE")"; then
echo "ByeDPI is not running" >&2
return 1
fi
echo "Stopping ByeDPI..."
kill "$(cat "$PIDFILE")" && rm -f "$PIDFILE"
echo "Stopping ByeDPI: done"
}
status() {
if [ -f $PIDFILE ] && kill -0 "$(cat "$PIDFILE")"; then
echo "ByeDPI is running"
else
echo "ByeDPI is stopped"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
esac
#! /bin/busybox sh
DIR="$(dirname -- "$0")"
PROXY_PORT=2080
APP="$DIR/ciadpi"
PIDFILE=/var/run/byedpi-socks.pid
ARGS="-i 192.168.1.1 -p $PROXY_PORT -o 1"
start() {
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")"; then
echo "ByeDPI is already running" >&2
return 1
fi
echo "Starting ByeDPI..."
$APP $ARGS > /dev/null 2>&1 &
echo $! > "$PIDFILE"
echo "Starting ByeDPI: done"
}
stop() {
if [ ! -f "$PIDFILE" ] || ! kill -0 "$(cat "$PIDFILE")"; then
echo "ByeDPI is not running" >&2
return 1
fi
echo "Stopping ByeDPI..."
kill "$(cat "$PIDFILE")" && rm -f "$PIDFILE"
echo "Stopping ByeDPI: done"
}
status() {
if [ -f $PIDFILE ] && kill -0 "$(cat "$PIDFILE")"; then
echo "ByeDPI is running"
else
echo "ByeDPI is stopped"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
esac
#! /bin/busybox sh
DIR="$(dirname -- "$0")"
PROXY_PORT=6080
HOSTLISTS="$DIR/custom.list \
https://github.com/shvchk/unblock-net/raw/main/lists/ru-blocked.list"
HOSTLIST=/tmp/byedpi.list
APP="$DIR/ciadpi"
PIDFILE=/var/run/byedpi-transparent.pid
ARGS="-i 192.168.1.1 -p $PROXY_PORT -E -H $HOSTLIST -o 1 -A n"
start() {
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")"; then
echo "ByeDPI is already running" >&2
return 1
fi
. "$DIR/compile-hostlist.sh"
echo "Starting ByeDPI..."
$APP $ARGS > /dev/null 2>&1 &
echo $! > "$PIDFILE"
iptables -t nat -D PREROUTING -i br0 -p tcp --dport 443 -j REDIRECT --to-port 6080 2> /dev/null
iptables -t nat -I PREROUTING -i br0 -p tcp --dport 443 -j REDIRECT --to-port 6080
echo "Starting ByeDPI: done"
}
stop() {
if [ ! -f "$PIDFILE" ] || ! kill -0 "$(cat "$PIDFILE")"; then
echo "ByeDPI is not running" >&2
return 1
fi
echo "Stopping ByeDPI..."
iptables -t nat -D PREROUTING -i br0 -p tcp --dport 443 -j REDIRECT --to-port 6080 2> /dev/null
kill "$(cat "$PIDFILE")" && rm -f "$PIDFILE"
echo "Stopping ByeDPI: done"
}
status() {
if [ -f $PIDFILE ] && kill -0 "$(cat "$PIDFILE")"; then
echo "ByeDPI is running"
else
echo "ByeDPI is stopped"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment