Git Product home page Git Product logo

Comments (5)

juewuy avatar juewuy commented on September 6, 2024

尝试使用自定义vlan网段功能 7-3-3

from shellclash.

bsdcpp avatar bsdcpp commented on September 6, 2024

早知道早点来提问,问一下果然有收获,我大概不过我没怎么看明白,是不是和mac不能同时处理,就是说我在配置了mac白名单的同时,不能再配置ip规则了对吗?

 #tcp&udp分别进代理链
    proxy_set() {
        if [ "$3" = 'PREROUTING' ] && [ "$macfilter_type" = "白名单" ] && [ -s "$CRASHDIR"/configs/mac ]; then
            for mac in $(cat "$CRASHDIR"/configs/mac); do
                $1 -t $2 -A $4 -p $5 -m mac --mac-source $mac -j $JUMP
            done
        else
            for ip in $HOST_IP; do #仅限指定网段流量
                $1 -t $2 -A $4 -p $5 -s $ip -j $JUMP
                echo $1 -t $2 -A $4 -p $5 -s $ip -j $JUMP
            done
        fi
        #将所在链指定流量指向shellcrash表
        $1 -t $2 -I $3 -p $5 $ports -j $4
        [ "$dns_mod" != "redir_host" ] && [ "$common_ports" = "已开启" ] && [ "$1" = iptables ] && $1 -t $2 -I $3 -p $5 -d 198.18.0.0/16 -j $4
    }
    [ "$5" = "tcp" -o "$5" = "all" ] && proxy_set $1 $2 $3 $4 tcp
    [ "$5" = "udp" -o "$5" = "all" ] && proxy_set $1 $2 $3 $4 udp

这里的判断只会加mac规则

 if [ "$3" = 'PREROUTING' ] && [ "$macfilter_type" = "白名单" ] && [ -s "$CRASHDIR"/configs/mac ]; then

from shellclash.

bsdcpp avatar bsdcpp commented on September 6, 2024

还有个问题

#if [ "$replace_default_host_ipv4" == "未禁用" ]; then
    if [ "$replace_default_host_ipv4" == "已启用" ]; then
        host_ipv4="$cust_host_ipv4"
    else
        host_ipv4="$host_ipv4$cust_host_ipv4"
    fi

我看界面已经不再用“未禁用”了,而是“已启用”,所以匹配不到覆盖了。

from shellclash.

bsdcpp avatar bsdcpp commented on September 6, 2024

早知道早点来提问,问一下果然有收获,我大概不过我没怎么看明白,是不是和mac不能同时处理,就是说我在配置了mac白名单的同时,不能再配置ip规则了对吗?

 #tcp&udp分别进代理链
    proxy_set() {
        if [ "$3" = 'PREROUTING' ] && [ "$macfilter_type" = "白名单" ] && [ -s "$CRASHDIR"/configs/mac ]; then
            for mac in $(cat "$CRASHDIR"/configs/mac); do
                $1 -t $2 -A $4 -p $5 -m mac --mac-source $mac -j $JUMP
            done
        else
            for ip in $HOST_IP; do #仅限指定网段流量
                $1 -t $2 -A $4 -p $5 -s $ip -j $JUMP
                echo $1 -t $2 -A $4 -p $5 -s $ip -j $JUMP
            done
        fi
        #将所在链指定流量指向shellcrash表
        $1 -t $2 -I $3 -p $5 $ports -j $4
        [ "$dns_mod" != "redir_host" ] && [ "$common_ports" = "已开启" ] && [ "$1" = iptables ] && $1 -t $2 -I $3 -p $5 -d 198.18.0.0/16 -j $4
    }
    [ "$5" = "tcp" -o "$5" = "all" ] && proxy_set $1 $2 $3 $4 tcp
    [ "$5" = "udp" -o "$5" = "all" ] && proxy_set $1 $2 $3 $4 udp

这里的判断只会加mac规则

 if [ "$3" = 'PREROUTING' ] && [ "$macfilter_type" = "白名单" ] && [ -s "$CRASHDIR"/configs/mac ]; then

我试过把else去掉,就是执行mac的同时把ip也加入,这样是可以的😂。不知道这样是不是有问题。
修改如下:

--- ori.sh
+++ start.sh
@@ -194,7 +194,7 @@
 		sleep 1 && i=$((i + 1))
 	done
 	#添加自定义ipv4局域网网段
-	if [ "$replace_default_host_ipv4" == "未禁用" ]; then
+	if [ "$replace_default_host_ipv4" == "已启用" ]; then
 		host_ipv4="$cust_host_ipv4"
 	else
 		host_ipv4="$host_ipv4$cust_host_ipv4"
@@ -930,7 +930,7 @@
 			for mac in $(cat "$CRASHDIR"/configs/mac); do
 				$1 -t $2 -A $4 -p $5 -m mac --mac-source $mac -j $JUMP
 			done
-		else
+		#else
 			for ip in $HOST_IP; do #仅限指定网段流量
 				$1 -t $2 -A $4 -p $5 -s $ip -j $JUMP
 			done
@@ -972,7 +972,7 @@
 			$1 -t nat -A $3 -p tcp -m mac --mac-source $mac -j REDIRECT --to-ports $dns_port
 			$1 -t nat -A $3 -p udp -m mac --mac-source $mac -j REDIRECT --to-ports $dns_port
 		done
-	else
+	#else
 		for ip in $HOST_IP; do #仅限指定网段流量
 			$1 -t nat -A $3 -p tcp -s $ip -j REDIRECT --to-ports $dns_port
 			$1 -t nat -A $3 -p udp -s $ip -j REDIRECT --to-ports $dns_port

from shellclash.

juewuy avatar juewuy commented on September 6, 2024

@bsdcpp 白名单当然只会允许名单内通过

from shellclash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.