mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-29 21:25:13 +08:00
update 2026-08-19 00:23:56
This commit is contained in:
1 parent
4a848652cb
commit
0b11371472
3800 files changed
+15
-2271941
No files matched your search
@@ -1,76 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=adbyby
|
||||
PKG_VERSION:=2.7
|
||||
PKG_RELEASE:=20200315
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Powerful adblock module to block ad.
|
||||
DEPENDS:=@(i386||x86_64||arm||mipsel||mips||aarch64)
|
||||
URL:=http://www.adbyby.com/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Adbyby is a powerful adblock module to block ad,just like adblock.
|
||||
endef
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
ADBYBY_DIR:=amd64
|
||||
endif
|
||||
ifeq ($(ARCH),mipsel)
|
||||
ADBYBY_DIR:=mipsle
|
||||
endif
|
||||
ifeq ($(ARCH),mips)
|
||||
ADBYBY_DIR:=mips
|
||||
endif
|
||||
ifeq ($(ARCH),i386)
|
||||
ADBYBY_DIR:=x86
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
ADBYBY_DIR:=armv7
|
||||
ifeq ($(BOARD),bcm53xx)
|
||||
ADBYBY_DIR:=arm
|
||||
endif
|
||||
ifeq ($(BOARD),kirkwood)
|
||||
ADBYBY_DIR:=arm
|
||||
endif
|
||||
endif
|
||||
ifeq ($(ARCH),aarch64)
|
||||
ADBYBY_DIR:=armv7
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/adbyby
|
||||
$(INSTALL_BIN) ./files/adbyby.sh $(1)/usr/share/adbyby/
|
||||
$(INSTALL_CONF) ./files/adhook.ini $(1)/usr/share/adbyby/
|
||||
$(INSTALL_CONF) ./files/user.action $(1)/usr/share/adbyby/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/adbyby/data
|
||||
$(INSTALL_DATA) ./files/data/* $(1)/usr/share/adbyby/data/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/adbyby/doc
|
||||
$(INSTALL_DATA) ./files/doc/* $(1)/usr/share/adbyby/doc/
|
||||
|
||||
$(INSTALL_BIN) ./files/$(ADBYBY_DIR)/adbyby $(1)/usr/share/adbyby/adbyby
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
PROG_PATH=/usr/share/adbyby
|
||||
err=0
|
||||
until [ $err -ge 5 ]; do
|
||||
if [ -n "$(pgrep $PROG_PATH/adbyby)" ]; then
|
||||
iptables-save | grep ADBYBY >/dev/null || \
|
||||
/etc/init.d/adbyby add_rule
|
||||
sleep 10
|
||||
err=0
|
||||
else
|
||||
$PROG_PATH/adbyby --no-daemon &>/dev/null &
|
||||
sleep 1
|
||||
err=$((err+1))
|
||||
fi
|
||||
done
|
||||
/etc/init.d/adbyby del_rule
|
||||
@@ -1,14 +0,0 @@
|
||||
[cfg]
|
||||
### 2.1 ###
|
||||
listen-address=0.0.0.0:8118
|
||||
buffer-limit=1024
|
||||
keep-alive-timeout=30
|
||||
socket-timeout=60
|
||||
### 2.5 ###
|
||||
max_client_connections=0
|
||||
### 2.6 ###
|
||||
stack_size=200
|
||||
auto_restart=0
|
||||
### 2.7 ###
|
||||
debug=0
|
||||
ipset=0
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,25 +0,0 @@
|
||||
! -----¸üÐÂʱ¼ä: 2018-10-08 23:07:52 by:xwhyc-----
|
||||
.php?ad=
|
||||
/99rejs/js
|
||||
/agetsou.js^
|
||||
/c@*!25.js|$script
|
||||
/cococ-66/$script
|
||||
/defaultts.tc.qq.com/*.ts?index=0&start=0&
|
||||
/defaultts.tc.qq.com/*.ts?index=0&start=0&end=*&ver=4
|
||||
/gg_js/
|
||||
/imgs.js?t=
|
||||
/js/adtop.js|
|
||||
/js/guanggao_gg.js?d=
|
||||
/js/sss/ad.js
|
||||
/static/js/aall.js
|
||||
/unionjs/$script
|
||||
/variety.tc.qq.com/*.mp4^*fmt=hd
|
||||
/variety.tc.qq.com/*.mp4^*fmt=shd
|
||||
/video.dispatch.tc.qq.com/*.mp4^*sdtfrom=
|
||||
/view/image/QT_HY.jpg?t=
|
||||
/view/js/slade.js|$script
|
||||
/vlive.qqvideo.tc.qq.com/*.mp4^*fmt=hd
|
||||
/vlive.qqvideo.tc.qq.com/*.mp4^*fmt=shd
|
||||
/vmind.qqvideo.tc.qq.com/*.mp4^*sdtfrom=
|
||||
/vmindhls.tc.qq.com/*ugc=0&ga=0&gv=0&start=
|
||||
/zzhzgg.js
|
||||
@@ -1,15 +0,0 @@
|
||||
! ------------------------------ ADByby 自定义过滤语法简表---------------------------------
|
||||
! -------------- 规则基于abp规则,并进行了字符替换部分的扩展-----------------------------
|
||||
! ABP规则请参考https://adblockplus.org/zh_CN/filters,下面为大致摘要
|
||||
! "!" 为行注释符,注释行以该符号起始作为一行注释语义,用于规则描述
|
||||
! "*" 为字符通配符,能够匹配0长度或任意长度的字符串,该通配符不能与正则语法混用。
|
||||
! "^" 为分隔符,可以是除了字母、数字或者 _ - . % 之外的任何字符。
|
||||
! "|" 为管线符号,来表示地址的最前端或最末端
|
||||
! "||" 为子域通配符,方便匹配主域名下的所有子域。
|
||||
! "~" 为排除标识符,通配符能过滤大多数广告,但同时存在误杀, 可以通过排除标识符修正误杀链接。
|
||||
! "##" 为元素选择器标识符,后面跟需要隐藏元素的CSS样式例如 #ad_id .ad_class
|
||||
!! 元素隐藏暂不支持全局规则和排除规则
|
||||
!! 字符替换扩展
|
||||
! 文本替换选择器标识符,后面跟需要替换的文本数据,格式:$s@模式字符串@替换后的文本@
|
||||
! 支持通配符*和?
|
||||
! -------------------------------------------------------------------------------------------
|
||||
Whitespace-only changes.
@@ -1,30 +0,0 @@
|
||||
! -----更新时间: 2018-10-08 23:06:11 by:xwhyc-----------------------------------------------
|
||||
! -----广告反馈:http://www.adbyby.com/help.htm QQ群: 79547134(满), 364066294(满),470705224(满),534897434,438394572--------------
|
||||
|
||||
|
||||
!-------------------------------------------
|
||||
/showadv/
|
||||
3199.cn###ad640,[id^="ad0"]
|
||||
76fengyun.com###down_box{display:block!important;}.gggg,.ggao
|
||||
9553.com##[class="zm"]
|
||||
962.net##.show_ad,.g-962-ad
|
||||
amazon.cn##.adv-float-div
|
||||
downsx.rocks##.adbox,.Left-ad3_fixed,.google-ad2_fixed
|
||||
edu-acc.cn###doyoo_monitor
|
||||
fx678.com##[class^="adv-"]
|
||||
||76fengyun.com/body22233.js
|
||||
||76fengyun.com/file/$s@onclick="window.open('*');startWait();"@onclick="window.open(document.getElementById('downpage_link').href);startWait();"@
|
||||
||atanx.alicdn.com/t/tanxssp.js?_v=
|
||||
||biquguan.com/guan/$script
|
||||
||djv99sxoqpv11.cloudfront.net
|
||||
||jmxlaser.com
|
||||
||jump2.bdimg.com/p/$s@<div class="l_post l_post_bright j_l_post clearfix ?????????? "@<div style="display:none"@
|
||||
||nxkycx.com
|
||||
||res.jklan.cn/wp-content/themes/tt/js/system.js?ver=$s@function goto()@function xxx()@
|
||||
||tieba.com/p/$s@<div class="l_post l_post_bright j_l_post clearfix ?????????? "@<div style="display:none"@
|
||||
||ychap.com
|
||||
!-----------------------
|
||||
/qkostn.js|
|
||||
|http://mark.l.qq.com/fcgi-bin/get_video_mark_all*&strAdParam=
|
||||
!---------adbyby---------
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
(function(global){var DOC=global.document,w3c_css=global.getComputedStyle,undef=void 0,reg_combinator=/^\s*([>+~,\s])\s*(\*|(?:[-\w*]|[^\x00-\xa0]|\\.)*)/,trimLeft=/^\s+/,trimRight=/\s+$/,reg_comma=/^\s*,\s*/,reg_sequence=/^([#\.:]|\[\s*)((?:[-\w]|[^\x00-\xa0]|\\.)+)/,reg_pseudo=/^\(\s*("([^"]*)"|'([^']*)'|[^\(\)]*(\([^\(\)]*\))?)\s*\)/,reg_attrib=/^\s*(?:(\S?=)\s*(?:(['"])(.*?)\2|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,reg_attrval=/\\([0-9a-fA-F]{2,2})/g,reg_sensitive=/^(?:title|id|name|class|for|href|src)$/,reg_backslash=/\\/g,reg_tag=/^((?:[-\w\*]|[^\x00-\xa0]|\\.)+)/,reg_parse_pseudo=/(-?)(\d*)n([-+]?\d*)/,reg_quick=/^(^|[#.])((?:[-\w]|[^\x00-\xa0]|\\.)+)$/,has_in=function(a,b){return(a in b)},dom={html:DOC.documentElement,mix:function(target,source){var args=[].slice.call(arguments),key,ride=typeof args[args.length-1]=="boolean"?args.pop():true;target=target||{};for(var i=1;source=args[i++];){for(key in source){if(ride||!has_in(key,target)){target[key]=source[key]}}}return target},rword:/[^, ]+/g,uuid:1,getUid:w3c_css?function(node){return node.uniqueNumber||(node.uniqueNumber=dom.uuid++)}:function(node){var uid=node.getAttribute("uniqueNumber");if(!uid){uid=dom.uuid++;node.setAttribute("uniqueNumber",uid)}return uid},oneObject:function(array,val){if(typeof array=="string"){array=array.match(dom.rword)||[]}var result={},value=val!==undef?val:1;for(var i=0,n=array.length;i<n;i++){result[array[i]]=value}return result}},hash_operator={"=":1,"!=":2,"|=":3,"~=":4,"^=":5,"$=":6,"*=":7},slice=Array.prototype.slice,attrURL=dom.oneObject("action,cite,codebase,data,href,longdesc,lowsrc,src,usemap",2),bools=dom["@bools"]="autofocus,autoplay,async,checked,controls,declare,disabled,defer,defaultchecked,contenteditable,ismap,loop,multiple,noshade,open,noresize,readonly,selected",boolOne=dom.oneObject(bools),fixGetAttribute,fixHasAttribute,fixById,fixByTag,filterPseudoHasExp=function(strchild,strsibling,type){return{exec:function(flags,lastResult,args){var result=[],flag_not=flags.not,child=strchild,sibling=strsibling,ofType=type,cache={},lock={},a=args.a,b=args.b,i=0,ri=0,el,found,diff,count;if(!ofType&&a===1&&b===0){return flag_not?[]:lastResult}for(var checkName=ofType?"nodeName":"nodeType",parent,pid,checkValue;el=lastResult[i++];){parent=el.parentNode;pid=dom.getUid(parent);if(!lock[pid]){count=lock[pid]=1;checkValue=ofType?el.nodeName:1;for(var node=parent[child];node;node=node[sibling]){if(node[checkName]===checkValue){pid=dom.getUid(node);cache[pid]=count++}}}diff=cache[dom.getUid(el)]-b;found=a===0?diff===0:(diff%a===0&&diff/a>=0);(found^flag_not)&&(result[ri++]=el)}return result}}},onePosition=dom.oneObject("eq,gt,lt,first,last,even,odd"),siblingCheck=function(a,b,ret){if(a===b){return ret}var cur=a.nextSibling;while(cur){if(cur===b){return -1}cur=cur.nextSibling}return 1},sortOrder1=function(a,b){if(a===b){sortOrder1.hasDuplicate=true;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition){return a.compareDocumentPosition?-1:1}return a.compareDocumentPosition(b)&4?-1:1},sortOrder2=function(a,b){if(a===b){sortOrder2.hasDuplicate=true;return 0}var al,bl,ap=[],bp=[],aup=a.parentNode,bup=b.parentNode,cur=aup;if(aup===bup){return siblingCheck(a,b)}else{if(!aup){return -1}else{if(!bup){return 1}}}while(cur){ap.unshift(cur);cur=cur.parentNode}cur=bup;while(cur){bp.unshift(cur);cur=cur.parentNode}al=ap.length;bl=bp.length;for(var i=0;i<al&&i<bl;i++){if(ap[i]!==bp[i]){return siblingCheck(ap[i],bp[i])}}return i===al?siblingCheck(a,bp[i],-1):siblingCheck(ap[i],b,1)},_toHex=function(x,y){return String.fromCharCode(parseInt(y,16))},parse_pseudo=function(key,match){var expr=match[3]||match[2];expr=expr?expr.replace(reg_attrval,_toHex):match[1];if(!key.indexOf("nth")){expr=expr.replace(/^\+|\s*/g,"");match=(expr==="even"&&"2n"||expr==="odd"&&"2n+1"||!/\D/.test(expr)&&"0n+"+expr||expr).match(reg_parse_pseudo);return{a:(match[1]+(match[2]||1))-0,b:match[3]-0}}return expr},makeArray=function(nodes,result,flag_multi){nodes=slice.call(nodes,0);if(result){result.push.apply(result,nodes)}else{result=nodes}return flag_multi?dom.unique(result):result},getElementsByTagName=function(tagName,els,flag_xml){var method="getElementsByTagName",elems=[],uniqResult={},prefix;if(flag_xml&&tagName.indexOf(":")>0&&els.length&&els[0].lookupNamespaceURI){var arr=tagName.split(":");prefix=arr[0];tagName=arr[1];method="getElementsByTagNameNS";prefix=els[0].lookupNamespaceURI(prefix)}switch(els.length){case 0:return elems;case 1:var all=prefix?els[0][method](prefix,tagName):els[0][method](tagName);for(var i=0,ri=0,el;el=all[i++];){if(el.nodeType===1){elems[ri++]=el}}return elems;default:for(var nodes,i=0,ri=0;el=els[i++];){nodes=prefix?el[method](prefix,tagName):el[method](tagName);for(var uid,j=0,node;node=nodes[j++];){uid=dom.getUid(node);if(!uniqResult[uid]){uniqResult[uid]=elems[ri++]=node}}}return elems}},getElementsByXPath=function(xpath,context,doc){var result=[];try{if(global.DOMParser){var nodes=doc.evaluate(xpath,context,Line truncated
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,10 +0,0 @@
|
||||
;¸üйæÔòurl,dir,size,reverse,reverse
|
||||
http://update.adbyby.com/rule3/lazy.jpg \data\lazy.txt 385337 4 0
|
||||
http://update.adbyby.com/rule3/video.jpg \data\video.txt 1028 4 0
|
||||
http://update.adbyby.com/rule3/user.action \user.action 512 5 0
|
||||
http://update.adbyby.com/rule3/clean.ini \data\clean.ini 2167 0 0
|
||||
http://update.adbyby.com/rule3/adclear.ini \data\adclear.ini 4901 0 0
|
||||
https://github.com/gchangchen/suho/raw/master/adhook.dll \adhook.dll 117248 0 0 2.4.3.2
|
||||
https://github.com/gchangchen/suho/raw/master/adhook64.dll \adhook64.dll 142848 0 0 2.4.3.2
|
||||
https://github.com/gchangchen/suho/raw/master/adbyby.exe \adbyby.exe 1004183 1 0 2.4.4.0
|
||||
|
||||
Whitespace-only changes.
Binary file not shown.
@@ -1,57 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010-2023 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:=autocore
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/autocore-arm
|
||||
TITLE:=Arm auto core loadbalance script.
|
||||
MAINTAINER:=CN_SZTL
|
||||
DEPENDS:=@(arm||aarch64) \
|
||||
+TARGET_bcm27xx:bcm27xx-userland \
|
||||
+TARGET_bcm53xx:nvram +ethtool
|
||||
VARIANT:=arm
|
||||
endef
|
||||
|
||||
define Package/autocore-x86
|
||||
TITLE:=x86/x64 auto core loadbalance script.
|
||||
MAINTAINER:=Lean
|
||||
DEPENDS:=@TARGET_x86 +bc +lm-sensors +ethtool +pciutils
|
||||
VARIANT:=x86
|
||||
endef
|
||||
|
||||
define Package/autocore-arm/description
|
||||
A luci autoconfig hotplug script.
|
||||
endef
|
||||
|
||||
define Package/autocore-x86/description
|
||||
A usb autoconfig hotplug script.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/autocore-arm/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
|
||||
$(INSTALL_BIN) ./files/arm/sbin/ethinfo $(1)/sbin/ethinfo
|
||||
$(INSTALL_BIN) ./files/arm/sbin/usage $(1)/sbin/usage
|
||||
endef
|
||||
|
||||
define Package/autocore-x86/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(CP) ./files/x86/sbin/* $(1)/sbin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,autocore-arm))
|
||||
$(eval $(call BuildPackage,autocore-x86))
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cpu_arch="$(cat "/proc/cpuinfo" | grep "model name" | sed -n "1p" | awk -F ': ' '{print $2}')"
|
||||
[ -z "${cpu_arch}" ] && cpu_arch="ARMv8 Processor"
|
||||
cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)"
|
||||
|
||||
if grep -q "bcm27xx" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(expr $(vcgencmd measure_clock arm | awk -F '=' '{print $2}') / 1000000)Mhz"
|
||||
elif grep -q "bcm53xx" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz"
|
||||
elif grep -q "mvebu" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(cat "/proc/cpuinfo" | grep "BogoMIPS" | sed -n "1p" | awk -F ': ' '{print $2}')MHz"
|
||||
elif ! grep -q "filogic" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
|
||||
if grep -q "rockchip" "/etc/openwrt_release"; then
|
||||
big_cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq 2>"/dev/null") / 1000 2>"/dev/null")"
|
||||
[ -n "${big_cpu_freq}" ] && big_cpu_freq="${big_cpu_freq}MHz "
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -q "ipq" "/etc/openwrt_release"; then
|
||||
if grep -q "ipq40xx" "/etc/openwrt_release"; then
|
||||
sys_temp="$(awk '{ printf("%.1f°C ", $0 / 1000) }' /sys/class/ieee80211/phy*/device/hwmon/hwmon*/temp1_input)"
|
||||
else
|
||||
sys_temp="$(awk '{ printf("%.1f°C ", $0 / 1000) }' /sys/class/thermal/thermal_zone0/temp)"
|
||||
fi
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq}, ${sys_temp})"
|
||||
else
|
||||
if grep -q "bcm27xx" "/etc/openwrt_release"; then
|
||||
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C"
|
||||
else
|
||||
cpu_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
|
||||
fi
|
||||
if grep -q "filogic" "/etc/openwrt_release"; then
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_temp})"
|
||||
else
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${big_cpu_freq}${cpu_freq}, ${cpu_temp})"
|
||||
fi
|
||||
fi
|
||||
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/lua
|
||||
-- Copyright (C) 2022 ImmortalWrt.org
|
||||
|
||||
local util = require "luci.util"
|
||||
local jsonc = require "luci.jsonc"
|
||||
|
||||
local eth_info = {}
|
||||
local ifname, stat
|
||||
|
||||
for ifname, stat in pairs(util.ubus("network.device", "status")) do
|
||||
while true do
|
||||
if (ifname:match("^(br-.+)$")) == ifname then
|
||||
break
|
||||
else
|
||||
if stat["devtype"] ~= "ethernet" then
|
||||
break
|
||||
end
|
||||
if not stat["link-supported"] or #stat["link-supported"] == 0 then
|
||||
break
|
||||
end
|
||||
local status = 0
|
||||
local speed = " - "
|
||||
local duplex = 0
|
||||
|
||||
if(stat.speed ~= nil) then
|
||||
status = stat.carrier and 1 or 0
|
||||
|
||||
if stat.speed:sub(1, 1) == "-" then
|
||||
speed = " - "
|
||||
else
|
||||
speed = stat.speed:sub(1, -2) .. "Mb/s"
|
||||
end
|
||||
|
||||
if stat.carrier and stat.speed:sub(-1) == "F" then
|
||||
duplex = 1
|
||||
else
|
||||
duplex = 0
|
||||
end
|
||||
end
|
||||
eth_info[#eth_info+1] = { name = ifname, status = status,
|
||||
speed = speed, duplex = duplex }
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(eth_info,
|
||||
function(a, b)
|
||||
return a.name < b.name
|
||||
end)
|
||||
|
||||
print(jsonc.stringify(eth_info))
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
NSS_PATH="/sys/kernel/debug/qca-nss-drv/stats"
|
||||
|
||||
cpu_usage="$(top -n1 | awk '/^CPU/ {printf("%d%", 100 - $8)}')"
|
||||
|
||||
[ ! -d "$NSS_PATH" ] || \
|
||||
npu_usage="$(grep '%' "$NSS_PATH"/cpu_load_ubi | awk -F ' ' '{print $2}')"
|
||||
|
||||
if [ -d "$NSS_PATH" ]; then
|
||||
echo -n "CPU: ${cpu_usage}, NPU: ${npu_usage}"
|
||||
else
|
||||
echo -n "CPU: ${cpu_usage}"
|
||||
fi
|
||||
@@ -1,74 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2017 lean <coolsnowwolf@gmail.com>
|
||||
|
||||
START=99
|
||||
|
||||
start()
|
||||
{
|
||||
rfc=4096
|
||||
cc=$(grep -c processor /proc/cpuinfo)
|
||||
rsfe=$(echo $cc*$rfc | bc)
|
||||
sysctl -w net.core.rps_sock_flow_entries=$rsfe >/dev/null
|
||||
for fileRps in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
|
||||
do
|
||||
echo $cc > $fileRps
|
||||
done
|
||||
|
||||
for fileRfc in $(ls /sys/class/net/eth*/queues/rx-*/rps_flow_cnt)
|
||||
do
|
||||
echo $rfc > $fileRfc
|
||||
done
|
||||
|
||||
uci set network.@globals[0].packet_steering=1
|
||||
uci commit network
|
||||
|
||||
a=$(cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq)
|
||||
b=$(echo -n ' : ')
|
||||
c=$(cat /proc/cpuinfo | grep 'core id' | sort -u | wc -l)
|
||||
d=$(echo -n 'C')
|
||||
e=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
|
||||
f=$(echo -n 'T ')
|
||||
g=$(dmesg | grep 'DMI:' | awk -F ',' '{print $1 }' | awk -F ':' '{print $2 }')
|
||||
|
||||
if [ -d /sys/devices/cpu_atom/ ]; then
|
||||
pcore=$(cat /sys/devices/cpu_core/cpus | awk -F- '{print $2}')
|
||||
pc=$(echo "($pcore+1)/2" | bc)
|
||||
ecore1=$(cat /sys/devices/cpu_atom/cpus | awk -F- '{print $1}')
|
||||
ecore2=$(cat /sys/devices/cpu_atom/cpus | awk -F- '{print $2}')
|
||||
ec=$(echo "$ecore2-$ecore1+1" | bc)
|
||||
hydrid='('${pc}'P+'${ec}'E)'
|
||||
fi
|
||||
|
||||
h=${g}' - '${a}${b}${c}${d}${e}${f}${hydrid}
|
||||
|
||||
mkdir -p /tmp/sysinfo
|
||||
echo $h > /tmp/sysinfo/model
|
||||
|
||||
all_pcis=`lspci | grep -i 'eth' | grep -i 'x550' | cut -d ' ' -f 1`
|
||||
all_ifs=`cat /proc/net/dev | grep -i 'eth' | cut -d : -f 1 | sed 's/^[ \t]*//g'`
|
||||
|
||||
for ifname in ${all_ifs}
|
||||
do
|
||||
if_pci=`ethtool -i ${ifname} | grep -i 'bus-info' | cut -d : -f 3-`
|
||||
if [[ "$all_pcis" =~ "$if_pci" ]]
|
||||
then
|
||||
ethtool -s ${ifname} advertise 0x1800000001028
|
||||
fi
|
||||
done
|
||||
|
||||
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
|
||||
b=$(echo "$a" | wc -l)
|
||||
for i in $(seq 1 $b)
|
||||
do
|
||||
c=$(echo "$a" | sed -n ${i}p)
|
||||
ethtool -K $c rx-checksum on >/dev/null 2>&1
|
||||
ethtool -K $c tx-checksum-ip-generic on >/dev/null 2>&1 || (
|
||||
ethtool -K $c tx-checksum-ipv4 on >/dev/null 2>&1
|
||||
ethtool -K $c tx-checksum-ipv6 on >/dev/null 2>&1)
|
||||
ethtool -K $c tx-scatter-gather on >/dev/null 2>&1
|
||||
ethtool -K $c gso on >/dev/null 2>&1
|
||||
ethtool -K $c tso on >/dev/null 2>&1
|
||||
ethtool -K $c ufo on >/dev/null 2>&1
|
||||
done
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
MHz=`grep 'MHz' /proc/cpuinfo | cut -c11- |sed -n '1p'`
|
||||
|
||||
if [ "$(grep 'AMD' /proc/cpuinfo)" != "" ]; then
|
||||
TEMP=`sensors 2>/dev/null | grep 'Tctl' | cut -c16-`
|
||||
else
|
||||
TEMP=`sensors 2>/dev/null | grep 'Core 0' | cut -c12-`
|
||||
fi
|
||||
|
||||
echo "$MHz MHz $TEMP "
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
|
||||
b=$(echo "$a" | wc -l)
|
||||
rm -f /tmp/state/ethinfo
|
||||
|
||||
echo -n "[" > /tmp/state/ethinfo
|
||||
|
||||
for i in $(seq 1 $b)
|
||||
do
|
||||
h=$(echo '{"name":' )
|
||||
c=$(echo "$a" | sed -n ${i}p)
|
||||
d=$(ethtool $c)
|
||||
|
||||
e=$(echo "$d" | grep "Link detected" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
|
||||
if [ $e = yes ]; then
|
||||
l=1
|
||||
else
|
||||
l=0
|
||||
fi
|
||||
|
||||
f=$(echo "$d" | grep "Speed" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g' | tr -d "Unknown!")
|
||||
[ -z "$f" ] && f=" - "
|
||||
|
||||
g=$(echo "$d" | grep "Duplex" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
|
||||
if [ "$g" == "Full" ]; then
|
||||
x=1
|
||||
else
|
||||
x=0
|
||||
fi
|
||||
|
||||
echo -n "$h \"$c\", \"status\": $l, \"speed\": \"$f\", \"duplex\": $x}," >> /tmp/state/ethinfo
|
||||
done
|
||||
|
||||
sed -i 's/.$//' /tmp/state/ethinfo
|
||||
|
||||
echo -n "]" >> /tmp/state/ethinfo
|
||||
|
||||
cat /tmp/state/ethinfo
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $(busybox ps -w | grep getcpu | grep -v grep | wc -l) -le 2 ]; then
|
||||
AT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
|
||||
sleep 1
|
||||
BT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
|
||||
printf "%.01f%%" $(echo $AT $BT | awk '{print (($4-$2)/($3-$1))*100}') >/tmp/cpuusage
|
||||
fi
|
||||
@@ -1,75 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddns-scripts_aliyun
|
||||
PKG_VERSION:=1.0.3
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Sense <sensec@gmail.com>
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=DDNS extension for AliYun.com
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+ddns-scripts +wget-ssl +openssl-util
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Dynamic DNS Client scripts extension for AliYun.com
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(CP) ./*.sh $(PKG_BUILD_DIR)
|
||||
$(CP) ./*.json $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/preinst
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/update_aliyun_com.sh $(1)/usr/lib/ddns
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/aliyun.com.json $(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
# remove old services file entries
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
# and create new
|
||||
printf "%s\\t\\t%s\\n" '"aliyun.com"' '"update_aliyun_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
||||
printf "%s\\t\\t%s\\n" '"aliyun.com"' '"update_aliyun_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
||||
# on real system restart service if enabled
|
||||
[ -z "$${IPKG_INSTROOT}" ] && {
|
||||
/etc/init.d/ddns enabled && \
|
||||
/etc/init.d/ddns start >/dev/null 2>&1
|
||||
}
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
# remove services file entries
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "aliyun.com",
|
||||
"ipv4": {
|
||||
"url": "update_aliyun_com.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_aliyun_com.sh"
|
||||
}
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 用于阿里云解析的DNS更新脚本
|
||||
# 2017-2018 Sense <sensec at gmail dot com>
|
||||
# 阿里云解析API文档 https://help.aliyun.com/document_detail/29739.html
|
||||
#
|
||||
# 本脚本由 dynamic_dns_functions.sh 内的函数 send_update() 调用
|
||||
#
|
||||
# 需要在 /etc/config/ddns 中设置的选项
|
||||
# option username - 阿里云API访问账号 Access Key ID。可通过 aliyun.com 帐号管理的 accesskeys 获取, 或者访问 https://ak-console.aliyun.com
|
||||
# option password - 阿里云API访问密钥 Access Key Secret
|
||||
# option domain - 完整的域名。建议主机与域名之间使用 @符号 分隔,否则将以第一个 .符号 之前的内容作为主机名
|
||||
#
|
||||
|
||||
# 检查传入参数
|
||||
[ -z "$username" ] && write_log 14 "配置错误!保存阿里云API访问账号的'用户名'不能为空"
|
||||
[ -z "$password" ] && write_log 14 "配置错误!保存阿里云API访问密钥的'密码'不能为空"
|
||||
|
||||
# 检查外部调用工具
|
||||
WGET_SSL='wget'
|
||||
[ -n "$WGET_SSL" ] || write_log 13 "使用阿里云API需要 GNU Wget 支持,请先安装"
|
||||
command -v sed >/dev/null 2>&1 || write_log 13 "使用阿里云API需要 sed 支持,请先安装"
|
||||
command -v openssl >/dev/null 2>&1 || write_log 13 "使用阿里云API需要 openssl-util 支持,请先安装"
|
||||
|
||||
# 包含用于解析 JSON 格式返回值的函数
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
# 变量声明
|
||||
local __HOST __DOMAIN __TYPE __URLBASE __CMDBASE __URLARGS __SEPARATOR __RECID
|
||||
[ $use_https -eq 0 ] && __URLBASE="http://alidns.aliyuncs.com/" || __URLBASE="https://alidns.aliyuncs.com/"
|
||||
__SEPARATOR="&"
|
||||
|
||||
# 从 $domain 分离主机和域名
|
||||
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
|
||||
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"
|
||||
|
||||
# 设置记录类型
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# 构造基本通信命令
|
||||
build_command() {
|
||||
__CMDBASE="$WGET_SSL --no-hsts -nv -t 1 -O $DATFILE -o $ERRFILE"
|
||||
# 绑定用于通信的主机/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local bind_ip run_prog
|
||||
[ $use_ipv6 -eq 0 ] && run_prog="network_get_ipaddr" || run_prog="network_get_ipaddr6"
|
||||
eval "$run_prog bind_ip $bind_network" || \
|
||||
write_log 13 "无法使用 '$run_prog $bind_network' 获取本地IP地址 - 错误代码: '$?'"
|
||||
write_log 7 "强制使用IP '$bind_ip' 通信"
|
||||
__CMDBASE="$__CMDBASE --bind-address=$bind_ip"
|
||||
fi
|
||||
# 强制设定IP版本
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# 设置CA证书参数
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__CMDBASE="$__CMDBASE --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-certificate=${cacert}"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-directory=${cacert}"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "在 '$cacert' 中未找到用于 HTTPS 通信的有效证书"
|
||||
fi
|
||||
fi
|
||||
# 如果没有设置,禁用代理 (这可能是 .wgetrc 或环境设置错误)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --no-proxy"
|
||||
}
|
||||
|
||||
# 用于阿里云API的通信函数
|
||||
aliyun_transfer() {
|
||||
local __PARAM=$*
|
||||
local __CNT=0
|
||||
local __RUNPROG __ERR PID_SLEEP
|
||||
|
||||
[ $# -eq 0 ] && write_log 12 "'aliyun_transfer()' 出错 - 参数数量错误"
|
||||
|
||||
while : ; do
|
||||
build_Request $__PARAM
|
||||
__RUNPROG="$__CMDBASE '${__URLBASE}?${__URLARGS}'"
|
||||
|
||||
write_log 7 "#> $__RUNPROG"
|
||||
eval $__RUNPROG
|
||||
__ERR=$?
|
||||
[ $__ERR -eq 0 ] && return 0
|
||||
|
||||
write_log 3 "wget 错误代码: '$__ERR'"
|
||||
write_log 7 "$(cat $ERRFILE)"
|
||||
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "传输失败 - 详细模式: $VERBOSE - 出错后不再重试"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__CNT=$(( $__CNT + 1 ))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
|
||||
write_log 14 "$retry_count 次重试后传输还是失败"
|
||||
|
||||
write_log 4 "传输失败 - $__CNT/$retry_count 在 $RETRY_SECONDS 秒后重试"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
}
|
||||
|
||||
# 百分号编码
|
||||
percentEncode() {
|
||||
if [ -z "${1//[A-Za-z0-9_.~-]/}" ]; then
|
||||
echo -n "$1"
|
||||
else
|
||||
local string=$1; local i=0; local ret chr
|
||||
while [ $i -lt ${#string} ]; do
|
||||
chr=${string:$i:1}
|
||||
[ -z "${chr#[^A-Za-z0-9_.~-]}" ] && chr=$(printf '%%%02X' "'$chr")
|
||||
ret="$ret$chr"
|
||||
i=$(( $i + 1 ))
|
||||
done
|
||||
echo -n "$ret"
|
||||
fi
|
||||
}
|
||||
|
||||
# 构造阿里云解析请求参数
|
||||
build_Request() {
|
||||
local args=$*; local string
|
||||
local HTTP_METHOD="GET"
|
||||
|
||||
# 添加请求参数
|
||||
__URLARGS=
|
||||
for string in $args; do
|
||||
case "${string%%=*}" in
|
||||
Format|TTL|Version|AccessKeyId|SignatureMethod|Timestamp|SignatureVersion|SignatureNonce|Signature) ;; # 过滤公共参数
|
||||
*) __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}");;
|
||||
esac
|
||||
done
|
||||
__URLARGS="${__URLARGS:1}"
|
||||
|
||||
# 附加公共参数
|
||||
string="Format=JSON"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="TTL=600";__URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="Version=2015-01-09"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="AccessKeyId=$username"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="SignatureMethod=HMAC-SHA1"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="Timestamp="$(date -u '+%Y-%m-%dT%H:%M:%SZ'); __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="SignatureVersion=1.0"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="SignatureNonce="$(cat '/proc/sys/kernel/random/uuid'); __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
|
||||
# 对请求参数进行排序,用于生成签名
|
||||
string=$(echo -n "$__URLARGS" | sed 's/\'"${__SEPARATOR}"'/\n/g' | sort | sed ':label; N; s/\n/\'"${__SEPARATOR}"'/g; b label')
|
||||
# 构造用于计算签名的字符串
|
||||
string="${HTTP_METHOD}${__SEPARATOR}"$(percentEncode "/")"${__SEPARATOR}"$(percentEncode "$string")
|
||||
# 字符串计算签名HMAC值
|
||||
local signature=$(echo -n "$string" | openssl dgst -sha1 -hmac "${password}&" -binary)
|
||||
# HMAC值编码成字符串,得到签名值
|
||||
signature=$(echo -n "$signature" | openssl base64)
|
||||
|
||||
# 附加签名参数
|
||||
string="Signature=$signature"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
}
|
||||
|
||||
# 添加解析记录
|
||||
add_domain() {
|
||||
local value
|
||||
aliyun_transfer "Action=AddDomainRecord" "DomainName=${__DOMAIN}" "RR=${__HOST}" "Type=${__TYPE}" "Value=${__IP}" || write_log 14 "服务器通信失败"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var value "RecordId"
|
||||
[ -z "$value" ] && write_log 14 "添加新解析记录失败"
|
||||
write_log 7 "添加新解析记录成功"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 修改解析记录
|
||||
update_domain() {
|
||||
local value
|
||||
aliyun_transfer "Action=UpdateDomainRecord" "RecordId=${__RECID}" "RR=${__HOST}" "Type=${__TYPE}" "Value=${__IP}" || write_log 14 "服务器通信失败"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var value "RecordId"
|
||||
[ -z "$value" ] && write_log 14 "修改解析记录失败"
|
||||
write_log 7 "修改解析记录成功"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 启用解析记录
|
||||
enable_domain() {
|
||||
local value
|
||||
aliyun_transfer "Action=SetDomainRecordStatus" "RecordId=${__RECID}" "Status=Enable" || write_log 14 "服务器通信失败"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var value "Status"
|
||||
[ "$value" != "Enable" ] && write_log 14 "启用解析记录失败"
|
||||
write_log 7 "启用解析记录成功"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 获取子域名解析记录列表
|
||||
describe_domain() {
|
||||
local count value; local ret=0
|
||||
aliyun_transfer "Action=DescribeSubDomainRecords" "SubDomain=${__HOST}.${__DOMAIN}" || write_log 14 "服务器通信失败"
|
||||
write_log 7 "获取到解析记录: $(cat "$DATFILE" 2> /dev/null)"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var count "TotalCount"
|
||||
if [ $count -eq 0 ]; then
|
||||
write_log 7 "解析记录不存在"
|
||||
ret=1
|
||||
else
|
||||
local i=1;
|
||||
while [ $i -le $count ]; do
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_select "DomainRecords" >/dev/null 2>&1
|
||||
json_select "Record" >/dev/null 2>&1
|
||||
json_select $i >/dev/null 2>&1
|
||||
i=$(( $i + 1 ))
|
||||
json_get_var value "Type"
|
||||
if [ "$value" != "${__TYPE}" ]; then
|
||||
write_log 7 "当前解析类型: ${__TYPE}, 获得不匹配类型: $value"
|
||||
ret=1; continue
|
||||
else
|
||||
ret=0
|
||||
json_get_var __RECID "RecordId"
|
||||
write_log 7 "获得解析记录ID: ${__RECID}, 类型: $value"
|
||||
json_get_var value "Locked"
|
||||
[ $value -ne 0 ] && write_log 14 "解析记录被锁定"
|
||||
json_get_var value "Status"
|
||||
[ "$value" != "ENABLE" ] && ret=$(( $ret | 2 )) && write_log 7 "解析记录被禁用"
|
||||
json_get_var value "Value"
|
||||
[ "$value" != "${__IP}" ] && ret=$(( $ret | 4 )) && write_log 7 "地址需要修改"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
ret=$?
|
||||
if [ $ret -eq 1 ]; then
|
||||
sleep 3 && add_domain
|
||||
else
|
||||
[ $(( $ret & 2 )) -ne 0 ] && sleep 3 && enable_domain
|
||||
[ $(( $ret & 4 )) -ne 0 ] && sleep 3 && update_domain
|
||||
fi
|
||||
|
||||
return 0
|
||||
@@ -1,81 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddns-scripts_dnspod
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Small_5
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=DDNS extension for Dnspod.com/Dnspod.cn
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+ddns-scripts +wget-ssl +ca-bundle
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Dynamic DNS Client scripts extension for Dnspod.com/Dnspod.cn
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(CP) ./*.sh $(PKG_BUILD_DIR)
|
||||
$(CP) ./*.json $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/preinst
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.sh $(1)/usr/lib/ddns
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.json $(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
# remove old services file entries
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
# and create new
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.com"' '"update_dnspod_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.cn"' '"update_dnspod_cn.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.com"' '"update_dnspod_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.cn"' '"update_dnspod_cn.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
||||
# on real system restart service if enabled
|
||||
[ -z "$${IPKG_INSTROOT}" ] && {
|
||||
/etc/init.d/ddns enabled && \
|
||||
/etc/init.d/ddns start >/dev/null 2>&1
|
||||
}
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
# remove services file entries
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "dnspod.cn",
|
||||
"ipv4": {
|
||||
"url": "update_dnspod_cn.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_dnspod_cn.sh"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "dnspod.com",
|
||||
"ipv4": {
|
||||
"url": "update_dnspod_com.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_dnspod_com.sh"
|
||||
}
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#检查传入参数
|
||||
[ -z "$username" ] && write_log 14 "Configuration error! [User name] cannot be empty"
|
||||
[ -z "$password" ] && write_log 14 "Configuration error! [Password] cannot be empty"
|
||||
|
||||
#检查外部调用工具
|
||||
WGET_SSL='wget'
|
||||
[ -n "$WGET_SSL" ] || write_log 13 "GNU Wget support is required to use dnspod API. Please install first"
|
||||
|
||||
# 变量声明
|
||||
local __URLBASE __HOST __DOMAIN __TYPE __CMDBASE __POST __POST1 __RECIP __RECID __value __TTL
|
||||
__URLBASE="https://dnsapi.cn/"
|
||||
|
||||
# 从 $domain 分离主机和域名
|
||||
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
|
||||
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"
|
||||
|
||||
# 设置记录类型
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# 构造基本通信命令
|
||||
build_command() {
|
||||
__CMDBASE="$WGET_SSL --no-hsts -nv -t 1 -O $DATFILE -o $ERRFILE"
|
||||
# 绑定用于通信的主机/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local bind_ip run_prog
|
||||
[ $use_ipv6 -eq 0 ] && run_prog="network_get_ipaddr" || run_prog="network_get_ipaddr6"
|
||||
eval "$run_prog bind_ip $bind_network" || \
|
||||
write_log 13 "Unable to get local IP address with '$run_prog $ bind_network' - error code: '$?'"
|
||||
write_log 7 "Forced use of IP '$bind_ip' communication"
|
||||
__CMDBASE="$__CMDBASE --bind-address=$bind_ip"
|
||||
fi
|
||||
# 强制设定IP版本
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# 设置CA证书参数
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__CMDBASE="$__CMDBASE --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-certificate=${cacert}"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-directory=${cacert}"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "A valid certificate for HTTPS communication was not found in '$cacert'"
|
||||
fi
|
||||
fi
|
||||
# 如果没有设置,禁用代理 (这可能是 .wgetrc 或环境设置错误)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --no-proxy"
|
||||
__CMDBASE="$__CMDBASE --post-data"
|
||||
}
|
||||
|
||||
# 用于Dnspod API的通信函数
|
||||
dnspod_transfer() {
|
||||
local __A=$1
|
||||
local __CNT=0
|
||||
local __ERR=0
|
||||
local __B PID_SLEEP
|
||||
case "$__A" in
|
||||
0)
|
||||
__B="$__CMDBASE '$__POST' ${__URLBASE}Record.List"
|
||||
;;
|
||||
1)
|
||||
__B="$__CMDBASE '$__POST1' ${__URLBASE}Record.Create"
|
||||
;;
|
||||
2)
|
||||
__B="$__CMDBASE '$__POST1&record_id=$__RECID&ttl=$__TTL' ${__URLBASE}Record.Modify"
|
||||
;;
|
||||
esac
|
||||
|
||||
while : ; do
|
||||
write_log 7 "#> $__B"
|
||||
eval $__B
|
||||
__ERR=`jsonfilter -i $DATFILE -e "@.status.code"`
|
||||
|
||||
[ $__ERR -eq 1 ] && return 0
|
||||
[ $__A -eq 0 ] && [ $__ERR -eq 10 ] && return 0
|
||||
write_log 3 "Error message:[$(jsonfilter -i $DATFILE -e "@.status.message")]"
|
||||
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "Transfer failed - detailed mode: $VERBOSE - Do not try again after an error"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__CNT=$(( $__CNT + 1 ))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && write_log 14 "Transfer failed after $retry_count retries"
|
||||
|
||||
write_log 4 "Transfer failed - $__CNT Try again in $RETRY_SECONDS seconds"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
}
|
||||
|
||||
#添加解析记录
|
||||
add_domain() {
|
||||
dnspod_transfer 1
|
||||
write_log 7 "Add new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#修改解析记录
|
||||
update_domain() {
|
||||
dnspod_transfer 2
|
||||
write_log 7 "Modify new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP],[TTL:$__TTL] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#获取域名解析记录
|
||||
describe_domain() {
|
||||
ret=0
|
||||
__POST="login_token=$username,$password&format=json&domain=$__DOMAIN&sub_domain=$__HOST&record_type=$__TYPE"
|
||||
__POST1="$__POST&value=$__IP&record_type=$__TYPE&record_line_id=0"
|
||||
dnspod_transfer 0
|
||||
__TMP=`jsonfilter -i $DATFILE -e "@.records[@.type!='NS']"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.name"`
|
||||
if [ "$__value" == "" ]; then
|
||||
write_log 7 "Parsing record:[${__HOST}.${__DOMAIN}] does not exist"
|
||||
ret=1
|
||||
else
|
||||
__RECID=`jsonfilter -s "$__TMP" -e "@.id"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.type"`
|
||||
__TTL=`jsonfilter -s "$__TMP" -e "@.ttl"`
|
||||
write_log 7 "Get parsing recordID:[$__RECID]"
|
||||
if [ "$__value" != "$__TYPE" ]; then
|
||||
write_log 7 "Current parsing [type:$__TYPE], get mismatched [type:$__value]"
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
else
|
||||
__RECIP=`jsonfilter -s "$__TMP" -e "@.value"`
|
||||
if [ "$__RECIP" != "$__IP" ]; then
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
if [ $ret == 1 ];then
|
||||
sleep 3 && add_domain
|
||||
elif [ $ret == 2 ];then
|
||||
sleep 3 && update_domain
|
||||
else
|
||||
write_log 7 "Local IP:[$__IP] parsing records IP:[$__RECIP] address does not need to be modified"
|
||||
fi
|
||||
|
||||
return 0
|
||||
@@ -1,165 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#检查传入参数
|
||||
[ -z "$username" ] && write_log 14 "Configuration error! [User name] cannot be empty"
|
||||
[ -z "$password" ] && write_log 14 "Configuration error! [Password] cannot be empty"
|
||||
|
||||
#检查外部调用工具
|
||||
WGET_SSL='wget'
|
||||
[ -n "$WGET_SSL" ] || write_log 13 "GNU Wget support is required to use Alibaba Cloud API. Please install first"
|
||||
|
||||
# 变量声明
|
||||
local __URLBASE __HOST __DOMAIN __TYPE __CMDBASE __TOKEN __POST __POST1 __RECIP __RECID __value __TTL
|
||||
__URLBASE="https://api.dnspod.com/"
|
||||
|
||||
# 从 $domain 分离主机和域名
|
||||
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
|
||||
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"
|
||||
|
||||
# 设置记录类型
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# 构造基本通信命令
|
||||
build_command() {
|
||||
__CMDBASE="$WGET_SSL --no-hsts -nv -t 1 -O $DATFILE -o $ERRFILE"
|
||||
# 绑定用于通信的主机/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local bind_ip run_prog
|
||||
[ $use_ipv6 -eq 0 ] && run_prog="network_get_ipaddr" || run_prog="network_get_ipaddr6"
|
||||
eval "$run_prog bind_ip $bind_network" || \
|
||||
write_log 13 "Unable to get local IP address with '$run_prog $ bind_network' - error code: '$?'"
|
||||
write_log 7 "Forced use of IP '$bind_ip' communication"
|
||||
__CMDBASE="$__CMDBASE --bind-address=$bind_ip"
|
||||
fi
|
||||
# 强制设定IP版本
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# 设置CA证书参数
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__CMDBASE="$__CMDBASE --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-certificate=${cacert}"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-directory=${cacert}"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "A valid certificate for HTTPS communication was not found in '$cacert'"
|
||||
fi
|
||||
fi
|
||||
# 如果没有设置,禁用代理 (这可能是 .wgetrc 或环境设置错误)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --no-proxy"
|
||||
__CMDBASE="$__CMDBASE --post-data"
|
||||
}
|
||||
|
||||
# 用于Dnspod API的通信函数
|
||||
dnspod_transfer() {
|
||||
local __A=$1
|
||||
local __CNT=0
|
||||
local __ERR=0
|
||||
local __B __C PID_SLEEP
|
||||
case "$__A" in
|
||||
0)
|
||||
__B="$__CMDBASE 'login_email=$username&login_password=$password&format=json' ${__URLBASE}Auth"
|
||||
__C=$__B
|
||||
;;
|
||||
1)
|
||||
__B="$__CMDBASE '$__POST' ${__URLBASE}Record.List"
|
||||
__C=1
|
||||
;;
|
||||
2)
|
||||
__B="$__CMDBASE '$__POST1' ${__URLBASE}Record.Create"
|
||||
__C=1
|
||||
;;
|
||||
3)
|
||||
__B="$__CMDBASE '$__POST1&record_id=$__RECID&ttl=$__TTL' ${__URLBASE}Record.Modify"
|
||||
__C=1
|
||||
;;
|
||||
esac
|
||||
|
||||
while : ; do
|
||||
[ $__C -eq 1 ] && __C=$(echo -e "$__B" | sed -e "s/${__TOKEN#*,}/***PW***/g")
|
||||
write_log 7 "#> $__C"
|
||||
eval $__B
|
||||
__ERR=`jsonfilter -i $DATFILE -e "@.status.code"`
|
||||
|
||||
[ $__ERR -eq 1 ] && return 0
|
||||
[ $__A -eq 1 ] && [ $__ERR -eq 10 ] && return 0
|
||||
write_log 3 "Error message:[$(jsonfilter -i $DATFILE -e "@.status.message")]"
|
||||
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "Transfer failed - detailed mode: $VERBOSE - Do not try again after an error"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__CNT=$(( $__CNT + 1 ))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && write_log 14 "Transfer failed after $retry_count retries"
|
||||
|
||||
write_log 4 "Transfer failed - $__CNT Try again in $RETRY_SECONDS seconds"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
}
|
||||
|
||||
#添加解析记录
|
||||
add_domain() {
|
||||
dnspod_transfer 2
|
||||
write_log 7 "Add new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#修改解析记录
|
||||
update_domain() {
|
||||
dnspod_transfer 3
|
||||
write_log 7 "Modify new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP],[TTL:$__TTL] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#获取域名解析记录
|
||||
describe_domain() {
|
||||
ret=0
|
||||
dnspod_transfer 0
|
||||
__TOKEN=`jsonfilter -i $DATFILE -e "@.user_token"`
|
||||
__POST="user_token=$__TOKEN&format=json&domain=$__DOMAIN&sub_domain=$__HOST"
|
||||
__POST1="$__POST&value=$__IP&record_type=$__TYPE&record_line=default"
|
||||
dnspod_transfer 1
|
||||
__TMP=`jsonfilter -i $DATFILE -e "@.records[@.type!='NS']"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.name"`
|
||||
if [ "$__value" == "" ]; then
|
||||
write_log 7 "Parsing record:[${__HOST}.${__DOMAIN}] does not exist"
|
||||
ret=1
|
||||
else
|
||||
__RECID=`jsonfilter -s "$__TMP" -e "@.id"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.type"`
|
||||
__TTL=`jsonfilter -s "$__TMP" -e "@.ttl"`
|
||||
write_log 7 "Get parsing recordID:[$__RECID]"
|
||||
if [ "$__value" != "$__TYPE" ]; then
|
||||
write_log 7 "Current parsing [type:$__TYPE], get mismatched [type:$__value]"
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
else
|
||||
__RECIP=`jsonfilter -s "$__TMP" -e "@.value"`
|
||||
if [ "$__RECIP" != "$__IP" ]; then
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
if [ $ret == 1 ];then
|
||||
sleep 3 && add_domain
|
||||
elif [ $ret == 2 ];then
|
||||
sleep 3 && update_domain
|
||||
else
|
||||
write_log 7 "Local IP:[$__IP] parsing records IP:[$__RECIP] address does not need to be modified"
|
||||
fi
|
||||
|
||||
return 0
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dsmboot
|
||||
PKG_VERSION:=5.2
|
||||
PKG_RELEASE:=5967.1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Synology DSM pxeboot from TFTP
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
DSM 5.2 boot from TFTP
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/root
|
||||
$(INSTALL_DATA) ./files/* $(1)/root/
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/dsmboot $(1)/etc/uci-defaults/yyy-dsmboot
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
Binary file not shown.
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set dhcp.@dnsmasq[0].enable_tftp='1'
|
||||
set dhcp.@dnsmasq[0].dhcp_boot='pxelinux.0'
|
||||
set dhcp.@dnsmasq[0].tftp_root='/root'
|
||||
commit dhcp
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
@@ -1,9 +0,0 @@
|
||||
default 0
|
||||
timeout 0
|
||||
fallback 0
|
||||
|
||||
title Synology DSM
|
||||
map --mem (pd)/dsm.iso (hd32)
|
||||
map --hook
|
||||
chainloader (hd32)
|
||||
|
||||
Binary file not shown.
@@ -1,59 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt-dist
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ipv6helper
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=LEAN
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ipv6helper
|
||||
SECTION:=ipv6
|
||||
TITLE:=IPv6 Helper and Dynamic Update he.net of ip
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+luci-proto-ipv6 +wget-ssl +odhcpd-ipv6only +odhcp6c +6in4 \
|
||||
+PACKAGE_firewall:ip6tables \
|
||||
+PACKAGE_firewall:libip6tc \
|
||||
+PACKAGE_firewall:kmod-ipt-nat6
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/description
|
||||
IPv6 Helper and Dynamic Update he.net of ip
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
chmod 755 /etc/hotplug.d/iface/60-6in4 >/dev/null 2>&1
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/install
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/root/etc/hotplug.d/iface/60-6in4 $(1)/etc/hotplug.d/iface/60-6in4
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,ipv6helper))
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
if [ "$ACTION" != "ifup" ]; then
|
||||
exit
|
||||
fi
|
||||
config_load network
|
||||
config_get tunnelid $INTERFACE tunnelid
|
||||
config_get username $INTERFACE username
|
||||
config_get password $INTERFACE password
|
||||
if [ "$tunnelid" != "" ]; then
|
||||
wget -O - https://$username:$password@ipv4.tunnelbroker.net/nic/update?hostname=$tunnelid --no-check-certificate
|
||||
fi
|
||||
@@ -1,47 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=k3screenctrl
|
||||
PKG_VERSION:=0.10
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/updateing/k3screenctrl.git
|
||||
PKG_SOURCE_VERSION:=dd05ce9a5cb0cb6cebfc6b3b5823c7f6d75796ff
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
PKG_MAINTAINER:=Hamster Tian <haotia@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS+= -D_GNU_SOURCE
|
||||
|
||||
define Package/k3screenctrl
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=@(TARGET_bcm53xx_DEVICE_phicomm-k3||TARGET_bcm53xx_generic_DEVICE_phicomm_k3) +@KERNEL_DEVMEM
|
||||
TITLE:=LCD screen controller on PHICOMM K3
|
||||
URL:=https://github.com/updateing/k3-screen-ctrl
|
||||
endef
|
||||
|
||||
define Package/k3screenctrl/description
|
||||
K3 Screen Controller (k3screenctrl) is a program utilizing
|
||||
the LCD screen on PHICOMM K3 to display some stats.
|
||||
endef
|
||||
|
||||
define Package/k3screenctrl/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/lib/k3screenctrl
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/k3screenctrl $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/wan.sh $(1)/lib/k3screenctrl/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/wifi.sh $(1)/lib/k3screenctrl/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/port.sh $(1)/lib/k3screenctrl/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/basic.sh $(1)/lib/k3screenctrl/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/host.sh $(1)/lib/k3screenctrl/
|
||||
|
||||
$(INSTALL_BIN) ./files/k3screenctrl.init $(1)/etc/init.d/k3screenctrl
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,k3screenctrl))
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=99
|
||||
|
||||
SCRIPTS_BASE=/lib/k3screenctrl/
|
||||
|
||||
start() {
|
||||
/usr/bin/k3screenctrl &
|
||||
}
|
||||
|
||||
stop() {
|
||||
killall k3screenctrl
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2009-2012 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:=libcryptopp
|
||||
PKG_VERSION:=5.6.4
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=cryptopp$(subst .,,$(PKG_VERSION)).zip
|
||||
PKG_SOURCE_URL:=http://www.cryptopp.com/
|
||||
PKG_MD5SUM:=4ee7e5cdd4a45a14756c169eaf2a77fc
|
||||
|
||||
PKG_USE_NINJA:=0
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/libcryptopp
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
DEPENDS:=+libpthread +libstdcpp
|
||||
TITLE:=Free C++ class library of cryptographic schemes
|
||||
URL:=http://packages.debian.org/sid/libcrypto++-dev
|
||||
endef
|
||||
|
||||
define Package/libcryptopp/description
|
||||
Crypto++ is library for creating C++ programs which use cryptographic algorithms.
|
||||
The library uses a Pipes & Filters architecture with heavy use of templates and
|
||||
abstract base classes.
|
||||
endef
|
||||
|
||||
#CONFIGURE_ARGS += \
|
||||
# --enable-static \
|
||||
# --enable-shared
|
||||
|
||||
#TARGET_LDFLAGS += \
|
||||
# -lpthread
|
||||
|
||||
CMAKE_OPTIONS += -DCMAKE_CXX_FLAGS="$(FPIC)"
|
||||
CMAKE_OPTIONS += -DBUILD_STATIC=ON
|
||||
CMAKE_OPTIONS += -DBUILD_SHARED=ON
|
||||
|
||||
UNPACK_CMD=cd $(PKG_BUILD_DIR) && unzip "$(DL_DIR)/$(PKG_SOURCE)"
|
||||
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
cd $(PKG_BUILD_DIR) && rm -f GNUmakefile GNUmakefile-cross
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/cryptopp
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/cryptopp/* $(1)/usr/include/cryptopp/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcryptopp.{a,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libcryptopp/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcryptopp.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libcryptopp))
|
||||
@@ -1,18 +0,0 @@
|
||||
# Copyright (C) 2020 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for Adbyby
|
||||
LUCI_DEPENDS:=+adbyby +uclient-fetch +ipset +dnsmasq-full
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-adbyby-plus
|
||||
PKG_VERSION:=2.0
|
||||
PKG_RELEASE:=77
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -1,86 +0,0 @@
|
||||
|
||||
module("luci.controller.adbyby", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/adbyby") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "adbyby"}, alias("admin", "services", "adbyby", "base"), _("ADBYBY Plus +"), 9).dependent = true
|
||||
|
||||
entry({"admin", "services", "adbyby", "base"}, cbi("adbyby/base"), _("Base Setting"), 10).leaf = true
|
||||
entry({"admin", "services", "adbyby", "advanced"}, cbi("adbyby/advanced"), _("Advance Setting"), 20).leaf = true
|
||||
entry({"admin", "services", "adbyby", "help"}, form("adbyby/help"), _("Plus+ Domain List"), 30).leaf = true
|
||||
entry({"admin", "services", "adbyby", "esc"}, form("adbyby/esc"), _("Bypass Domain List"), 40).leaf = true
|
||||
entry({"admin", "services", "adbyby", "black"}, form("adbyby/black"), _("Block Domain List"), 50).leaf = true
|
||||
entry({"admin", "services", "adbyby", "block"}, form("adbyby/block"), _("Block IP List"), 60).leaf = true
|
||||
entry({"admin", "services", "adbyby", "user"}, form("adbyby/user"), _("User-defined Rule"), 70).leaf = true
|
||||
|
||||
entry({"admin", "services", "adbyby", "refresh"}, call("refresh_data"))
|
||||
entry({"admin", "services", "adbyby", "run"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pgrep adbyby >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
|
||||
function refresh_data()
|
||||
local set = luci.http.formvalue("set")
|
||||
local icount = 0
|
||||
|
||||
if set == "rule_data" then
|
||||
luci.sys.exec("/usr/share/adbyby/rule-update")
|
||||
icount = luci.sys.exec("/usr/share/adbyby/rule-count '/tmp/rules/'")
|
||||
|
||||
if tonumber(icount)>0 then
|
||||
if nixio.fs.access("/usr/share/adbyby/rules/") then
|
||||
oldcount = luci.sys.exec("/usr/share/adbyby/rule-count '/usr/share/adbyby/rules/'")
|
||||
else
|
||||
oldcount=0
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
|
||||
if tonumber(icount) ~= tonumber(oldcount) then
|
||||
luci.sys.exec("rm -f /usr/share/adbyby/rules/data/* /usr/share/adbyby/rules/host/* && cp -a /tmp/rules /usr/share/adbyby/")
|
||||
luci.sys.exec("/etc/init.d/adbyby restart &")
|
||||
retstring=tostring(math.ceil(tonumber(icount)))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
refresh_cmd = "uclient-fetch -q --no-check-certificate -O - 'https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt' > /tmp/adnew.conf"
|
||||
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||
if sret== 0 then
|
||||
luci.sys.call("/usr/share/adbyby/ad-update")
|
||||
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
|
||||
if tonumber(icount)>0 then
|
||||
if nixio.fs.access("/usr/share/adbyby/dnsmasq.adblock") then
|
||||
oldcount = luci.sys.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l")
|
||||
else
|
||||
oldcount=0
|
||||
end
|
||||
if tonumber(icount) ~= tonumber(oldcount) then
|
||||
luci.sys.exec("cp -f /tmp/ad.conf /usr/share/adbyby/dnsmasq.adblock")
|
||||
luci.sys.exec("cp -f /tmp/ad.conf /tmp/etc/dnsmasq-adbyby.d/adblock")
|
||||
luci.sys.exec("/etc/init.d/adbyby restart &")
|
||||
retstring=tostring(math.ceil(tonumber(icount)))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
luci.sys.exec("rm -f /tmp/ad.conf")
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({ ret=retstring ,retcount=icount})
|
||||
end
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
local SYS = require "luci.sys"
|
||||
local ND = SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l")
|
||||
|
||||
local ad_count=0
|
||||
if nixio.fs.access("/usr/share/adbyby/dnsmasq.adblock") then
|
||||
ad_count=tonumber(SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l"))
|
||||
end
|
||||
|
||||
local rule_count=0
|
||||
if nixio.fs.access("/usr/share/adbyby/rules/") then
|
||||
rule_count=tonumber(SYS.exec("/usr/share/adbyby/rule-count '/usr/share/adbyby/rules/'"))
|
||||
end
|
||||
|
||||
m = Map("adbyby")
|
||||
|
||||
s = m:section(TypedSection, "adbyby")
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(Flag, "block_ios")
|
||||
o.title = translate("Block Apple iOS OTA update")
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Flag, "block_cnshort")
|
||||
o.title = translate("Block CNshort APP and Website")
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Flag, "cron_mode")
|
||||
o.title = translate("Update the rule at 6 a.m. every morning and restart adbyby")
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
|
||||
o=s:option(DummyValue,"ad_data",translate("Adblock Plus Data"))
|
||||
o.rawhtml = true
|
||||
o.template = "adbyby/refresh"
|
||||
o.value =ad_count .. " " .. translate("Records")
|
||||
|
||||
o=s:option(DummyValue,"rule_data",translate("Subscribe 3rd Rules Data"))
|
||||
o.rawhtml = true
|
||||
o.template = "adbyby/refresh"
|
||||
o.value =rule_count .. " " .. translate("Records")
|
||||
o.description = translate("AdGuardHome / Host / DNSMASQ rules auto-convert")
|
||||
|
||||
o = s:option(Button,"delete",translate("Delete All Subscribe Rules"))
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
SYS.exec("rm -f /usr/share/adbyby/rules/data/* /usr/share/adbyby/rules/host/*")
|
||||
SYS.exec("/etc/init.d/adbyby restart 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "adbyby", "advanced"))
|
||||
end
|
||||
|
||||
o = s:option(DynamicList, "subscribe_url", translate("Anti-AD Rules Subscribe"))
|
||||
o:value("https://cdn.jsdelivr.net/gh/cjx82630/cjxlist/cjx-annoyance.txt", translate("cjx-annoyance"))
|
||||
o:value("https://easylist-downloads.adblockplus.org/easylistchina.txt", translate("easylistchina"))
|
||||
o:value("https://easylist-downloads.adblockplus.org/easyprivacy.txt", translate("easyprivacy"))
|
||||
o:value("https://easylist-downloads.adblockplus.org/easylist.txt", translate("easylist"))
|
||||
o:value("https://raw.githubusercontent.com/Spam404/lists/master/adblock-list.txt", translate("adblock-list"))
|
||||
o:value("https://raw.githubusercontent.com/bongochong/CombinedPrivacyBlockLists/master/cpbl-abp-list.txt", translate("cpbl-abp-list"))
|
||||
o:value("https://anti-ad.net/easylist.txt", translate("anti-ad"))
|
||||
o:value("https://anti-ad.net/anti-ad-for-dnsmasq.conf", translate("anti-ad-for-dnsmasq"))
|
||||
o:value("https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/nocoin.txt", translate("nocoin"))
|
||||
o:value("https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt", translate("abp-filters-anti-cv"))
|
||||
o.rmempty = true
|
||||
|
||||
return m
|
||||
@@ -1,66 +0,0 @@
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
|
||||
local DL = SYS.exec("head -1 /tmp/adbyby/data/lazy.txt | awk -F' ' '{print $3,$4}'") or ""
|
||||
local DV = SYS.exec("head -1 /tmp/adbyby/data/video.txt | awk -F' ' '{print $3,$4}'") or ""
|
||||
local NR = SYS.exec("grep -v '^!' /usr/share/adbyby/data/rules.txt | wc -l")
|
||||
local NU = SYS.exec("cat /usr/share/adbyby/data/user.txt | wc -l")
|
||||
local UD = NXFS.readfile("/tmp/adbyby.updated") or "1970-01-01 00:00:00"
|
||||
|
||||
m = Map("adbyby")
|
||||
m.title = translate("Adbyby Plus + Settings")
|
||||
m.description = translate("Adbyby Plus + can filter all kinds of banners, popups, video ads, and prevent tracking, privacy theft and a variety of malicious websites<br /><font color=\"red\">Plus + version combination mode can operation with Adblock Plus Host,filtering ads without losing bandwidth</font>")
|
||||
|
||||
m:section(SimpleSection).template = "adbyby/adbyby_status"
|
||||
|
||||
s = m:section(TypedSection, "adbyby")
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(Flag, "enable", translate("Enable"))
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(ListValue, "wan_mode", translate("Running Mode"))
|
||||
o:value("0", translate("Global Mode (The slowest and the best effects)"))
|
||||
o:value("1", translate("Plus + Mode (Filter domain name list and blacklist website.Recommended)"))
|
||||
o:value("2", translate("No filter Mode (Must set in Client Filter Mode Settings manually)"))
|
||||
o.default = 1
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Button, "restart", translate("Adbyby and Rule state"))
|
||||
o.inputtitle = translate("Update Adbyby Rules Manually")
|
||||
o.description = string.format("<strong>"..translate("Last Update Checked")..":</strong> %s<br /><strong>"..translate("Lazy Rule")..":</strong>%s <br /><strong>"..translate("Video Rule")..":</strong>%s", UD, DL, DV)
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
SYS.call("rm -rf /tmp/adbyby.updated /tmp/adbyby/admd5.json && /usr/share/adbyby/adbybyupdate.sh > /tmp/adupdate.log 2>&1 &")
|
||||
SYS.call("sleep 5")
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "adbyby"))
|
||||
end
|
||||
|
||||
t = m:section(TypedSection, "acl_rule", translate("<strong>Client Filter Mode Settings</strong>"))
|
||||
t.description = translate("Filter mode settings can be set to specific LAN clients ( <font color=blue> No filter , Global filter </font> ) . Does not need to be set by default.")
|
||||
t.template = "cbi/tblsection"
|
||||
t.sortable = true
|
||||
t.anonymous = true
|
||||
t.addremove = true
|
||||
|
||||
e = t:option(Value, "ipaddr", translate("IP Address"))
|
||||
e.width = "40%"
|
||||
e.datatype = "ip4addr"
|
||||
e.placeholder = "0.0.0.0/0"
|
||||
luci.ip.neighbors({ family = 4 }, function(entry)
|
||||
if entry.reachable then
|
||||
e:value(entry.dest:string())
|
||||
end
|
||||
end)
|
||||
|
||||
e = t:option(ListValue, "filter_mode", translate("Filter Mode"))
|
||||
e.width = "40%"
|
||||
e.default = "disable"
|
||||
e.rmempty = false
|
||||
e:value("disable", translate("No filter"))
|
||||
e:value("global", translate("Global filter"))
|
||||
|
||||
return m
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/adblack.conf"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/blockip.conf"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/adesc.conf"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/adhost.conf"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/rules.txt"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,22 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[adbyby]], [[run]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('adbyby_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>Adbyby Plus+ <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>Adbyby Plus+ <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="adbyby_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
@@ -1,35 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function refresh_data(btn,dataname)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Refresh...%> ';
|
||||
murl=dataname;
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adbyby","refresh")%>',
|
||||
{ set:murl },
|
||||
function(x,rv)
|
||||
{
|
||||
var s = document.getElementById(dataname+'-status');
|
||||
if (s)
|
||||
{
|
||||
if (rv.ret=="0")
|
||||
s.innerHTML ="<font color='green'>"+"<%:No new data!%> "+"</font>";
|
||||
else if(rv.ret=="-1")
|
||||
{
|
||||
s.innerHTML ="<font color='red'>"+"<%:Refresh Error!%> "+"</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
s.innerHTML ="<font color='green'>"+"<%:Refresh OK!%> "+"<%:Total Records:%>"+rv.ret+"</font>";
|
||||
}
|
||||
}
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Refresh Data %>';
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
//]]></script>
|
||||
<input type="button" class="cbi-button cbi-input-reload" value="<%:Refresh Data%> " onclick="return refresh_data(this,'<%=self.option%>')" />
|
||||
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -1,198 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: dingpengyu <dingpengyu06@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: zh_CN\n"
|
||||
"X-Generator: Poedit 2.3.1\n"
|
||||
|
||||
msgid "ADBYBY Plus +"
|
||||
msgstr "广告屏蔽大师 Plus+"
|
||||
|
||||
msgid "<strong><font color=\"green\">Adbyby Plus + is Running</font></strong>"
|
||||
msgstr "<strong><font color=\"green\">广告屏蔽大师 Plus + 正在运行</font></strong>"
|
||||
|
||||
msgid "<strong><font color=\"red\">Adbyby Plus + is Not Running</font></strong>"
|
||||
msgstr "<strong><font color=\"red\">广告屏蔽大师 Plus + 没有运行</font></strong>"
|
||||
|
||||
msgid "Adbyby Plus + can filter all kinds of banners, popups, video ads, and prevent tracking, privacy theft and a variety of malicious websites<br /><font color=\"red\">Plus + version combination mode can operation with Adblock Plus Host,filtering ads without losing bandwidth</font>"
|
||||
msgstr "广告屏蔽大师 Plus + 可以全面过滤各种横幅、弹窗、视频广告,同时阻止跟踪、隐私窃取及各种恶意网站<br /><font color=\"red\">Plus + 版本可以和 Adblock Plus Host 结合方式运行,过滤广告不损失带宽</font>"
|
||||
|
||||
msgid "Adbyby Plus +"
|
||||
msgstr "广告屏蔽大师 Plus+"
|
||||
|
||||
msgid "Adbyby Plus + Settings"
|
||||
msgstr "广告屏蔽大师 Plus+(支持 AdGuardHome /Host / DNSMASQ 规则)"
|
||||
|
||||
msgid "Base Setting"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "Running Mode"
|
||||
msgstr "运行模式"
|
||||
|
||||
msgid "Global Mode (The slowest and the best effects)"
|
||||
msgstr "全局模式(最慢, 效果最好)"
|
||||
|
||||
msgid "Plus + Mode (Filter domain name list and blacklist website.Recommended)"
|
||||
msgstr "Plus + 模式(只过滤列表内域名结合ABP名单。推荐!)"
|
||||
|
||||
msgid "No filter Mode (Must set in Client Filter Mode Settings manually)"
|
||||
msgstr "手动代理模式(必须手动设置浏览器代理,或者客户端过滤模式设置)"
|
||||
|
||||
msgid "Transparent proxy"
|
||||
msgstr "透明代理"
|
||||
|
||||
msgid "Click to disable"
|
||||
msgstr "点击关闭"
|
||||
|
||||
msgid "Click to enable"
|
||||
msgstr "点击开启"
|
||||
|
||||
msgid "Adbyby and Rule state"
|
||||
msgstr "规则状态"
|
||||
|
||||
msgid "Restart Adbyby"
|
||||
msgstr "重启Adbyby"
|
||||
|
||||
msgid "Plus+ Domain List"
|
||||
msgstr "Plus+ 模式过滤的域名"
|
||||
|
||||
msgid "Bypass Domain List"
|
||||
msgstr "域名白名单"
|
||||
|
||||
msgid "Black Domain List"
|
||||
msgstr "域名黑名单"
|
||||
|
||||
msgid "Black IP List"
|
||||
msgstr "IP黑名单"
|
||||
|
||||
msgid "Advance Setting"
|
||||
msgstr "高级设置"
|
||||
|
||||
msgid "Update the rule at 6 a.m. every morning and restart adbyby"
|
||||
msgstr "每天凌晨6点更新规则并重启"
|
||||
|
||||
msgid "ADP Host List"
|
||||
msgstr "Adblock Plus Hosts 记录数"
|
||||
|
||||
msgid "Adblock Plus Data"
|
||||
msgstr "Adblock Plus 规则数据库"
|
||||
|
||||
msgid "Subscribe 3rd Rules Data"
|
||||
msgstr "订阅第三方去广告规则"
|
||||
|
||||
msgid "Records"
|
||||
msgstr "条记录"
|
||||
|
||||
msgid "Refresh Data"
|
||||
msgstr "更新数据库"
|
||||
|
||||
msgid "Refresh..."
|
||||
msgstr "正在更新,请稍候.."
|
||||
|
||||
msgid "Refresh OK!"
|
||||
msgstr "更新成功!"
|
||||
|
||||
msgid "Refresh Error!"
|
||||
msgstr "更新失败!"
|
||||
|
||||
msgid "No new data!"
|
||||
msgstr "你已经是最新数据,无需更新!"
|
||||
|
||||
msgid "Total Records:"
|
||||
msgstr "新的总纪录数:"
|
||||
|
||||
msgid "Delete All Subscribe Rules"
|
||||
msgstr "清空所有订阅的规则库"
|
||||
|
||||
msgid "Anti-AD Rules Subscribe"
|
||||
msgstr "广告过滤规则订阅URL"
|
||||
|
||||
msgid "AdGuardHome / Host / DNSMASQ rules auto-convert"
|
||||
msgstr "AdGuardHome / Host / DNSMASQ 规则自动识别"
|
||||
|
||||
msgid "Manually force update<br />Adblock Plus Host List"
|
||||
msgstr "手动强制更新<br />Adblock Plus Host List"
|
||||
|
||||
msgid "Update Adbyby Rules Manually"
|
||||
msgstr "手动更新规则"
|
||||
|
||||
msgid "Block Apple iOS OTA update"
|
||||
msgstr "拦截 Apple iOS 的OTA更新"
|
||||
|
||||
msgid "Block CNshort APP and Website"
|
||||
msgstr "拦截 短视频 APP 和网站"
|
||||
|
||||
msgid "RAM Running Mode"
|
||||
msgstr "内存运行模式"
|
||||
|
||||
msgid "Running Adbyby in RAM.More speed,less disk consumption"
|
||||
msgstr "在内存中运行Adbyby。更快的速度,更少的存储空间损耗"
|
||||
|
||||
msgid "User-defined Rule"
|
||||
msgstr "用户自定义规则"
|
||||
|
||||
msgid "<strong>Client Filter Mode Settings</strong>"
|
||||
msgstr "<strong>客户端过滤模式设置</strong>"
|
||||
|
||||
msgid "Filter mode settings can be set to specific LAN clients ( <font color=blue> No filter , Global filter </font> ) . Does not need to be set by default."
|
||||
msgstr "可以为局域网客户端分别设置不同的过滤模式 ( <font color=blue> 不过滤 , 全局过滤 </font> ) 。默认无需设置。"
|
||||
|
||||
msgid "IP Address"
|
||||
msgstr "IP地址"
|
||||
|
||||
msgid "Filter Mode"
|
||||
msgstr "过滤模式"
|
||||
|
||||
msgid "(!)Note that you should fill to the domain name ONLY. For example, http://www.baidu.com only needs to write to baidu.com. One line for each"
|
||||
msgstr "这些域名在 Plus 模式中会被过滤。你需要要填写域名即可,例如 http://www.baidu.com,你写 baidu.com 即可。每行一个域名"
|
||||
|
||||
msgid "(!)Will Never filter these Domain"
|
||||
msgstr "永不过滤白名单内的域名(所有模式中生效)"
|
||||
|
||||
msgid "(!)Will Always block these Domain"
|
||||
msgstr "拦截黑名单内的域名(所有模式中生效)"
|
||||
|
||||
msgid "(!)Will Always block these IP"
|
||||
msgstr "拦截黑名单内的IP地址(所有模式中生效)"
|
||||
|
||||
msgid "Each line of the beginning exclamation mark is considered an annotation."
|
||||
msgstr "每行一条规则,感叹号开头的被认为是注释。"
|
||||
|
||||
msgid "<strong><font color=blue>Adblock Plus Host List:</font></strong>"
|
||||
msgstr "<strong><font color=blue>Adblock Plus Host 列表:</font></strong>"
|
||||
|
||||
msgid "Note: It needs to download and convert the rules. The background process may takes 60-120 seconds to run. <br / > After completed it would automatically refresh, please do not duplicate click!"
|
||||
msgstr "注意:需要下载并转换规则。后台进程可能需要60-120秒运行。完成后会自动刷新,请不要重复点击!"
|
||||
|
||||
msgid "No filter"
|
||||
msgstr "不过滤"
|
||||
|
||||
msgid "Global filter"
|
||||
msgstr "全局过滤"
|
||||
|
||||
msgid "Update adbyby rules form official website first"
|
||||
msgstr "优先从官方网站更新规则"
|
||||
|
||||
msgid "Last Update Checked"
|
||||
msgstr "上一次检查规则更新"
|
||||
|
||||
msgid "Lazy Rule"
|
||||
msgstr "正式版规则"
|
||||
|
||||
msgid "Video Rule"
|
||||
msgstr "测试版规则"
|
||||
|
||||
msgid "Adblock Plus Host List"
|
||||
msgstr "广告屏蔽大师 Plus 规则列表"
|
||||
|
||||
msgid "Block Domain List"
|
||||
msgstr "域名黑名单"
|
||||
|
||||
msgid "Block IP List"
|
||||
msgstr "IP黑名单"
|
||||
@@ -1 +0,0 @@
|
||||
zh-cn
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
config adbyby
|
||||
option daemon '2'
|
||||
option lan_mode '0'
|
||||
option cron_mode '1'
|
||||
option block_ios '0'
|
||||
option enable '0'
|
||||
option wan_mode '1'
|
||||
option mem_mode '1'
|
||||
option update_source '1'
|
||||
|
||||
@@ -1,254 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=96
|
||||
STOP=10
|
||||
|
||||
|
||||
EXTRA_COMMANDS="add_rule del_rule reload_rule"
|
||||
PROG_PATH=/usr/share/adbyby
|
||||
DATA_PATH=$PROG_PATH/data
|
||||
WAN_FILE=/tmp/dnsmasq.d/dnsmasq-adbyby.d/03-adbyby-ipset.conf
|
||||
CRON_FILE=/etc/crontabs/root
|
||||
CONFIG=adbyby
|
||||
ipt_n="iptables -t nat"
|
||||
|
||||
uci_get_by_name() {
|
||||
local ret=$(uci get $CONFIG.$1.$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
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}
|
||||
}
|
||||
|
||||
get_config()
|
||||
{
|
||||
config_get_bool enable $1 enable 0
|
||||
config_get_bool cron_mode $1 cron_mode 1
|
||||
config_get wan_mode $1 wan_mode 1
|
||||
config_get_bool block_ios $1 block_ios 0
|
||||
config_get_bool mem_mode $1 mem_mode 1
|
||||
config_get_bool block_cnshort $1 block_cnshort 0
|
||||
}
|
||||
|
||||
add_rules()
|
||||
{
|
||||
rm -f $DATA_PATH/user.bin
|
||||
grep -v ^! $PROG_PATH/rules.txt > $DATA_PATH/user.txt
|
||||
cp $PROG_PATH/rules.txt $DATA_PATH/rules.txt
|
||||
}
|
||||
|
||||
|
||||
add_cron()
|
||||
{
|
||||
if [ $cron_mode -eq 1 ]; then
|
||||
sed -i '/adblock.sh/d' $CRON_FILE
|
||||
echo '0 6 * * * /usr/share/adbyby/adblock.sh > /tmp/adupdate.log 2>&1' >> $CRON_FILE
|
||||
crontab $CRON_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
del_cron()
|
||||
{
|
||||
sed -i '/adblock.sh/d' $CRON_FILE
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
ip_rule()
|
||||
{
|
||||
|
||||
ipset -N adbyby_esc hash:ip
|
||||
$ipt_n -A ADBYBY -m set --match-set adbyby_esc dst -j RETURN
|
||||
|
||||
local icount=$(uci show adbyby | grep 'filter_mode' | wc -l)
|
||||
let icount=icount-1
|
||||
for i in $(seq 0 $icount)
|
||||
do
|
||||
local ip=$(uci_get_by_type acl_rule ipaddr '' $i)
|
||||
local mode=$(uci_get_by_type acl_rule filter_mode '' $i)
|
||||
case "$mode" in
|
||||
disable)
|
||||
$ipt_n -A ADBYBY -s $ip -j RETURN
|
||||
;;
|
||||
global)
|
||||
$ipt_n -A ADBYBY -s $ip -p tcp -j REDIRECT --to-ports 8118
|
||||
$ipt_n -A ADBYBY -s $ip -j RETURN
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
|
||||
case $wan_mode in
|
||||
0)
|
||||
;;
|
||||
1)
|
||||
ipset -N adbyby_wan hash:ip
|
||||
$ipt_n -A ADBYBY -m set ! --match-set adbyby_wan dst -j RETURN
|
||||
;;
|
||||
2)
|
||||
$ipt_n -A ADBYBY -j RETURN
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "create blockip hash:net family inet hashsize 1024 maxelem 65536" > /tmp/blockip.ipset
|
||||
awk '!/^$/&&!/^#/{printf("add blockip %s'" "'\n",$0)}' /usr/share/adbyby/blockip.conf >> /tmp/blockip.ipset
|
||||
ipset -! restore < /tmp/blockip.ipset 2>/dev/null
|
||||
iptables -I FORWARD -m set --match-set blockip dst -j DROP
|
||||
iptables -I OUTPUT -m set --match-set blockip dst -j DROP
|
||||
}
|
||||
|
||||
add_dns()
|
||||
{
|
||||
mkdir -p /tmp/dnsmasq.d/dnsmasq-adbyby.d
|
||||
mkdir -p /tmp/dnsmasq.d
|
||||
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/%s/'"adbyby_esc"'\n",$0)}' $PROG_PATH/adesc.conf > /tmp/dnsmasq.d/dnsmasq-adbyby.d/06-dnsmasq.esc
|
||||
awk '!/^$/&&!/^#/{printf("address=/%s/'"0.0.0.0"'\n",$0)}' $PROG_PATH/adblack.conf > /tmp/dnsmasq.d/dnsmasq-adbyby.d/07-dnsmasq.black
|
||||
|
||||
echo 'conf-dir=/tmp/dnsmasq.d/dnsmasq-adbyby.d' > /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
|
||||
local var=1
|
||||
if [ $wan_mode -eq 1 ]; then
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/%s/'"adbyby_wan"'\n",$0)}' $PROG_PATH/adhost.conf > $WAN_FILE
|
||||
if ls /tmp/dnsmasq.d/dnsmasq-adbyby.d/* >/dev/null 2>&1; then
|
||||
mkdir -p /tmp/dnsmasq.d
|
||||
cp /usr/share/adbyby/dnsmasq.adblock /tmp/dnsmasq.d/dnsmasq-adbyby.d/04-dnsmasq.adblock
|
||||
cp /usr/share/adbyby/dnsmasq.ads /tmp/dnsmasq.d/dnsmasq-adbyby.d/05-dnsmasq.ads
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/data /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/host
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/data/* /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/host/*
|
||||
cp -a /usr/share/adbyby/rules/data/* /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/data 2>/dev/null
|
||||
cp -a /usr/share/adbyby/rules/host/* /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/host 2>/dev/null
|
||||
echo 'addn-hosts=/tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/host/' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
echo 'conf-dir=/tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/data' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
|
||||
[ $block_ios -eq 1 ] && echo 'address=/mesu.apple.com/0.0.0.0' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
if [ $block_cnshort -eq 1 ]; then
|
||||
cat <<-EOF >/tmp/etc/dnsmasq-adbyby.d/08-dnsmasq.cnshort
|
||||
address=/api.amemv.com/0.0.0.0
|
||||
address=/.amemv.com/0.0.0.0
|
||||
address=/.tiktokv.com/0.0.0.0
|
||||
address=/.snssdk.com/0.0.0.0
|
||||
address=/.douyin.com/0.0.0.0
|
||||
address=/.ixigua.com/0.0.0.0
|
||||
address=/.pstatp.com/0.0.0.0
|
||||
address=/.ixiguavideo.com/0.0.0.0
|
||||
address=/.v.kandian.qq.com/0.0.0.0
|
||||
address=/.yximgs.com/0.0.0.0
|
||||
address=/.gifshow.com/0.0.0.0
|
||||
address=/.ksapisrv.com/0.0.0.0
|
||||
address=/.kuaishoupay.com/0.0.0.0
|
||||
address=/.ksyun.com/0.0.0.0
|
||||
address=/.live.xycdn.com/0.0.0.0
|
||||
address=/.danuoyi.alicdn.com/0.0.0.0
|
||||
address=/.v.weishi.qq.com/0.0.0.0
|
||||
address=/.pearvideo.com/0.0.0.0
|
||||
address=/.miaopai.com/0.0.0.0
|
||||
address=/.kuaishou.com/0.0.0.0
|
||||
address=/.qupai.me/0.0.0.0
|
||||
address=/.meipai.com/0.0.0.0
|
||||
address=/.huoshan.com/0.0.0.0
|
||||
address=/.ergengtv.com/0.0.0.0
|
||||
address=/.baijiahao.baidu.com/0.0.0.0
|
||||
address=/.xiongzhang.baidu.com/0.0.0.0
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
del_dns()
|
||||
{
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-adbyby.d/*
|
||||
rm -f /tmp/adbyby_host.conf
|
||||
}
|
||||
|
||||
|
||||
add_rule()
|
||||
{
|
||||
$ipt_n -N ADBYBY
|
||||
$ipt_n -A ADBYBY -d 0.0.0.0/8 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 10.0.0.0/8 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 127.0.0.0/8 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 169.254.0.0/16 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 172.16.0.0/12 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 192.168.0.0/16 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 224.0.0.0/4 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 240.0.0.0/4 -j RETURN
|
||||
ip_rule
|
||||
if [ $(ipset list music -name -quiet | grep music) ]; then
|
||||
$ipt_n -A ADBYBY -m set --match-set music dst -j RETURN 2>/dev/null
|
||||
fi
|
||||
$ipt_n -A ADBYBY -p tcp -j REDIRECT --to-ports 8118 2>/dev/null
|
||||
$ipt_n -I PREROUTING -p tcp --dport 80 -j ADBYBY 2>/dev/null
|
||||
|
||||
mkdir -p /var/etc
|
||||
echo -e "/etc/init.d/adbyby restart" > "/var/etc/adbyby.include"
|
||||
}
|
||||
|
||||
del_rule()
|
||||
{
|
||||
$ipt_n -D PREROUTING -p tcp --dport 80 -j ADBYBY 2>/dev/null
|
||||
$ipt_n -F ADBYBY 2>/dev/null
|
||||
$ipt_n -X ADBYBY 2>/dev/null
|
||||
iptables -D FORWARD -m set --match-set blockip dst -j DROP 2>/dev/null
|
||||
iptables -D OUTPUT -m set --match-set blockip dst -j DROP 2>/dev/null
|
||||
ipset -F adbyby_esc 2>/dev/null
|
||||
ipset -X adbyby_esc 2>/dev/null
|
||||
ipset -F adbyby_wan 2>/dev/null
|
||||
ipset -X adbyby_wan 2>/dev/null
|
||||
ipset -F blockip 2>/dev/null
|
||||
ipset -X blockip 2>/dev/null
|
||||
}
|
||||
|
||||
reload_rule()
|
||||
{
|
||||
config_load adbyby
|
||||
config_foreach get_config adbyby
|
||||
del_rule
|
||||
[ $enable -eq 0 ] && exit 0
|
||||
add_rule
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
config_load adbyby
|
||||
config_foreach get_config adbyby
|
||||
|
||||
if [ $enable -ne 0 ]; then
|
||||
add_cron
|
||||
[ ! -d "/tmp/adbyby/data" ] && cp -a /usr/share/adbyby /tmp/ && rm -f /tmp/adbyby.updated
|
||||
add_rules
|
||||
|
||||
/tmp/adbyby/adbyby >/dev/null 2>&1 &
|
||||
|
||||
add_dns
|
||||
add_rule
|
||||
/etc/init.d/dnsmasq restart
|
||||
fi
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
kill -9 $(busybox ps -w | grep "/tmp/adbyby/adbyby" | grep -v grep | grep -v update| grep -v adblock | awk '{print $1}') >/dev/null 2>&1
|
||||
config_load adbyby
|
||||
config_foreach get_config adbyby
|
||||
del_rule
|
||||
del_cron
|
||||
del_dns
|
||||
/etc/init.d/dnsmasq restart
|
||||
}
|
||||
|
||||
boot()
|
||||
{
|
||||
mkdir -p /tmp/adbyby && cp -a /usr/share/adbyby /tmp/
|
||||
start
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@adbyby[-1]
|
||||
add ucitrack adbyby
|
||||
set ucitrack.@adbyby[-1].init=adbyby
|
||||
commit ucitrack
|
||||
delete firewall.adbyby
|
||||
set firewall.adbyby=include
|
||||
set firewall.adbyby.type=script
|
||||
set firewall.adbyby.path=/var/etc/adbyby.include
|
||||
set firewall.adbyby.reload=1
|
||||
delete firewall.adblock
|
||||
add firewall rule
|
||||
rename firewall.@rule[-1]="adblock"
|
||||
set firewall.@rule[-1].name="adblock"
|
||||
set firewall.@rule[-1].target="DROP"
|
||||
set firewall.@rule[-1].src="wan"
|
||||
set firewall.@rule[-1].proto="tcp"
|
||||
set firewall.@rule[-1].dest_port="8118"
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
mkdir -p /etc/dnsmasq.d
|
||||
|
||||
/etc/init.d/adbyby stop
|
||||
/etc/init.d/adbyby enable
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -1,6 +0,0 @@
|
||||
/usr/share/adbyby/adhost.conf
|
||||
/usr/share/adbyby/adblack.conf
|
||||
/usr/share/adbyby/blockip.conf
|
||||
/usr/share/adbyby/adesc.conf
|
||||
/usr/share/adbyby/rules.txt
|
||||
/usr/share/adbyby/dnsmasq.adblock
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
if [ -f /tmp/adnew.conf ]; then
|
||||
if (grep -wq "address=" /tmp/adnew.conf) ; then
|
||||
cp /tmp/adnew.conf /tmp/ad.conf
|
||||
else
|
||||
cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/ad.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
#rm -f /tmp/adnew.conf
|
||||
@@ -1,14 +0,0 @@
|
||||
gvod.aiseejapp.atianqi.com
|
||||
stat.pandora.xiaomi.com
|
||||
upgrade.mishop.pandora.xiaomi.com
|
||||
logonext.tv.kuyun.com
|
||||
config.kuyun.com
|
||||
mishop.pandora.xiaomi.com
|
||||
dvb.pandora.xiaomi.com
|
||||
api.ad.xiaomi.com
|
||||
de.pandora.xiaomi.com
|
||||
data.mistat.xiaomi.com
|
||||
jellyfish.pandora.xiaomi.com
|
||||
gallery.pandora.xiaomi.com
|
||||
o2o.api.xiaomi.com
|
||||
bss.pandora.xiaomi.com
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uclient-fetch --no-check-certificate -O - 'https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt' > /tmp/adnew.conf
|
||||
if [ -s "/tmp/adnew.conf" ];then
|
||||
/usr/share/adbyby/ad-update
|
||||
fi
|
||||
|
||||
rm -f /tmp/adbyby.updated
|
||||
sleep 10
|
||||
/etc/init.d/adbyby restart
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
PROG_PATH=$(pwd)
|
||||
$PROG_PATH/adbybyupdate.sh
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f "/tmp/adbyby.updated" ];then
|
||||
wget_ok="0"
|
||||
while [ "$wget_ok" = "0" ]
|
||||
do
|
||||
uclient-fetch --spider --quiet --timeout=3 http://www.baidu.com
|
||||
if [ "$?" == "0" ]; then
|
||||
wget_ok="1"
|
||||
|
||||
touch /tmp/md5.json && uclient-fetch --no-check-certificate -T 10 -O /tmp/md5.json https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/md5.json
|
||||
adm5=$(md5sum /tmp/md5.json | awk -F' ' '{print $1}')
|
||||
touch /tmp/adbyby/admd5.json && bmd5=$(md5sum /tmp/adbyby/admd5.json | awk -F' ' '{print $1}')
|
||||
if [ "$adm5" == "$bmd5" ];then
|
||||
echo "Rules MD5 are the same!"
|
||||
echo $(date "+%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
exit 0
|
||||
elif [ -s /tmp/md5.json ];then
|
||||
|
||||
touch /tmp/lazy.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/lazy.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/lazy.txt
|
||||
touch /tmp/video.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/video.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/video.txt
|
||||
|
||||
touch /tmp/local-md5.json && md5sum /tmp/lazy.txt /tmp/video.txt > /tmp/local-md5.json
|
||||
|
||||
|
||||
lazy_local=$(grep 'lazy' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
video_local=$(grep 'video' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
lazy_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '2p')
|
||||
video_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '4p')
|
||||
|
||||
if [ "$lazy_online"x == "$lazy_local"x -a "$video_online"x == "$video_local"x ]; then
|
||||
echo "adbyby rules MD5 OK!"
|
||||
mv /tmp/lazy.txt /tmp/adbyby/data/lazy.txt
|
||||
mv /tmp/video.txt /tmp/adbyby/data/video.txt
|
||||
mv /tmp/md5.json /tmp/adbyby/admd5.json
|
||||
echo $(date "+%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
fi
|
||||
fi
|
||||
else
|
||||
sleep 10
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f /tmp/adbyby/data/*.bak
|
||||
|
||||
kill -9 $(busybox ps -w | grep "/tmp/adbyby/adbyby" | grep -v grep | grep -v update| grep -v adblock | awk '{print $1}') >/dev/null 2>&1
|
||||
/tmp/adbyby/adbyby >/dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
weixin.qq.com
|
||||
qpic.cn
|
||||
imtt.qq.com
|
||||
@@ -1,74 +0,0 @@
|
||||
124.232.160.178
|
||||
126.net
|
||||
50bang.org
|
||||
56.com
|
||||
acfun.com
|
||||
acfun.tv
|
||||
admaster.com.cn
|
||||
agn.aty.sohu.com
|
||||
amdc.cp12.ott.cibntv.net
|
||||
analytics-union.xunlei.com
|
||||
api.mydianshijia.com
|
||||
atianqi.com
|
||||
baidustatic.com
|
||||
baofeng.com
|
||||
baofeng.net
|
||||
bdimg.com
|
||||
bdstatic.com
|
||||
cbjs.baidu.com
|
||||
cnbeta.com
|
||||
cnbetacdn.com
|
||||
cntv.cn
|
||||
cpro.baidu.com
|
||||
doubleclick.net
|
||||
fun.tv
|
||||
funshion.com
|
||||
googles.com
|
||||
hitvs.cn
|
||||
hljtv.com
|
||||
hm.baidu.com
|
||||
hoopchina.com.cn
|
||||
hunantv.com
|
||||
ifeng.com
|
||||
img1.kyimg.com
|
||||
iqiyi.com
|
||||
itc.cn
|
||||
jiuzhilan.com
|
||||
kankan.com
|
||||
kankan.xunlei.com
|
||||
ku6.com
|
||||
kuyun.com
|
||||
l.qq.com
|
||||
letv.com
|
||||
letvcloud.com
|
||||
letvimg.com
|
||||
list.video.baidu.com
|
||||
lives.l.aiseet.atianqi.com
|
||||
mediav.com
|
||||
mydrivers.com
|
||||
nsclick.baidu.com
|
||||
play.baidu.com
|
||||
pplive.cn
|
||||
pps.tv
|
||||
ppsimg.com
|
||||
pptv.com
|
||||
ptqy.gitv.tv
|
||||
pv.sohu.com
|
||||
qiyi.com
|
||||
renren.com
|
||||
right.com.cn
|
||||
sclick.baidu.com
|
||||
serving-sys.com
|
||||
share.baidu.com
|
||||
sohu.com
|
||||
sv-video.play.ott.video.qq.com
|
||||
tieba.baidu.com
|
||||
tudou.com
|
||||
v-56.com
|
||||
v.baidu.com
|
||||
v.qq.com
|
||||
video.sina.com.cn
|
||||
wasu.cn
|
||||
www.qq.com
|
||||
you85.cn
|
||||
youku.com
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f "/tmp/adbyby.updated" ];then
|
||||
touch /tmp/adbyby.mem
|
||||
wget_ok="0"
|
||||
while [ "$wget_ok" = "0" ]
|
||||
do
|
||||
uclient-fetch --spider --quiet --tries=1 --timeout=3 www.baidu.com
|
||||
if [ "$?" == "0" ]; then
|
||||
wget_ok="1"
|
||||
|
||||
touch /tmp/md5.json && uclient-fetch --no-check-certificate -t 1 -T 10 -O /tmp/md5.json https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/md5.json
|
||||
adm5=$(md5sum /tmp/md5.json | awk -F' ' '{print $1}')
|
||||
touch /tmp/adbyby/admd5.json && bmd5=$(md5sum /tmp/adbyby/admd5.json | awk -F' ' '{print $1}')
|
||||
if [ "$adm5" == "$bmd5" ];then
|
||||
echo "Rules MD5 are the same!"
|
||||
echo $(date "+%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
exit 0
|
||||
else
|
||||
|
||||
touch /tmp/lazy.txt && uclient-fetch --no-check-certificate -t 1 -T 10 -O /tmp/lazy.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/lazy.txt
|
||||
touch /tmp/video.txt && uclient-fetch --no-check-certificate -t 1 -T 10 -O /tmp/video.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/video.txt
|
||||
|
||||
touch /tmp/local-md5.json && md5sum /tmp/lazy.txt /tmp/video.txt > /tmp/local-md5.json
|
||||
|
||||
|
||||
lazy_local=$(grep 'lazy' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
video_local=$(grep 'video' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
lazy_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '2p')
|
||||
video_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '4p')
|
||||
|
||||
if [ "$lazy_online"x == "$lazy_local"x -a "$video_online"x == "$video_local"x ]; then
|
||||
echo "adbyby rules MD5 OK!"
|
||||
mv /tmp/lazy.txt /tmp/adbyby/data/lazy.txt
|
||||
mv /tmp/video.txt /tmp/adbyby/data/video.txt
|
||||
mv /tmp/md5.json /tmp/adbyby/admd5.json
|
||||
echo $(date "+%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
fi
|
||||
fi
|
||||
else
|
||||
sleep 10
|
||||
fi
|
||||
done
|
||||
|
||||
sleep 10 && /etc/init.d/adbyby restart
|
||||
fi
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f /usr/share/adbyby/data/*.bak
|
||||
|
||||
touch /tmp/local-md5.json && md5sum /usr/share/adbyby/data/lazy.txt /usr/share/adbyby/data/video.txt > /tmp/local-md5.json
|
||||
touch /tmp/md5.json && uclient-fetch --no-check-certificate -T 10 -O /tmp/md5.json https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/md5.json
|
||||
|
||||
lazy_local=$(grep 'lazy' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
video_local=$(grep 'video' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
lazy_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '2p')
|
||||
video_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '4p')
|
||||
|
||||
if [ "$lazy_online"x != "$lazy_local"x -o "$video_online"x != "$video_local"x ]; then
|
||||
echo "MD5 not match! Need update!"
|
||||
touch /tmp/lazy.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/lazy.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/lazy.txt
|
||||
touch /tmp/video.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/video.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/video.txt
|
||||
touch /tmp/local-md5.json && md5sum /tmp/lazy.txt /tmp/video.txt > /tmp/local-md5.json
|
||||
lazy_local=$(grep 'lazy' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
video_local=$(grep 'video' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
if [ "$lazy_online"x == "$lazy_local"x -a "$video_online"x == "$video_local"x ]; then
|
||||
echo "New rules MD5 match!"
|
||||
mv /tmp/lazy.txt /usr/share/adbyby/data/lazy.txt
|
||||
mv /tmp/video.txt /usr/share/adbyby/data/video.txt
|
||||
echo $(date +"%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
fi
|
||||
else
|
||||
echo "MD5 match! No need to update!"
|
||||
fi
|
||||
|
||||
rm -f /tmp/lazy.txt /tmp/video.txt /tmp/local-md5.json /tmp/md5.json
|
||||
@@ -1 +0,0 @@
|
||||
2.2.2.2
|
||||
Whitespace-only changes.
@@ -1,4 +0,0 @@
|
||||
address=/p.tanx.com/0.0.0.0
|
||||
address=/googlesyndication.com/0.0.0.0
|
||||
address=/linkvans.com/0.0.0.0
|
||||
server=/valf.atm.youku.com/114.114.114.114
|
||||
@@ -1,3 +0,0 @@
|
||||
ipset=/weixin.qq.com/adbyby_wan
|
||||
ipset=/qpic.cn/adbyby_wan
|
||||
ipset=/imtt.qq.com/adbyby_wan
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f /tmp/blockip.ipset ];then
|
||||
|
||||
adbyby_enable=$(uci get adbyby.@adbyby[0].enable)
|
||||
|
||||
if [ $adbyby_enable -eq 1 ]; then
|
||||
if pidof adbyby>/dev/null; then
|
||||
/etc/init.d/adbyby reload_rule
|
||||
else
|
||||
/etc/init.d/adbyby restart
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
find $1 -type f -exec cat {} \; | wc -l
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
url_md5() {
|
||||
echo -n $1|md5sum|cut -d ' ' -f1
|
||||
}
|
||||
|
||||
convert_rules() {
|
||||
mkdir -p /tmp/rules/data
|
||||
mkdir -p /tmp/rules/host
|
||||
|
||||
uclient-fetch -q --no-check-certificate $1 -O /tmp/adnew.conf
|
||||
|
||||
rulename=$(url_md5 $1)
|
||||
|
||||
if [ -f /tmp/adnew.conf ]; then
|
||||
if (grep -wq "address=" /tmp/adnew.conf) ; then
|
||||
cp /tmp/adnew.conf /tmp/rules/data/$rulename.conf
|
||||
elif (grep -wq -e"0.0.0.0" -e"127.0.0.1" /tmp/adnew.conf) ; then
|
||||
cp /tmp/adnew.conf /tmp/rules/host/$rulename.txt
|
||||
else
|
||||
cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/rules/data/$rulename.conf
|
||||
fi
|
||||
fi
|
||||
rm -rf /tmp/adnew.conf
|
||||
}
|
||||
|
||||
ARRAY=$(uci get adbyby.@adbyby[0].subscribe_url 2> /dev/null)
|
||||
|
||||
rm -rf /tmp/rules
|
||||
|
||||
i=1
|
||||
for j in $ARRAY
|
||||
do
|
||||
convert_rules $j
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
@@ -1,15 +0,0 @@
|
||||
! ------------------------------ ADByby 自定义过滤语法简表---------------------------------
|
||||
! -------------- 规则基于abp规则,并进行了字符替换部分的扩展-----------------------------
|
||||
! ABP规则请参考https://adblockplus.org/zh_CN/filters,下面为大致摘要
|
||||
! "!" 为行注释符,注释行以该符号起始作为一行注释语义,用于规则描述
|
||||
! "*" 为字符通配符,能够匹配0长度或任意长度的字符串,该通配符不能与正则语法混用。
|
||||
! "^" 为分隔符,可以是除了字母、数字或者 _ - . % 之外的任何字符。
|
||||
! "|" 为管线符号,来表示地址的最前端或最末端
|
||||
! "||" 为子域通配符,方便匹配主域名下的所有子域。
|
||||
! "~" 为排除标识符,通配符能过滤大多数广告,但同时存在误杀, 可以通过排除标识符修正误杀链接。
|
||||
! "##" 为元素选择器标识符,后面跟需要隐藏元素的CSS样式例如 #ad_id .ad_class
|
||||
!! 元素隐藏暂不支持全局规则和排除规则
|
||||
!! 字符替换扩展
|
||||
! 文本替换选择器标识符,后面跟需要替换的文本数据,格式:$s@模式字符串@替换后的文本@
|
||||
! 支持通配符*和?
|
||||
! -------------------------------------------------------------------------------------------
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-adbyby-plus": {
|
||||
"description": "Grant UCI access for luci-app-adbyby-plus",
|
||||
"read": {
|
||||
"uci": [ "adbyby" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "adbyby" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"config": "adbyby",
|
||||
"init": "adbyby"
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=ARP Binding
|
||||
LUCI_DEPENDS:=+ip-full
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-arpbind
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=4
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -1,14 +0,0 @@
|
||||
--[[
|
||||
静态ARP绑定 Luci页面 Controller
|
||||
Copyright (C) 2015 GuoGuo <gch981213@gmail.com>
|
||||
]]--
|
||||
|
||||
module("luci.controller.arpbind", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/arpbind") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "network", "arpbind"}, cbi("arpbind"), _("IP/MAC Binding"), 45).dependent = true
|
||||
end
|
||||
@@ -1,40 +0,0 @@
|
||||
local sys = require "luci.sys"
|
||||
local ifaces = sys.net:devices()
|
||||
|
||||
m = Map("arpbind")
|
||||
m.title = translate("IP/MAC Binding")
|
||||
m.description = translatef("ARP is used to convert a network address (e.g. an IPv4 address) to a physical address such as a MAC address.Here you can add some static ARP binding rules.")
|
||||
|
||||
s = m:section(TypedSection, "arpbind", translate("Rules"))
|
||||
s.template = "cbi/tblsection"
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
|
||||
a = s:option(Value, "ipaddr", translate("IP Address"))
|
||||
a.optional = false
|
||||
a.datatype = "ipaddr"
|
||||
luci.ip.neighbors({ family = 4 }, function(entry)
|
||||
if entry.reachable then
|
||||
a:value(entry.dest:string())
|
||||
end
|
||||
end)
|
||||
|
||||
a = s:option(Value, "macaddr", translate("MAC Address"))
|
||||
a.datatype = "macaddr"
|
||||
a.optional = false
|
||||
luci.ip.neighbors({family = 4}, function(neighbor)
|
||||
if neighbor.reachable then
|
||||
a:value(neighbor.mac, "%s (%s)" %{neighbor.mac, neighbor.dest:string()})
|
||||
end
|
||||
end)
|
||||
|
||||
a = s:option(ListValue, "ifname", translate("Interface"))
|
||||
for _, iface in ipairs(ifaces) do
|
||||
if iface ~= "lo" then
|
||||
a:value(iface)
|
||||
end
|
||||
end
|
||||
a.default = "br-lan"
|
||||
a.rmempty = false
|
||||
|
||||
return m
|
||||
@@ -1,30 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Luci ARP Bind\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-06-23 20:16+0800\n"
|
||||
"PO-Revision-Date: 2015-06-23 20:17+0800\n"
|
||||
"Last-Translator: 981213 <gch981213@gmail.com>\n"
|
||||
"Language-Team: PandoraBox Team\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: Poedit 1.8.1\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
msgid "IP/MAC Binding"
|
||||
msgstr "IP/MAC 绑定"
|
||||
|
||||
msgid "IP Address"
|
||||
msgstr "IP 地址"
|
||||
|
||||
msgid "MAC Address"
|
||||
msgstr "MAC 地址"
|
||||
|
||||
msgid "ARP is used to convert a network address (e.g. an IPv4 address) to a physical address such as a MAC address.Here you can add some static ARP binding rules."
|
||||
msgstr "ARP 协议是用于实现网络地址到物理地址转换的协议。在这里,你可以设置静态 ARP 绑定规则。"
|
||||
|
||||
msgid "Rules"
|
||||
msgstr "规则"
|
||||
@@ -1 +0,0 @@
|
||||
zh-cn
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ "$ACTION" = "ifup" ] && /etc/init.d/arpbind start
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# OpenWrt 静态ARP绑定 启动脚本
|
||||
# Copyright (C) 2015 GuoGuo <gch981213@gmail.com>
|
||||
|
||||
START=80
|
||||
STOP=20
|
||||
|
||||
#清除单接口ARP
|
||||
#参数:$1:接口名称
|
||||
if_clean_arp()
|
||||
{
|
||||
[ -z "$1" ] && return
|
||||
ip link set arp off dev $1
|
||||
ip link set arp on dev $1
|
||||
}
|
||||
|
||||
#清除系统所有ARP
|
||||
#参数:无
|
||||
clean_arp()
|
||||
{
|
||||
for i in $(ls /sys/class/net)
|
||||
do
|
||||
if_clean_arp $i
|
||||
done
|
||||
}
|
||||
|
||||
#添加静态ARP绑定
|
||||
#参数:$1:IP地址 $2:MAC地址 $3:接口名称
|
||||
add_arp()
|
||||
{
|
||||
[ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] && return
|
||||
echo "Adding ARP:IP Addr:$1 MAC Addr:$2 Interface:$3"
|
||||
ip neigh add $1 lladdr $2 nud permanent dev $3 || \
|
||||
ip neigh change $1 lladdr $2 nud permanent dev $3
|
||||
}
|
||||
|
||||
arpconf_foreach()
|
||||
{
|
||||
config_get ipaddr "$1" 'ipaddr'
|
||||
config_get macaddr "$1" 'macaddr'
|
||||
config_get ifname "$1" 'ifname'
|
||||
[ -z "$ifname" ] && return
|
||||
add_arp $ipaddr $macaddr $ifname
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
config_load 'arpbind'
|
||||
config_foreach arpconf_foreach 'arpbind'
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
clean_arp
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
touch /etc/config/arpbind
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@arpbind[-1]
|
||||
add ucitrack arpbind
|
||||
set ucitrack.@arpbind[-1].init=arpbind
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-arpbind": {
|
||||
"description": "Grant UCI access for luci-app-arpbind",
|
||||
"read": {
|
||||
"uci": [ "arpbind" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "arpbind" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"config": "arpbind",
|
||||
"init": "arpbind"
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
# 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 Scheduled Reboot
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=11
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -1,9 +0,0 @@
|
||||
module("luci.controller.autoreboot",package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/autoreboot") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "system", "autoreboot"}, cbi("autoreboot"), _("Scheduled Reboot"),88)
|
||||
end
|
||||
@@ -1,34 +0,0 @@
|
||||
require("luci.sys")
|
||||
|
||||
m = Map("autoreboot")
|
||||
m.title = translate("Scheduled Reboot")
|
||||
m.description = translate("Scheduled reboot Setting")
|
||||
|
||||
s = m:section(TypedSection, "login")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
enable = s:option(Flag,"enable" ,translate("Enable"))
|
||||
enable.rmempty = false
|
||||
enable.default = 0
|
||||
|
||||
week = s:option(ListValue, "week", translate("Week Day"))
|
||||
week:value(7, translate("Everyday"))
|
||||
week:value(1, translate("Monday"))
|
||||
week:value(2, translate("Tuesday"))
|
||||
week:value(3, translate("Wednesday"))
|
||||
week:value(4, translate("Thursday"))
|
||||
week:value(5, translate("Friday"))
|
||||
week:value(6, translate("Saturday"))
|
||||
week:value(0, translate("Sunday"))
|
||||
week.default = 0
|
||||
|
||||
hour = s:option(Value, "hour", translate("Hour"))
|
||||
hour.datatype = "range(0,23)"
|
||||
hour.rmempty = false
|
||||
|
||||
pass = s:option(Value, "minute", translate("Minute"))
|
||||
pass.datatype = "range(0,59)"
|
||||
pass.rmempty = false
|
||||
|
||||
return m
|
||||
@@ -1,25 +0,0 @@
|
||||
msgid "Scheduled Reboot"
|
||||
msgstr "定时重启"
|
||||
|
||||
msgid "Scheduled reboot Setting"
|
||||
msgstr "定时重启设置"
|
||||
|
||||
msgid "Week Day"
|
||||
msgstr "星期"
|
||||
|
||||
msgid "Everyday"
|
||||
msgstr "每天"
|
||||
|
||||
msgid "Day"
|
||||
msgstr "天"
|
||||
|
||||
msgid "Hour"
|
||||
msgstr "小时"
|
||||
|
||||
msgid "Minute"
|
||||
msgstr "分钟"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
zh-cn
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
config login
|
||||
option minute '0'
|
||||
option hour '5'
|
||||
option week '3'
|
||||
option enable '0'
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=50
|
||||
|
||||
run_reboot()
|
||||
{
|
||||
local enable
|
||||
config_get_bool enable $1 enable
|
||||
|
||||
if [ $enable = 1 ]; then
|
||||
local minute
|
||||
local hour
|
||||
config_get week $1 week
|
||||
config_get minute $1 minute
|
||||
config_get hour $1 hour
|
||||
if [ $minute = 0 ] ; then
|
||||
minute="00"
|
||||
fi
|
||||
if [ $week = 7 ] ; then
|
||||
week="*"
|
||||
fi
|
||||
sed -i '/reboot/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
/etc/init.d/cron restart
|
||||
echo "$minute $hour * * $week sleep 5 && touch /etc/banner && reboot" >> /etc/crontabs/root
|
||||
echo "Auto REBOOT has started."
|
||||
else
|
||||
sed -i '/reboot/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
/etc/init.d/cron restart
|
||||
echo "Auto REBOOT has started."
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
config_load autoreboot
|
||||
config_foreach run_reboot login
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
sed -i '/reboot/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
/etc/init.d/cron restart
|
||||
echo "Auto REBOOT has stoped."
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@autoreboot[-1]
|
||||
add ucitrack autoreboot
|
||||
set ucitrack.@autoreboot[-1].init=autoreboot
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-autoreboot": {
|
||||
"description": "Grant UCI access for luci-app-autoreboot",
|
||||
"read": {
|
||||
"uci": [ "autoreboot" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "autoreboot" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"config": "autoreboot",
|
||||
"init": "autoreboot"
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# <https://github.com/KFERMercer/luci-app-baidupcs-web>
|
||||
#
|
||||
# Copyright (C) 2020 KFERMercer <KFER.Mercer@gmail.com>
|
||||
# Copyright (C) 2020 [CTCGFW] Project OpenWRT
|
||||
#
|
||||
# THIS IS FREE SOFTWARE, LICENSED UNDER GPLv3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-baidupcs-web
|
||||
LUCI_TITLE:=LuCI support for BaiduPCS-Go
|
||||
LUCI_DEPENDS:=+baidupcs-web +wget +openssl-util
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=6
|
||||
PKG_MAINTAINER:=<https://github.com/KFERMercer/luci-app-baidupcs-web>
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
Loaded 100 of 3800 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user