From 2194d1029487d72cf541c45c1f23a6e8901f4e08 Mon Sep 17 00:00:00 2001 From: your name Date: Fri, 25 Sep 2020 03:18:01 +0000 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++ luci-app-control-webrestriction/Makefile | 17 +++ .../luasrc/controller/webrestriction.lua | 19 ++++ .../luasrc/model/cbi/webrestriction.lua | 30 ++++++ .../luasrc/view/webrestriction/index.htm | 18 ++++ .../view/webrestriction/webrestriction.htm | 3 + .../po/zh-cn/webrestriction.po | 2 + .../root/etc/config/webrestriction | 5 + .../root/etc/init.d/webrestriction | 86 +++++++++++++++ .../luci-app-control-webrestriction | 11 ++ .../luci-app-control-webrestriction.json | 11 ++ luci-app-control-weburl/Makefile | 18 ++++ .../luasrc/controller/weburl.lua | 10 ++ .../luasrc/model/cbi/weburl.lua | 65 ++++++++++++ luci-app-control-weburl/po/zh-cn/weburl.po | 2 + .../root/etc/config/weburl | 27 +++++ .../root/etc/init.d/weburl | 65 ++++++++++++ .../etc/uci-defaults/luci-app-control-weburl | 11 ++ luci-app-eqos/Makefile | 100 ++++++++++++++++++ luci-app-eqos/files/eqos-cbi.lua | 39 +++++++ luci-app-eqos/files/eqos-controller.lua | 13 +++ luci-app-eqos/files/eqos.config | 12 +++ luci-app-eqos/files/eqos.hotplug | 5 + luci-app-eqos/files/eqos.init | 39 +++++++ luci-app-eqos/files/eqos.sh | 60 +++++++++++ luci-app-eqos/files/po/zh-cn/eqos.po | 44 ++++++++ luci-app-eqos/files/uci-defaults-eqos | 9 ++ pandownload-fs-openwrt/Makefile | 41 +++++++ pandownload-fs-openwrt/files/api/init | 1 + pandownload-fs-openwrt/files/api/latest | 1 + pandownload-fs-openwrt/files/api/script/list | 1 + 31 files changed, 775 insertions(+) create mode 100644 README.md create mode 100755 luci-app-control-webrestriction/Makefile create mode 100755 luci-app-control-webrestriction/luasrc/controller/webrestriction.lua create mode 100755 luci-app-control-webrestriction/luasrc/model/cbi/webrestriction.lua create mode 100755 luci-app-control-webrestriction/luasrc/view/webrestriction/index.htm create mode 100755 luci-app-control-webrestriction/luasrc/view/webrestriction/webrestriction.htm create mode 100755 luci-app-control-webrestriction/po/zh-cn/webrestriction.po create mode 100755 luci-app-control-webrestriction/root/etc/config/webrestriction create mode 100755 luci-app-control-webrestriction/root/etc/init.d/webrestriction create mode 100755 luci-app-control-webrestriction/root/etc/uci-defaults/luci-app-control-webrestriction create mode 100755 luci-app-control-webrestriction/root/usr/share/rpcd/acl.d/luci-app-control-webrestriction.json create mode 100755 luci-app-control-weburl/Makefile create mode 100755 luci-app-control-weburl/luasrc/controller/weburl.lua create mode 100755 luci-app-control-weburl/luasrc/model/cbi/weburl.lua create mode 100755 luci-app-control-weburl/po/zh-cn/weburl.po create mode 100755 luci-app-control-weburl/root/etc/config/weburl create mode 100755 luci-app-control-weburl/root/etc/init.d/weburl create mode 100755 luci-app-control-weburl/root/etc/uci-defaults/luci-app-control-weburl create mode 100755 luci-app-eqos/Makefile create mode 100755 luci-app-eqos/files/eqos-cbi.lua create mode 100755 luci-app-eqos/files/eqos-controller.lua create mode 100755 luci-app-eqos/files/eqos.config create mode 100755 luci-app-eqos/files/eqos.hotplug create mode 100755 luci-app-eqos/files/eqos.init create mode 100755 luci-app-eqos/files/eqos.sh create mode 100755 luci-app-eqos/files/po/zh-cn/eqos.po create mode 100755 luci-app-eqos/files/uci-defaults-eqos create mode 100755 pandownload-fs-openwrt/Makefile create mode 100755 pandownload-fs-openwrt/files/api/init create mode 100755 pandownload-fs-openwrt/files/api/latest create mode 100755 pandownload-fs-openwrt/files/api/script/list diff --git a/README.md b/README.md new file mode 100644 index 0000000..21e7f0e --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# 使用方法 + + +添加 src-git test https://github.com/Beginner-Go/my-package.git 到 OpenWRT源码根目录feeds.conf.default文件 + +然后执行 + +./scripts/feeds clean +./scripts/feeds update -a +./scripts/feeds install -a \ No newline at end of file diff --git a/luci-app-control-webrestriction/Makefile b/luci-app-control-webrestriction/Makefile new file mode 100755 index 0000000..ff061de --- /dev/null +++ b/luci-app-control-webrestriction/Makefile @@ -0,0 +1,17 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for Webrestriction From Koolshare +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=6-20200921 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/luci-app-control-webrestriction/luasrc/controller/webrestriction.lua b/luci-app-control-webrestriction/luasrc/controller/webrestriction.lua new file mode 100755 index 0000000..03c1b49 --- /dev/null +++ b/luci-app-control-webrestriction/luasrc/controller/webrestriction.lua @@ -0,0 +1,19 @@ +module("luci.controller.webrestriction", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/webrestriction") then return end + + entry({"admin", "control"}, firstchild(), "Control", 44).dependent = false + entry({"admin", "control", "webrestriction"}, cbi("webrestriction"), + _("访问限制"), 11).dependent = true + entry({"admin", "control", "webrestriction", "status"}, call("status")).leaf = + true +end + +function status() + local e = {} + e.status = luci.sys.call( + "iptables -L FORWARD |grep WEB_RESTRICTION >/dev/null") == 0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/luci-app-control-webrestriction/luasrc/model/cbi/webrestriction.lua b/luci-app-control-webrestriction/luasrc/model/cbi/webrestriction.lua new file mode 100755 index 0000000..bb0c688 --- /dev/null +++ b/luci-app-control-webrestriction/luasrc/model/cbi/webrestriction.lua @@ -0,0 +1,30 @@ +local o = require "luci.sys" +local a, e, t +a = Map("webrestriction", translate("访问限制"), translate( + "使用黑名单或者白名单模式控制列表中的客户端是否能够连接到互联网。")) +a.template = "webrestriction/index" +e = a:section(TypedSection, "basic", translate("Running Status")) +e.anonymous = true +t = e:option(DummyValue, "webrestriction_status", translate("当前状态")) +t.template = "webrestriction/webrestriction" +t.value = translate("Collecting data...") +e = a:section(TypedSection, "basic", translate("全局设置")) +e.anonymous = true +t = e:option(Flag, "enable", translate("开启")) +t.rmempty = false +t = e:option(ListValue, "limit_type", translate("限制模式")) +t.default = "blacklist" +t:value("whitelist", translate("白名单")) +t:value("blacklist", translate("黑名单")) +t.rmempty = false +e = a:section(TypedSection, "macbind", translate("名单设置"), translate( + "如果是黑名单模式,列表中的客户端将被禁止连接到互联网;白名单模式表示仅有列表中的客户端可以连接到互联网。")) +e.template = "cbi/tblsection" +e.anonymous = true +e.addremove = true +t = e:option(Flag, "enable", translate("开启控制")) +t.rmempty = false +t = e:option(Value, "macaddr", translate("MAC地址")) +t.rmempty = true +o.net.mac_hints(function(e, a) t:value(e, "%s (%s)" % {e, a}) end) +return a diff --git a/luci-app-control-webrestriction/luasrc/view/webrestriction/index.htm b/luci-app-control-webrestriction/luasrc/view/webrestriction/index.htm new file mode 100755 index 0000000..21f269e --- /dev/null +++ b/luci-app-control-webrestriction/luasrc/view/webrestriction/index.htm @@ -0,0 +1,18 @@ +<%# + Copyright 2016 Chen RuiWei + Licensed to the public under the Apache License 2.0. +-%> + +<% include("cbi/map") %> + diff --git a/luci-app-control-webrestriction/luasrc/view/webrestriction/webrestriction.htm b/luci-app-control-webrestriction/luasrc/view/webrestriction/webrestriction.htm new file mode 100755 index 0000000..03702cf --- /dev/null +++ b/luci-app-control-webrestriction/luasrc/view/webrestriction/webrestriction.htm @@ -0,0 +1,3 @@ +<%+cbi/valueheader%> +<%=pcdata(self:cfgvalue(section) or self.default or "")%> +<%+cbi/valuefooter%> diff --git a/luci-app-control-webrestriction/po/zh-cn/webrestriction.po b/luci-app-control-webrestriction/po/zh-cn/webrestriction.po new file mode 100755 index 0000000..a883cf7 --- /dev/null +++ b/luci-app-control-webrestriction/po/zh-cn/webrestriction.po @@ -0,0 +1,2 @@ +msgid "Control" +msgstr "管控" diff --git a/luci-app-control-webrestriction/root/etc/config/webrestriction b/luci-app-control-webrestriction/root/etc/config/webrestriction new file mode 100755 index 0000000..5045939 --- /dev/null +++ b/luci-app-control-webrestriction/root/etc/config/webrestriction @@ -0,0 +1,5 @@ + +config basic + option enable '0' + option limit_type 'blacklist' + diff --git a/luci-app-control-webrestriction/root/etc/init.d/webrestriction b/luci-app-control-webrestriction/root/etc/init.d/webrestriction new file mode 100755 index 0000000..f4efda8 --- /dev/null +++ b/luci-app-control-webrestriction/root/etc/init.d/webrestriction @@ -0,0 +1,86 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (C) 2015 OpenWrt-dist +# Copyright (C) 2016 fw867 +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +START=99 + +CONFIG=webrestriction +limit_type=$(uci -q get webrestriction.@basic[0].limit_type) + +uci_get_by_type() { + local index=0 + if [ -n $4 ]; then + index=$4 + fi + local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null) + echo ${ret:=$3} +} + +is_true() { + case $1 in + 1|on|true|yes|enabled) echo 0;; + *) echo 1;; + esac +} + +load_config() { + ENABLED=$(uci_get_by_type basic enable) + return $(is_true $ENABLED) +} + + +add_rule(){ + action=$1 + for i in $(seq 0 100) + do + enable=$(uci_get_by_type macbind enable '' $i) + macaddr=$(uci_get_by_type macbind macaddr '' $i) + if [ -z $enable ] || [ -z $macaddr ]; then + break + fi + if [ "$enable" == "1" ]; then + iptables -t filter -A WEB_RESTRICTION -m mac --mac-source $macaddr -j $action + [ "$limit_type" == "blacklist" ] && iptables -t nat -A WEB_RESTRICTION -m mac --mac-source $macaddr -j RETURN + #unset "$macaddr" + fi + done +} + +start(){ + + ! load_config && exit 0 + [ "`iptables -L FORWARD|grep -c WEB_RESTRICTION`" -gt 0 ] && exit 0; + iptables -P FORWARD DROP + iptables -t filter -N WEB_RESTRICTION + if [ "$limit_type" == "blacklist" ]; then + iptables -t nat -N WEB_RESTRICTION + add_rule DROP + else + add_rule ACCEPT + iptables -t filter -A WEB_RESTRICTION -j DROP + fi + + #获取FORWARD ACCEPT规则行号 + FA_INDEX=`iptables -t filter -L FORWARD --line-numbers | tail -n +3 | grep -E ACCEPT | grep ctstate | grep fw3 | awk '{print $1}'` + if [ -n "$FA_INDEX" ]; then + let FA_INDEX+=1 + fi + #确保添加到FORWARD ACCEPT规则之后 + iptables -t filter -I FORWARD $FA_INDEX -m comment --comment "Rule For Control" -j WEB_RESTRICTION + [ "$limit_type" == "blacklist" ] && iptables -t nat -I PREROUTING 1 -m comment --comment "Rule For Control" -j WEB_RESTRICTION +} +stop(){ + [ "`iptables -t filter -L | grep -c WEB_RESTRICTION`" -gt 0 ] && { + iptables -t filter -D FORWARD -m comment --comment "Rule For Control" -j WEB_RESTRICTION + iptables -t nat -D PREROUTING -m comment --comment "Rule For Control" -j WEB_RESTRICTION + iptables -t filter -F WEB_RESTRICTION + iptables -t filter -X WEB_RESTRICTION + iptables -t nat -F WEB_RESTRICTION + iptables -t nat -X WEB_RESTRICTION + } +} \ No newline at end of file diff --git a/luci-app-control-webrestriction/root/etc/uci-defaults/luci-app-control-webrestriction b/luci-app-control-webrestriction/root/etc/uci-defaults/luci-app-control-webrestriction new file mode 100755 index 0000000..25ff88a --- /dev/null +++ b/luci-app-control-webrestriction/root/etc/uci-defaults/luci-app-control-webrestriction @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@webrestriction[-1] + add ucitrack webrestriction + set ucitrack.@webrestriction[-1].init=webrestriction + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/luci-app-control-webrestriction/root/usr/share/rpcd/acl.d/luci-app-control-webrestriction.json b/luci-app-control-webrestriction/root/usr/share/rpcd/acl.d/luci-app-control-webrestriction.json new file mode 100755 index 0000000..5253d8c --- /dev/null +++ b/luci-app-control-webrestriction/root/usr/share/rpcd/acl.d/luci-app-control-webrestriction.json @@ -0,0 +1,11 @@ +{ + "luci-app-control-webrestriction": { + "description": "Grant UCI access for luci-app-control-webrestriction", + "read": { + "uci": [ "webrestriction" ] + }, + "write": { + "uci": [ "webrestriction" ] + } + } +} diff --git a/luci-app-control-weburl/Makefile b/luci-app-control-weburl/Makefile new file mode 100755 index 0000000..b0df327 --- /dev/null +++ b/luci-app-control-weburl/Makefile @@ -0,0 +1,18 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for Weburl From Koolshare +LUCI_DEPENDS:=+iptables-mod-filter +kmod-ipt-filter +LUCI_PKGARCH:=all +PKG_VERSION:=1.5 +PKG_RELEASE:=20200923 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/luci-app-control-weburl/luasrc/controller/weburl.lua b/luci-app-control-weburl/luasrc/controller/weburl.lua new file mode 100755 index 0000000..539e4f9 --- /dev/null +++ b/luci-app-control-weburl/luasrc/controller/weburl.lua @@ -0,0 +1,10 @@ +module("luci.controller.weburl", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/weburl") then return end + + entry({"admin", "control"}, firstchild(), "Control", 50).dependent = false + entry({"admin", "control", "weburl"}, cbi("weburl"), _("过滤军刀"), 12).dependent = + true +end + diff --git a/luci-app-control-weburl/luasrc/model/cbi/weburl.lua b/luci-app-control-weburl/luasrc/model/cbi/weburl.lua new file mode 100755 index 0000000..c407660 --- /dev/null +++ b/luci-app-control-weburl/luasrc/model/cbi/weburl.lua @@ -0,0 +1,65 @@ +local o = require "luci.sys" +local a, t, e +local button = "" +local state_msg = "" +local running=(luci.sys.call("iptables -L FORWARD|grep WEBURL >/dev/null") == 0) +local button = "" +local state_msg = "" +if running then + state_msg = "" .. translate("正在运行") .. "" +else + state_msg = "" .. translate("没有运行") .. "" +end +a = Map("weburl", translate("网址过滤/关键字过滤/MAC黑名单/时间控制/端口控制"), translate("利用iptables来单独或组合使用多种条件过滤。条件除特别说明外都可以留空不使用。
* 如指定“关键词/URL”(MAC黑名单、时间、星期可选)则为关键字过滤,关键字可以是字符串或网址。
* 如指定“MAC黑名单”而“关键词/URL”留空则为纯MAC黑名单模式(如已改变默认时间或星期则成为时间控制)。
* 如指定端口(MAC黑名单、时间、星期可选)则禁止通过此端口联网。端口可以是端口范围如5000:5100或多端口5100,5110。" .. button .. "

