#--------------------------------------------------# # 终极防跳6.5_By Jume # #--------------------------------------------------# #---------------全局代理设置--------------# #全局代理UID UID0="10007" #全局/直连代理IP设置 IP="127.0.0.1" PORT="60880" #是否支持HTTPS/是否用直连 MHTTPS="on" ZHILIAN="off" #--------------定义本机设置---------------# #半免,多个uid用空格间隔 UID1="" #不免,多个uid用空格间隔 UID2="" #禁网,多个uid用空格间隔 UID3="1000" #单放HTTPS,多个uid用空格间隔 UID4="" #单放udp协议,多个uid用空格间隔 UID5="" #定义DNS_IP,不填将使用默认DNS DNSIP="" #DNS放行,关闭后在线视频等无法使用 DNS="on" #HTTPS放行,Samp全免版在设置里开关 HTTPS="off" #UDP放行,解决部分APP不联网或网游问题 UDP="off" #定义WIFI网卡,WIFI不联网的改为本机网卡 WIFIF="wlan0" #指定tcp端口走回全局代理不经过模块处理 SDK="" #--------------定义应用放行---------------# #QQ语音/视频全免,可拨不能接,关可以但不免 #不接时别关否则拨也不免(免HTTPS才用此项) QQML="on" QUID="10027" #新版虎牙.YY放行5002或23解决不能看直播 #放行端口只用极少流量 (免HTTPS才用此项) YUID="55555 66666" YUDP="5002" #--------------定义共享设置---------------# #共享设备免设代理,若要手动设置请关闭 GXMM="on" #共享设备DNS放行,直播或拖电脑须开启 #必须连同本机DNS放行一起开启才有效 GDNS="on" #UDP放行,解决部分程序或网游联网问题 GXUDP="off" #HTTPS放行,全局支持HTTPS的无需开启 GHTTPS="off" #共享设备端口放行,多个端口用空格间隔 #TCP端口: GTCP="" #UDP端口: GUDP="" #--------------处理模块设置---------------# #选(pdnsd/dnsp)免流解释DNS,不填则关闭 MDNS="pdnsd" #选(redsocks/u2nl)处理HTTPS,不填则关闭 CHTTPS="redsocks" #设置u2nl代理IP和端口(red.在配置文件改) PMIP="10.0.0.172" PMDK="80" #设置dnsp模块的DNS解释域名 DNSP="http://dns.sturgeon.mopaas.com/nslookup.php" #--------以下所有代码请勿修改-------# By="Jume" #--------------启动处理模块---------------# killall -9 0u2nl killall -9 0dnsp killall -9 0pdnsd killall -9 0redsocks if [[ $By == "Jume" ]] && [[ $CHTTPS == "redsocks" ]] then 0redsocks -c /system/xbin/0redsocks.conf >/dev/null 2>&1 & elif [[ $CHTTPS == "u2nl" ]] then 0u2nl $PMIP $PMDK 1256 >/dev/null 2>&1 & fi if [[ $By == "Jume" ]] && [[ $MDNS == "dnsp" ]] then 0dnsp -p 54321 -l 127.0.0.1 -h $IP -r $PORT -s $DNSP >/dev/null 2>&1 & elif [[ $MDNS == "pdnsd" ]] then 0pdnsd -c system/xbin/0pdnsd.conf >/dev/null 2>&1 & fi #--------------定义本机规则---------------# iptables -t nat -F OUTPUT iptables -t nat -F PREROUTING iptables -t nat -F POSTROUTING iptables -t mangle -F OUTPUT iptables -t mangle -F FORWARD if [[ $UDP == "on" ]] then FXUDP="ACCEPT" else FXUDP="DNAT --to-destination $IP:$PORT" fi if [[ $MHTTPS == "on" ]] then HPORT="DNAT --to-destination 127.0.0.1:1256" else HPORT="DNAT --to-destination $IP:$PORT" fi iptables -t nat -A OUTPUT -p sctp -j DNAT --to-destination $IP:$PORT iptables -t nat -A OUTPUT -p icmp -j DNAT --to-destination $IP:$PORT iptables -t nat -A OUTPUT -p udp -j $FXUDP iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination $IP:$PORT iptables -t nat -A OUTPUT -p tcp --dport 8080 -j DNAT --to-destination $IP:$PORT iptables -t nat -A OUTPUT -p tcp -j $HPORT iptables -t nat -A OUTPUT -j DNAT --to-destination 127.0.0.1 FX="31637 9876 2999 55283 6789 35415 67 68" for fx in $FX do if [[ $By == "Jume" ]] then iptables -t nat -I PREROUTING -p tcp --dport $fx -j ACCEPT else exit fi done for quid in $QUID do if [[ $By == "Jume" ]] && [[ $QQML == "on" ]] then clear else iptables -t nat -I OUTPUT -p udp --dport 8000 -m owner --uid-owner $quid -j ACCEPT iptables -t nat -I OUTPUT -p udp --dport 16001 -m owner --uid-owner $quid -j ACCEPT fi done if [[ $ZHILIAN == "on" ]] then GPORT="DNAT --to-destination $IP:$PORT" else GPORT="REDIRECT --to-ports $PORT" fi if [[ $MHTTPS == "on" ]] then GHPORT="REDIRECT --to-ports 1256" elif [[ $ZHILIAN == "on" ]] then GHPORT="DNAT --to-destination $IP:$PORT" else GHPORT="REDIRECT --to-ports $PORT" fi if [[ $HTTPS == "on" ]] then iptables -t nat -I OUTPUT -p tcp --dport 443 -j ACCEPT fi if [[ $DNSIP != "" ]] then DDNS="DNAT --to-destination $DNSIP:53" else DDNS="ACCEPT" fi if [[ $MDNS == "dnsp" ]] then DDNS="REDIRECT --to-ports 54321" elif [[ $MDNS == "pdnsd" ]] then DDNS="REDIRECT --to-ports 54321" fi if [[ $DNS == "on" ]] then iptables -t nat -I OUTPUT -p udp --dport 53 -j $DDNS fi for sdk in $SDK do if [ sdk != "" ] then iptables -t nat -I OUTPUT -p tcp --dport $sdk -j DNAT --to $IP:$PORT iptables -t nat -A PREROUTING -p tcp --dport $sdk -j $GPORT fi done for yuid in $YUID do if [[ $yuid != "" ]] then iptables -t nat -I OUTPUT -p udp --dport $YUDP -m owner --uid-owner $yuid -j ACCEPT fi done #--------------定义应用规则---------------# for uid0 in $UID0 do if [ uid0 != "" ] then iptables -t nat -I OUTPUT -p tcp -m owner --uid-owner $uid0 -j ACCEPT fi done for bam in $UID1 do if [ bam != "" ] then iptables -t nat -I OUTPUT -m owner --uid-owner $bam -j ACCEPT iptables -t nat -I OUTPUT -p tcp --dport 80 -m owner --uid-owner $bam -j DNAT --to-destination $IP:$PORT iptables -t nat -I OUTPUT -p tcp --dport 8080 -m owner --uid-owner $bam -j DNAT --to-destination $IP:$PORT fi done for bum in $UID2 do if [ bum != "" ] then iptables -t nat -I OUTPUT -m owner --uid-owner $bum -j ACCEPT fi done for jiw in $UID3 do if [ jiw != "" ] then iptables -t mangle -A OUTPUT -m owner --uid-owner $jiw -j DROP fi done for daf in $UID4 do if [ daf != "" ] then iptables -t nat -I OUTPUT -p tcp --dport 443 -m owner --uid-owner $daf -j ACCEPT fi done for fudp in $UID5 do if [ fudp != "" ] then iptables -t nat -I OUTPUT -p udp -m owner --uid-owner $fudp -j ACCEPT fi done iptables -t mangle -A OUTPUT -m state --state INVALID -j DROP iptables -t mangle -A FORWARD -m state --state INVALID -j DROP iptables -A OUTPUT -p tcp ! --syn -m state --state NEW -j DROP iptables -A FORWARD -p tcp ! --syn -m state --state NEW -j DROP iptables -t mangle -I OUTPUT -s 192.168.0.0/16 -j ACCEPT iptables -t nat -I OUTPUT -s 192.168.0.0/16 -j ACCEPT iptables -t nat -I OUTPUT -o lo -j ACCEPT for wifif in $WIFIF do if [[ $wifif != "" ]] then iptables -t mangle -I OUTPUT -o $wifif -j ACCEPT iptables -t nat -I OUTPUT -o $wifif -j ACCEPT fi done #--------------定义共享规则---------------# echo "1" > /proc/sys/net/ipv4/ip_forward if [[ $GXUDP == "on" ]] then GSUDP="ACCEPT" else GSUDP="REDIRECT --to-ports $PORT" fi if [[ $GXMM == "on" ]] && [[ $By == "Jume" ]] then iptables -t nat -A PREROUTING -s 192.168.0.0/16 -p sctp -j REDIRECT --to-ports $PORT iptables -t nat -A PREROUTING -s 192.168.0.0/16 -p icmp -j REDIRECT --to-ports $PORT iptables -t nat -A PREROUTING -s 192.168.0.0/16 -p udp -j $GSUDP iptables -t nat -A PREROUTING -s 192.168.0.0/16 -p tcp --dport 80 -j $GPORT iptables -t nat -A PREROUTING -s 192.168.0.0/16 -p tcp -j $GHPORT iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -j MASQUERADE iptables -t nat -I PREROUTING -d 1.2.3.4 -j DNAT --to-destination 123.125.96.11 fi if [[ $GDNS == "on" ]] then iptables -t nat -I PREROUTING -p udp --dport 53 -j ACCEPT fi if [[ $GHTTPS == "on" ]] then iptables -t nat -I PREROUTING -p tcp --dport 443 -j ACCEPT fi for gtcp in $GTCP do if [[ $gtcp != "" ]] then iptables -t nat -I PREROUTING -p tcp --dport $gtcp -j ACCEPT fi done for gudp in $GUDP do if [[ $gudp != "" ]] then iptables -t nat -I PREROUTING -p udp --dport $gudp -j ACCEPT fi done #---------------------完毕----------------------#