Skip to content

Commit

Permalink
v2.06.2
Browse files Browse the repository at this point in the history
1.debug
  • Loading branch information
tty228 committed May 5, 2023
1 parent ad7571e commit f1fb23d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-serverchan
PKG_VERSION:=2.06.1
PKG_VERSION:=2.06.2
PKG_RELEASE:=10

PKG_MAINTAINER:=tty228 <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions luasrc/model/cbi/serverchan/setting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ a.rmempty = true
a.description = translate("登录成功后开放端口")

a = s:taboption("ipset", Value, "ip_port_white", "端口")
a.default = "3000"
a.default = ""
a.rmempty = true
a.description = translate("例:'22'、'21:25'、'21:25,135:139'")
a:depends("port_knocking", "1")

a = s:taboption("ipset", DynamicList, "port_forward_list", "端口转发")
a.default = "10.0.0.1,13389,10.0.0.2,3389"
a.default = ""
a.rmempty = true
a.description = translate("例:将本机(10.0.0.1)的 13389 端口转发到 10.0.0.2 的3389:<br/>'10.0.0.1,13389,10.0.0.2,3389'<br/>IPv6 未测试")
a:depends("port_knocking", "1")
Expand Down
12 changes: 6 additions & 6 deletions root/usr/share/serverchan/serverchan
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ function read_config(){
[ -z "$serverchan_ipv4" ] && serverchan_ipv4=0
[ -z "$serverchan_ipv6" ] && serverchan_ipv6=0
[ -z "$sleeptime" ] && sleeptime="60"
[ -z "$ip_black_timeout" ] && sleeptime="86400"
[ -z "$ip_white_timeout" ] && sleeptime="600"
[ -z "$ip_black_timeout" ] && ip_black_timeout="86400"
[ -z "$ip_white_timeout" ] && ip_white_timeout="600"
[ "$iw_version" ] && wlan_interface=`iw dev 2>/dev/null|grep Interface|awk '{print $2}'` >/dev/null 2>&1
[ -z "$up_timeout" ] || [ "$up_timeout" -eq "0" ] && up_timeout="2"
[ -z "$down_timeout" ] || [ "$down_timeout" -eq "0" ] && down_timeout="20";down_timeout=`expr ${down_timeout} / 2 + 1`
Expand Down Expand Up @@ -1187,8 +1187,8 @@ function add_ip_white(){
iptables -C INPUT -m set --match-set ip_whitelist src -p tcp -m multiport --dport ${ip_port_white} -j ACCEPT >/dev/null 2>&1 || iptables -I INPUT -m set --match-set ip_whitelist src -p tcp -m multiport --dport ${ip_port_white} -j ACCEPT >/dev/null 2>&1
# 端口转发
for port_forward in `echo "$port_forward_list"`; do
iptables -t nat -C PREROUTING -m set --match-set ip_whitelist src -p tcp --dport `echo ${port_forward}|awk '{print $2}'` -j DNAT --to-destination "`echo ${port_forward}|awk '{print $3}'`:`echo ${port_forward}|awk '{print $4}'`" >/dev/null 2>&1 || iptables -t nat -A PREROUTING -m set --match-set ip_whitelist src -p tcp --dport `echo ${port_forward}|awk '{print $2}'` -j DNAT --to-destination "`echo ${port_forward}|awk '{print $3}'`:`echo ${port_forward}|awk '{print $4}'`" >/dev/null 2>&1
iptables -t nat -A POSTROUTING -m set --match-set ip_whitelist src -p tcp -d `echo ${port_forward}|awk '{print $3}'` --dport `echo ${port_forward}|awk '{print $4}'` -j SNAT --to-source `echo ${port_forward}|awk '{print $1}'` >/dev/null 2>&1 || iptables -t nat -A POSTROUTING -m set --match-set ip_whitelist src -p tcp -d `echo ${port_forward}|awk '{print $3}'` --dport `echo ${port_forward}|awk '{print $4}'` -j SNAT --to-source `echo ${port_forward}|awk '{print $1}'` >/dev/null 2>&1
iptables -t nat -C PREROUTING -m set --match-set ip_whitelist src -p tcp --dport `echo ${port_forward}|awk '{print $2}'` -j DNAT --to-destination "`echo ${port_forward}|awk '{print $3}'`:`echo ${port_forward}|awk '{print $4}'`" >/dev/null 2>&1 || iptables -t nat -I PREROUTING -m set --match-set ip_whitelist src -p tcp --dport `echo ${port_forward}|awk '{print $2}'` -j DNAT --to-destination "`echo ${port_forward}|awk '{print $3}'`:`echo ${port_forward}|awk '{print $4}'`" >/dev/null 2>&1
iptables -t nat -C POSTROUTING -m set --match-set ip_whitelist src -p tcp -d `echo ${port_forward}|awk '{print $3}'` --dport `echo ${port_forward}|awk '{print $4}'` -j SNAT --to-source `echo ${port_forward}|awk '{print $1}'` >/dev/null 2>&1 || iptables -t nat -I POSTROUTING -m set --match-set ip_whitelist src -p tcp -d `echo ${port_forward}|awk '{print $3}'` --dport `echo ${port_forward}|awk '{print $4}'` -j SNAT --to-source `echo ${port_forward}|awk '{print $1}'` >/dev/null 2>&1
done

unset port_forward
Expand All @@ -1200,8 +1200,8 @@ function add_ip_white(){
ip6tables -C INPUT -m set --match-set ip_whitelistv6 src -p tcp -m multiport --dport ${ip_port_white} -j ACCEPT >/dev/null 2>&1 || ip6tables -I INPUT -m set --match-set ip_whitelistv6 src -p tcp -m multiport --dport ${ip_port_white} -j ACCEPT >/dev/null 2>&1
# 端口转发
for port_forward in `echo "$port_forward_list"`; do
ip6tables -t nat -C PREROUTING -m set --match-set ip_whitelist src -p tcp --dport `echo ${port_forward}|awk '{print $2}'` -j DNAT --to-destination "`echo ${port_forward}|awk '{print $3}'`:`echo ${port_forward}|awk '{print $4}'`" >/dev/null 2>&1 || ip6tables -t nat -A PREROUTING -m set --match-set ip_whitelist src -p tcp --dport `echo ${port_forward}|awk '{print $2}'` -j DNAT --to-destination "`echo ${port_forward}|awk '{print $3}'`:`echo ${port_forward}|awk '{print $4}'`" >/dev/null 2>&1
ip6tables -t nat -A POSTROUTING -m set --match-set ip_whitelist src -p tcp -d `echo ${port_forward}|awk '{print $3}'` --dport `echo ${port_forward}|awk '{print $4}'` -j SNAT --to-source `echo ${port_forward}|awk '{print $1}'` >/dev/null 2>&1 || ip6tables -t nat -A POSTROUTING -m set --match-set ip_whitelist src -p tcp -d `echo ${port_forward}|awk '{print $3}'` --dport `echo ${port_forward}|awk '{print $4}'` -j SNAT --to-source `echo ${port_forward}|awk '{print $1}'` >/dev/null 2>&1
ip6tables -t nat -C PREROUTING -m set --match-set ip_whitelist src -p tcp --dport `echo ${port_forward}|awk '{print $2}'` -j DNAT --to-destination "`echo ${port_forward}|awk '{print $3}'`:`echo ${port_forward}|awk '{print $4}'`" >/dev/null 2>&1 || ip6tables -t nat -I PREROUTING -m set --match-set ip_whitelist src -p tcp --dport `echo ${port_forward}|awk '{print $2}'` -j DNAT --to-destination "`echo ${port_forward}|awk '{print $3}'`:`echo ${port_forward}|awk '{print $4}'`" >/dev/null 2>&1
ip6tables -t nat -C POSTROUTING -m set --match-set ip_whitelist src -p tcp -d `echo ${port_forward}|awk '{print $3}'` --dport `echo ${port_forward}|awk '{print $4}'` -j SNAT --to-source `echo ${port_forward}|awk '{print $1}'` >/dev/null 2>&1 || ip6tables -t nat -I POSTROUTING -m set --match-set ip_whitelist src -p tcp -d `echo ${port_forward}|awk '{print $3}'` --dport `echo ${port_forward}|awk '{print $4}'` -j SNAT --to-source `echo ${port_forward}|awk '{print $1}'` >/dev/null 2>&1
done

unset port_forward
Expand Down

0 comments on commit f1fb23d

Please sign in to comment.