" .. translate("运行状态").. " : " .. state_msg .. "
")) +t = a:section(TypedSection, "basic", translate(""), translate("")) +t.anonymous = true +e = t:option(Flag, "enabled", translate("开启功能")) +e.rmempty = false +e = t:option(ListValue, "algos", translate("过滤力度")) +e:value("bm", "一般过滤") +e:value("kmp", "强效过滤") +e.default = "kmp" +t = a:section(TypedSection, "macbind", translate("")) +t.template = "cbi/tblsection" +t.anonymous = true +t.addremove = true +e = t:option(Flag, "enable", translate("开启")) +e.rmempty = false +e.default = '1' +e = t:option(Value, "macaddr", translate("黑名单MAC(留空则过滤全部客户端)")) +e.rmempty = true +o.net.mac_hints(function(t, a) e:value(t, "%s (%s)" % {t, a}) end) +e = t:option(Value, "keyword", translate("关键词/URL(可留空)")) +e.rmempty = true +e = t:option(ListValue, "proto", translate("端口协议")) +e.rmempty = false +e.default = 'tcp' +e:value("tcp", translate("TCP")) +e:value("udp", translate("UDP")) +e = t:option(Value, "sport", translate("源端口")) +e.rmempty = true +e = t:option(Value, "dport", translate("目的端口")) +e.rmempty = true +e = t:option(Value, "timeon", translate("起控时间")) +e.placeholder = "00:00" +e.default = '00:00' +e.rmempty = true +e = t:option(Value, "timeoff", translate("停控时间")) +e.placeholder = "00:00" +e.default = '00:00' +e.rmempty = true +e = t:option(MultiValue, "daysofweek", translate("星期(至少选一天,某天不选则该天不进行控制)")) +e.optional = false +e.rmempty = false +e.default = 'Monday Tuesday Wednesday Thursday Friday Saturday Sunday' +e:value("Monday", translate("一")) +e:value("Tuesday", translate("二")) +e:value("Wednesday", translate("三")) +e:value("Thursday", translate("四")) +e:value("Friday", translate("五")) +e:value("Saturday", translate("六")) +e:value("Sunday", translate("日")) +return a + + + diff --git a/luci-app-control-weburl/po/zh-cn/weburl.po b/luci-app-control-weburl/po/zh-cn/weburl.po new file mode 100755 index 0000000..a883cf7 --- /dev/null +++ b/luci-app-control-weburl/po/zh-cn/weburl.po @@ -0,0 +1,2 @@ +msgid "Control" +msgstr "管控" diff --git a/luci-app-control-weburl/root/etc/config/weburl b/luci-app-control-weburl/root/etc/config/weburl new file mode 100755 index 0000000..331fc49 --- /dev/null +++ b/luci-app-control-weburl/root/etc/config/weburl @@ -0,0 +1,27 @@ + +config basic + option algos 'kmp' + option enabled '0' + +config macbind + option timeoff '00:00' + option timeon '00:00' + option daysofweek 'Monday Tuesday Wednesday Thursday Friday Saturday Sunday' + option keyword 'qq.com' + option enable '0' + +config macbind + option timeoff '00:00' + option timeon '00:00' + option daysofweek 'Monday Tuesday Wednesday Thursday Friday Saturday Sunday' + option enable '0' + option keyword 'www' + +config macbind + option timeoff '00:00' + option timeon '00:00' + option daysofweek 'Monday Tuesday Wednesday Thursday Friday Saturday Sunday' + option enable '0' + option keyword 'cmd.exe' + + diff --git a/luci-app-control-weburl/root/etc/init.d/weburl b/luci-app-control-weburl/root/etc/init.d/weburl new file mode 100755 index 0000000..c34d5f1 --- /dev/null +++ b/luci-app-control-weburl/root/etc/init.d/weburl @@ -0,0 +1,65 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (C) 2015 OpenWrt-dist +# Copyright (C) 2016 fw867 +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# wulishui mod. at 20200923 , + +START=98 + +add_rules() { +rulessum=$(grep -c 'macbind' /etc/config/weburl) +for i in $(seq 0 $((rulessum-1))) +do +enable=$(uci get weburl.@macbind[$i].enable 2>/dev/null) +if [ "$enable" == 1 ]; then + macaddr=$(uci get weburl.@macbind[$i].macaddr 2>/dev/null) && MAC="-m mac --mac-source $macaddr" || MAC="" + keyword=$(uci get weburl.@macbind[$i].keyword 2>/dev/null) && STG="-m string --string ${keyword} --algo ${algos}" || STG="" + proto=$(uci get weburl.@macbind[$i].proto 2>/dev/null) || proto="tcp" + sport=$(uci get weburl.@macbind[$i].sport 2>/dev/null) && SPT="--sport ${sport}" || SPT="" + dport=$(uci get weburl.@macbind[$i].dport 2>/dev/null) && DPT="--dport ${dport}" || DPT="" + havesMPT=`echo "$sport"|grep ","` && sMPT="-m multiport" || sMPT="" + havedMPT=`echo "$dport"|grep ","` && dMPT="-m multiport" || dMPT="" + [ -z "$sport" -a -z "$dport" ] && PTS="" || PTS="-p ${proto} ${sMPT} ${SPT} ${dMPT} ${DPT}" + timestart=$(uci get weburl.@macbind[$i].timeon 2>/dev/null) || timestart="00:00" + timestop=$(uci get weburl.@macbind[$i].timeoff 2>/dev/null) || timestop="00:00" + week_days=$(uci get weburl.@macbind[$i].daysofweek |sed 's/ /,/g' 2>/dev/null) + [ "$timestart" = "$timestop" ] && TIME="" || TIME="--timestart ${timestart} --timestop ${timestop}" + [ -z "$week_days" -o "$week_days" = "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" ] && WEEK="" || WEEK="--weekdays ${week_days}" + [ -n "$TIME" -o -n "$WEEK" ] && TME="-m time --kerneltz ${TIME} ${WEEK}" || TME="" + if [ -n "$keyword" -o -n "$MAC" -o -n "$sport" -o -n "$dport" ]; then + iptables -A WEBURL ${MAC} ${PTS} ${TME} ${STG} -j REJECT 2>/dev/null + ip6tables -A WEBURL ${MAC} ${PTS} ${TME} ${STG} -j REJECT 2>/dev/null + fi +fi +done +} + +start(){ +enabled=`uci get weburl.@basic[0].enabled 2>/dev/null` +if [ "$enabled" == 1 ]; then + ENsum=`grep -c 'enable .1.' /etc/config/weburl` + if [ "$ENsum" -gt 0 ]; then + algos=`uci get weburl.@basic[0].algos 2>/dev/null` + iptables -N WEBURL 2>/dev/null || iptables -F WEBURL 2>/dev/null + ip6tables -N WEBURL 2>/dev/null || ip6tables -F WEBURL 2>/dev/null + iptables -C FORWARD -j WEBURL 2>/dev/null || iptables -I FORWARD -j WEBURL + ip6tables -C FORWARD -j WEBURL 2>/dev/null || ip6tables -I FORWARD -j WEBURL + add_rules + grep 'weburl' /etc/firewall.user || echo "/etc/init.d/weburl restart" >> /etc/firewall.user + fi +fi +} + +stop(){ + sed -i '/weburl/d' /etc/firewall.user 2>/dev/null + iptables -D FORWARD -j WEBURL 2>/dev/null + ip6tables -D FORWARD -j WEBURL 2>/dev/null + iptables -F WEBURL 2>/dev/null + ip6tables -F WEBURL 2>/dev/null + iptables - X WEBURL 2>/dev/null + ip6tables -X WEBURL 2>/dev/null +} + diff --git a/luci-app-control-weburl/root/etc/uci-defaults/luci-app-control-weburl b/luci-app-control-weburl/root/etc/uci-defaults/luci-app-control-weburl new file mode 100755 index 0000000..fed8291 --- /dev/null +++ b/luci-app-control-weburl/root/etc/uci-defaults/luci-app-control-weburl @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@weburl[-1] + add ucitrack weburl + set ucitrack.@weburl[-1].init=weburl + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/luci-app-eqos/Makefile b/luci-app-eqos/Makefile new file mode 100755 index 0000000..f73fa78 --- /dev/null +++ b/luci-app-eqos/Makefile @@ -0,0 +1,100 @@ +# +# Copyright (C) 2006-2017 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=eqos +PKG_RELEASE:=2 +LUCI_DIR:=/usr/lib/lua/luci + +PKG_MAINTAINER:=Jianhui Zhao + +include $(INCLUDE_DIR)/package.mk + +define Package/eqos + SECTION:=net + CATEGORY:=Network + DEPENDS:=+tc +kmod-sched-core +kmod-ifb + TITLE:=Easy QoS(Support speed limit based on IP address) + PKGARCH:=all +endef + + +define Package/luci-app-eqos + SECTION:=luci + CATEGORY:=LuCI + TITLE:=EQOS - LuCI interface + PKGARCH:=all + DEPENDS:=+luci-base +eqos + SUBMENU:=3. Applications +endef + +define Package/luci-app-eqos/description + Luci interface for the eqos. +endef + +define Package/luci-i18n-eqos-zh-cn + SECTION:=luci + CATEGORY:=LuCI + TITLE:=luci-app-eqos - zh-cn translation + HIDDEN:=1 + DEPENDS:=luci-app-eqos + DEFAULT:=LUCI_LANG_zh-cn + PKGARCH:=all +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/eqos/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/eqos.sh $(1)/usr/sbin/eqos + $(INSTALL_BIN) ./files/eqos.init $(1)/etc/init.d/eqos + $(INSTALL_BIN) ./files/eqos.hotplug $(1)/etc/hotplug.d/iface/10-eqos + $(INSTALL_CONF) ./files/eqos.config $(1)/etc/config/eqos +endef + +define Package/luci-app-eqos/install + $(INSTALL_DIR) $(1)$(LUCI_DIR)/controller $(1)$(LUCI_DIR)/model/cbi $(1)$(LUCI_DIR)/i18n $(1)/etc/uci-defaults + $(INSTALL_DATA) ./files/eqos-controller.lua $(1)$(LUCI_DIR)/controller/eqos.lua + $(INSTALL_DATA) ./files/eqos-cbi.lua $(1)$(LUCI_DIR)/model/cbi/eqos.lua + $(INSTALL_BIN) ./files/uci-defaults-eqos $(1)/etc/uci-defaults/luci-eqos +endef + +define Package/luci-app-eqos/postinst +#!/bin/sh +which uci > /dev/null || exit 0 +uci -q get ucitrack.@eqos[0] > /dev/null || { + uci add ucitrack eqos > /dev/null + uci set ucitrack.@eqos[0].init=eqos + uci commit +} +endef + +define Package/luci-app-eqos/postrm +#!/bin/sh +which uci > /dev/null || exit 0 +uci -q get ucitrack.@eqos[0] > /dev/null && { + uci delete ucitrack.@eqos[0] + uci commit +} +endef + +define Package/luci-i18n-eqos-zh-cn/install + $(INSTALL_DIR) $(1)$(LUCI_DIR)/i18n + po2lmo ./files/po/zh-cn/eqos.po $(1)$(LUCI_DIR)/i18n/eqos.zh-cn.lmo +endef + +$(eval $(call BuildPackage,eqos)) +$(eval $(call BuildPackage,luci-app-eqos)) +$(eval $(call BuildPackage,luci-i18n-eqos-zh-cn)) \ No newline at end of file diff --git a/luci-app-eqos/files/eqos-cbi.lua b/luci-app-eqos/files/eqos-cbi.lua new file mode 100755 index 0000000..9ad8795 --- /dev/null +++ b/luci-app-eqos/files/eqos-cbi.lua @@ -0,0 +1,39 @@ +local ipc = require "luci.ip" + +local m = Map("eqos", translate("Network speed control service")) + +local s = m:section(TypedSection, "eqos", "") +s.anonymous = true + +local e = s:option(Flag, "enabled", translate("Enable")) +e.rmempty = false + +local dl = s:option(Value, "download", translate("Download speed (Mbit/s)"), translate("Total bandwidth")) +dl.datatype = "and(uinteger,min(1))" + +local ul = s:option(Value, "upload", translate("Upload speed (Mbit/s)"), translate("Total bandwidth")) +ul.datatype = "and(uinteger,min(1))" + +s = m:section(TypedSection, "device", translate("Speed limit based on IP address")) +s.template = "cbi/tblsection" +s.anonymous = true +s.addremove = true +s.sortable = true + +local ip = s:option(Value, "ip", translate("IP address")) + +ipc.neighbors({family = 4, dev = "br-lan"}, function(n) + if n.mac and n.dest then + ip:value(n.dest:string(), "%s (%s)" %{ n.dest:string(), n.mac }) + end +end) + +dl = s:option(Value, "download", translate("Download speed (Mbit/s)")) +dl.datatype = "and(uinteger,min(1))" + +ul = s:option(Value, "upload", translate("Upload speed (Mbit/s)")) +ul.datatype = "and(uinteger,min(1))" + +comment = s:option(Value, "comment", translate("Comment")) + +return m diff --git a/luci-app-eqos/files/eqos-controller.lua b/luci-app-eqos/files/eqos-controller.lua new file mode 100755 index 0000000..8d1cfa4 --- /dev/null +++ b/luci-app-eqos/files/eqos-controller.lua @@ -0,0 +1,13 @@ +module("luci.controller.eqos", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/eqos") then + return + end + + local page + + entry({"admin","Control"}, firstchild(), "Control", 87).dependent = false + page = entry({"admin", "control", "eqos"}, cbi("eqos"), _("EQoS"), 15) + page.dependent = true +end diff --git a/luci-app-eqos/files/eqos.config b/luci-app-eqos/files/eqos.config new file mode 100755 index 0000000..bf2a738 --- /dev/null +++ b/luci-app-eqos/files/eqos.config @@ -0,0 +1,12 @@ +# The bandwidth unit is Mbit/s +config eqos + option enabled 0 + option download 100 + option upload 20 + +# Limiting the bandwidth of a single Device +#config device +# option ip "192.168.1.100" +# option download 10 +# option upload 5 +# option comment "test" diff --git a/luci-app-eqos/files/eqos.hotplug b/luci-app-eqos/files/eqos.hotplug new file mode 100755 index 0000000..d70034a --- /dev/null +++ b/luci-app-eqos/files/eqos.hotplug @@ -0,0 +1,5 @@ +#!/bin/sh +[ "$ACTION" = "ifup" ] || exit 0 +[ "$INTERFACE" = "lan" ] || exit 0 + +/etc/init.d/eqos start diff --git a/luci-app-eqos/files/eqos.init b/luci-app-eqos/files/eqos.init new file mode 100755 index 0000000..ec6984c --- /dev/null +++ b/luci-app-eqos/files/eqos.init @@ -0,0 +1,39 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +START=50 + +parse_device() { + local cfg="$1" ip download upload + + config_get ip "$cfg" ip + config_get download "$cfg" download + config_get upload "$cfg" upload + + eqos add $ip $download $upload +} + +eqos_start() { + local cfg="$1" enabled download upload + + config_get_bool enabled "$cfg" enabled 0 + [ $enabled -eq 0 ] && return 0 + + config_get download "$cfg" download + config_get upload "$cfg" upload + + eqos start $download $upload + + config_foreach parse_device device +} + +start() { + eqos stop + + config_load eqos + config_foreach eqos_start eqos +} + +stop() { + eqos stop +} \ No newline at end of file diff --git a/luci-app-eqos/files/eqos.sh b/luci-app-eqos/files/eqos.sh new file mode 100755 index 0000000..b6ff5ea --- /dev/null +++ b/luci-app-eqos/files/eqos.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +dev=br-lan + +stop_qos() { + tc qdisc del dev $dev root 2>/dev/null + tc qdisc del dev $dev ingress 2>/dev/null + tc qdisc del dev ${dev}-ifb root 2>/dev/null + ip link del dev ${dev}-ifb 2>/dev/null +} + +start_qos() { + local dl=$1 + local up=$2 + + tc qdisc add dev $dev root handle 1: htb + tc class add dev $dev parent 1: classid 1:1 htb rate ${dl}mbit + + ip link add dev ${dev}-ifb name ${dev}-ifb type ifb + ip link set dev ${dev}-ifb up + + tc qdisc add dev ${dev}-ifb root handle 1: htb + tc class add dev ${dev}-ifb parent 1: classid 1:1 htb rate ${up}mbit + + tc qdisc add dev $dev ingress + tc filter add dev $dev parent ffff: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ${dev}-ifb +} + +case "$1" in + "stop") + stop_qos + ;; + "start") + stop_qos + start_qos $2 $3 + ;; + "add") + ip="$2" + dl="$3" + up="$4" + + cnt=$(tc class show dev $dev | wc -l) + + tc class add dev $dev parent 1:1 classid 1:1$cnt htb rate ${dl}mbit ceil ${dl}mbit + tc filter add dev $dev parent 1:0 protocol ip u32 match ip dst $ip flowid 1:1$cnt + + tc class add dev ${dev}-ifb parent 1:1 classid 1:1$cnt htb rate ${up}mbit ceil ${up}mbit + tc filter add dev ${dev}-ifb parent 1:0 protocol ip u32 match ip src $ip flowid 1:1$cnt + ;; + *) + echo "Usage: $0 [options]" + echo "Commands:" + echo " start dl_rate up_rate #Total bandwidth (Mbit/s)" + echo " stop" + echo " add ip dl_rate up_rate #Limiting the bandwidth of a single IP (Mbit/s)" + echo "Example:" + echo " $0 start 30 20 # Total bandwidth: down 30Mbit/s up 20Mbit/s" + echo " $0 add 192.168.22.12 10 2 # down 10Mbit/s up 2Mbit/s" + ;; +esac \ No newline at end of file diff --git a/luci-app-eqos/files/po/zh-cn/eqos.po b/luci-app-eqos/files/po/zh-cn/eqos.po new file mode 100755 index 0000000..80eff58 --- /dev/null +++ b/luci-app-eqos/files/po/zh-cn/eqos.po @@ -0,0 +1,44 @@ +msgid "" +msgstr "" +"Project-Id-Version: LuCi Chinese Translation\n" +"Report-Msgid-Bugs-To: \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Pootle 2.0.6\n" + + +msgid "EQoS" +msgstr "网速控制" + +msgid "eqos" +msgstr "网速控制" + +msgid "Comment" +msgstr "注解" + +msgid "Download speed (Mbit/s)" +msgstr "下载速度 (Mbit/s)" + +msgid "Enable" +msgstr "开启" + +msgid "QoS" +msgstr "QoS" + +msgid "Network speed control service" +msgstr "网速控制服务" + +msgid "Upload speed (Mbit/s)" +msgstr "上传速度 (Mbit/s)" + +msgid "Speed limit based on IP address" +msgstr "IP限速" + +msgid "Total bandwidth" +msgstr "总带宽" + +msgid "Flow control setting" +msgstr "流控设置" \ No newline at end of file diff --git a/luci-app-eqos/files/uci-defaults-eqos b/luci-app-eqos/files/uci-defaults-eqos new file mode 100755 index 0000000..8aee480 --- /dev/null +++ b/luci-app-eqos/files/uci-defaults-eqos @@ -0,0 +1,9 @@ +#!/bin/sh + +uci -q get ucitrack.@eqos[0] > /dev/null || { + uci add ucitrack eqos > /dev/null + uci set ucitrack.@eqos[0].init=eqos + uci commit +} + +exit 0 diff --git a/pandownload-fs-openwrt/Makefile b/pandownload-fs-openwrt/Makefile new file mode 100755 index 0000000..c87dc01 --- /dev/null +++ b/pandownload-fs-openwrt/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (C) 2016-2017 GitHub +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=pandownload-fake-server +PKG_VERSION:=1 +PKG_RELEASE:=1 +PKG_LICENSE:=GPLv3 +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/pandownload-fake-server + SECTION:=luci + CATEGORY:=LuCI + TITLE:=pandownload-fake-server + PKGARCH:=all +endef + +define Package/pandownload-fake-server/description + pandownload-fake-server Support Packages. +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/pandownload-fake-server/install + $(INSTALL_DIR) $(1)//www + $(CP) ./files/* $(1)/www/ +endef + +$(eval $(call BuildPackage,pandownload-fake-server)) diff --git a/pandownload-fs-openwrt/files/api/init b/pandownload-fs-openwrt/files/api/init new file mode 100755 index 0000000..cd09ab4 --- /dev/null +++ b/pandownload-fs-openwrt/files/api/init @@ -0,0 +1 @@ +{"srecord":{"autoQuery":true},"loginurl":{"url":"http:\/\/pandownload.com\/bdlogin.html"},"wke":"http:\/\/dl.pandownload.club\/dl\/node-190312.dll","pcscfg":{"appid":250528,"ua":"","ct":0},"flag":1,"ad":{"url":"https:\/\/pandownload.com\/donate.html","image":"http:\/\/pandownload.com\/images\/donate.png","attribute":"width=\"88\" height=\"100\" padding=\"0,0,5,0\"","rand":100},"bdc":["aF5yaHQQfQt3E3lxdHdjVmF4f3hae3JsfFxIbGxbW152FHF0anpdW3R5UHR1H1hxdwdoTGRMcXR1THsRbF92XXJbdmpveF93Yl9TE3dod3tYaXYIc1oRXGZKbVR1aGkGcV57dmleen1wEAYEdnV9BXF3BQFxd3sCaGh2BHB0BgdpW3F2c3pbAXF3ewJoaAYEcHQGBHZ1fQVxdwUBcXd7AmhoBgRwdAYEdnV9BXF3BQFxd3sCaGgGBHB0BgR2dX0FcXcFAXF3ewJoaAYEcHQGBHZ1fQVxdwUBcXd7AmhoBgRwdAYEdnV9BXF3BQFxd3sCaGgGBHB0BgRpB21SYXYFFH0UDmpben5afkgCdmsFAH9ydxMIflxqEnUHWxVpdgUTcwdsTH0UcBBpdndddV1+XWh2altzWlpLaVxbWH1cXEh1XWMXfAZ5FnR0fV99aXlcagZrWHUHaRZ9EXVJcnRTXH1MYhB9BlFddVoNDw=="],"timestamp":1586998638,"code":0,"message":"success"} \ No newline at end of file diff --git a/pandownload-fs-openwrt/files/api/latest b/pandownload-fs-openwrt/files/api/latest new file mode 100755 index 0000000..f9eaa8e --- /dev/null +++ b/pandownload-fs-openwrt/files/api/latest @@ -0,0 +1 @@ +{"version":"2.2.2","url":"https:\/\/dl1.cnponer.com\/files\/PanDownload_v2.2.2.zip","web":"https:\/\/www.lanzous.com\/i8ua9na","detail":"\u66f4\u65b0\u65f6\u95f4: 2020-01-24\n\u66f4\u65b0\u5185\u5bb9:\n1. \u754c\u9762\u4f18\u5316\n2. bug\u4fee\u590d","md5":"13d3da755509afe3be8f7fc191a50cbd","code":0,"message":"success"} \ No newline at end of file diff --git a/pandownload-fs-openwrt/files/api/script/list b/pandownload-fs-openwrt/files/api/script/list new file mode 100755 index 0000000..90231df --- /dev/null +++ b/pandownload-fs-openwrt/files/api/script/list @@ -0,0 +1 @@ +{"scripts":[{"name":"search_pandown.lua","remove":true},{"name":"search_ncckl.lua","remove":true},{"name":"search_quzhuanpan.lua","remove":true},{"name":"anime_01.lua","remove":true},{"name":"anime_02.lua","remove":true},{"name":"anime_dilidili.lua","remove":true},{"name":"anime","remove":true},{"name":"s","id":2,"url":"http:\/\/pandownload.com\/static\/scripts\/s008","md5":"8dfd9a6c08d06bec27ae358f315cca8f"},{"name":"download_pcs.lua","id":1000,"url":"http:\/\/pandownload.com\/static\/scripts\/download_pcs.lua","md5":"38770cd3e9bcd62f7212941b51ca1378"},{"name":"default","id":0,"url":"http:\/\/pandownload.com\/static\/scripts\/default_0.6.7_3fee3733","md5":"a1124f076924209d0322078000cdc882","key":"568729a30cee34aec0e6fc7a6e303272"}],"code":0,"message":"success"} \ No newline at end of file