Skip to content

Commit

Permalink
Update stun_bt.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Oniicyan authored Aug 7, 2024
1 parent 7c84a7b commit 6dd2bf9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions stun_bt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OWNADDR=$6
OWNNAME=$(echo $0 | awk -F / '{print$NF}' | awk -F . '{print$1}' | sed 's/[[:punct:]]/_/g')
RELEASE=$(grep ^ID= /etc/os-release | awk -F '=' '{print$2}' | tr -d \")
STUNIFO=/tmp/$OWNNAME.info
OLDPORT=$(grep $L4PROTO $STUNIFO 2>/dev/null | awk -F ':| ' '{print$3}')
OLDPORT=$(grep $L4PROTO $STUNIFO 2>/dev/null | awk -F ':| ' '{print$6}')

# 判断 TCP 或 UDP 的穿透是否启用
# 清理穿透信息中没有运行的协议
Expand All @@ -29,15 +29,15 @@ case $RELEASE in
fi
done
[ $(uci -q get natmap.$SECTTCP) ] || ( \
DISPORT="$(grep tcp $STUNIFO | awk -F ':| ' '{print$3}') tcp"; sed -i '/'tcp'/d' $STUNIFO )
DISPORT="$(grep tcp $STUNIFO | awk -F ':| ' '{print$6}') tcp"; sed -i '/'tcp'/d' $STUNIFO )
[ $(uci -q get natmap.$SECTUDP) ] || ( \
DISPORT="$(grep udp $STUNIFO | awk -F ':| ' '{print$3}') udp"; sed -i '/'udp'/d' $STUNIFO )
DISPORT="$(grep udp $STUNIFO | awk -F ':| ' '{print$6}') udp"; sed -i '/'udp'/d' $STUNIFO )
;;
*)
ps aux | grep $0 | grep "\-h" || ( \
DISPORT="$(grep tcp $STUNIFO | awk -F ':| ' '{print$3}') tcp"; sed -i '/'tcp'/d' $STUNIFO )
DISPORT="$(grep tcp $STUNIFO | awk -F ':| ' '{print$6}') tcp"; sed -i '/'tcp'/d' $STUNIFO )
ps aux | grep $0 | grep "\-u" || ( \
DISPORT="$(grep udp $STUNIFO | awk -F ':| ' '{print$3}') udp"; sed -i '/'udp'/d' $STUNIFO )
DISPORT="$(grep udp $STUNIFO | awk -F ':| ' '{print$6}') udp"; sed -i '/'udp'/d' $STUNIFO )
;;
esac

Expand Down

0 comments on commit 6dd2bf9

Please sign in to comment.