hongh2 发表于 2019-7-11 22:21

转发并完善KoolProxyR rules转换成KoolProxy rules自动更新规则办法

本帖最后由 hongh2 于 2019-10-11 17:45 编辑

摘自本论坛chatter和隔壁论坛的zycboss两位网友,古有云:前人栽树,后人乘凉。在此非常感谢!
10.9
鉴于有网友反馈的网络问题下载不了,在此提供规则文件,文件路径为/jffs/.koolshare/KoolProxy/data/rules,文件权限为0666
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
10.4
(1)鉴于kpr作者更新的频率,建议一月更新一次规则,减少对闪存芯片的写入次数。cru.sh的代码修改如下:
#!/bin/sh
cru a updateKP "0 3 */30 * * /bin/sh /jffs/scripts/kp.sh"(2)有反馈86u的tools中无script选项。为此说明如下:
Script选项添加WANSTART中填入/jffs/scripts/cru.sh,其目的是让路由器在断网重联(大部分断网原因是因为断电)之后执行cru.sh的命令。
因为断电重启后,路由器原先更新计划就会消失,这时再重新联网,执行Script选项中的cru.sh脚本,即可自动开启更新计划。
如果路由器可以保证长期不断电,没有Scrips选项也无大碍,跳过此设置步骤,在控制台输入/jffs/scripts/cru.sh,也可以自动实行更新计划。
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

简单写了一个自动转换脚本,会删除原有规则文件,请提前做好备份。
运行后效果如下:
https://www.right.com.cn/forum/data/attachment/forum/201907/04/005315tk109z01411z9k9y.jpg

食用方法
1.开启JFFS及SSH
2.下载winscp
3.通过winscp登陆路由器,用户名密码就是你路由器的登陆名和密码。
4.窗口的右侧为路由器的目录,打开/jffs/scripts目录,新建文件,命名为kp.sh(名字不重要,你记得就行),右键,编辑,选择内部编辑器,打开后菜单栏中的编码,UTF-8,输入以下代码后保存。脚本中星号为k o o l p r o x y 去掉空格的,被自动过滤了。(有人不理解这句话含义,也就是说代码中的“***”这个替换为去掉空格的“k o o l p r o x y”)cd /jffs/.koolshare/***/data/rules
# 删除旧版本规则文件
rm -rf ***.txt
rm -rf daily.txt
rm -rf kp.dat
rm -rf user.txt
# 下载新版本规则文件

wget -O daily.txt https://raw.githubusercontent.com/user1121114685/***R/master/***R/***R/data/rules/easylistchina.txt
wget -O ***.txt https://raw.githubusercontent.com/user1121114685/***R/master/***R/***R/data/rules/fanboy-annoyance.txt
wget -O kp.dat https://raw.githubusercontent.com/user1121114685/***R/master/***R/***R/data/rules/kp.dat
wget -O user.txt https://raw.githubusercontent.com/user1121114685/***R/master/***R/***R/data/rules/user.txt
# 下载扩展规则合并
wget -O user_tmp.txt https://gitee.com/hongh2/kpr_video_list/raw/master/kpr_video_list.txt
wget -O daily_tmp.txt https://raw.githubusercontent.com/user1121114685/***R/master/***R/***R/data/rules/yhosts.txt

cat user_tmp.txt >>user.txt
cat daily_tmp.txt >>daily.txt

echo 一点点清洁工作...
rm -rf user_tmp.txt
rm -rf daily_tmp.txt
echo ***规则已替换完成,请重新启用***!
KPR作者删除了kpr_video_list.txt文件,为此此文件地址改为私人地址,kpr_video_list.txt的规则会合并到user.txt中。如有顾虑请删除此行代码。


5.保存好了以后,在kp.sh上右键,属性,设置“八进制表”后面的几个数字为 0755

6.打开控制台(下图红圈标识),输入: /jffs/scripts/kp.sh,即可当即更新kp规则。(如出现下载为0的情况,几位网友反馈的都是在用了中国移动宽带的情况才出现此问题,本帖无法解决此问题,请知悉!)
https://www.right.com.cn/forum/data/attachment/forum/201907/17/160940b8yeu3yffiuczcze.png



7.现在我们需要一个定时运行的脚本,参照上述方法同样在/jffs/scripts/ 目录下 新建文件 cru.sh ,内容如下:
#!/bin/sh
cru a updateKP "0 3 */1 * * /bin/sh /jffs/scripts/kp.sh"含义:每隔1天的3点重启kp.sh脚本,cru a是一个命令,updateKP 是此段代码的标识,方便识别。



8.按下图在路由器管理界面Tools-Script里将cru.sh添加到开机启动:
http://image.koolshare.cn/attachment/forum/201801/15/180113w3ws4ya2z2wffufm.jpg
新版梅林在Tools没有了Script这个选项,建议

9.回到梅林软件中心的kp,打开插件j界面,设置重启时间。如本教程中设置为3点更新,插件自动重启就设置在3点30分。




10.重启机器,或者断开WAN后重连后,此脚本就会运行了,你也可以在SSH里用 cru l 命令查看计划任务是否添加成功。


这样一来,系统每隔1天的3点就会执行一次更新的操作。

以上方法只适用于手机端和电视端,对于PC浏览器而言不起作用,请大家知悉。
PC浏览器建议还是用插件吧,目前广告防御者可以去掉部分视频广告,也可以用ADbyby逗比版.exe,这个也可以去掉部分视频广告。


PS:
如自己使用的梅林版本没有kp,请前往https://www.right.com.cn/forum/thread-787974-1-1.html下载。注意,下载后的文件名称不要有空格,建议在google浏览器或火狐浏览器下进行离线安装。
本人AC1900P使用的koolshare的380.70_0-X7.9.1版的可以直接离线安装koolproxy 380 armv7,同设备的同学可以参照下。




当然你也可以自己改想要的时间间隔,教程下方提供了cru的编写语法。

cru的编写语法:cru a <unique id> <"min hour day month week command"> <脚本全路径>
a:add(添加)
unique id:标识(具有唯一性)
min 分钟(0-59)
hour 小时(0-24)
day 日期(1-31)
month 月份(1-12;或英文缩写Jan、Feb等)
week 周几(0-6,0为周日;或单词缩写Sun、Mon等)
每间隔多久用 [*/数字] 表示比如每周二凌晨4点重启就是:1.cru a reboot "0 4 * * 2 /sbin/reboot"每隔三天的凌晨4点重启就是:1.cru a reboot "0 4 */3 * * /sbin/reboot"第次重启,都会删除/var/spool/cron/crontabs内的定时任务列表文件,所以
在wan-start 上加,不过,你确定是每隔1分钟重启一次吗?cru a rebootSS "*/1    *   *       *      */bin/sh/koolshare/ss/ssconfig.shrestart"下面是第隔15分钟重启一次:cru a rebootSS "*/15*      *       *      */bin/sh/koolshare/ss/ssconfig.shrestart"下面是第隔2小时重启一次:cru a rebootSS "0      */2    *      *   */bin/sh/koolshare/ss/ssconfig.shrestart"====================================================================
cru定时程序add: cru a <“min hour day month week command”>
delete: cru d
list: cru l
min 分钟(0-59)
hour 小时(0-24)
day 日期(1-31)
month 月份(1-12;或英文缩写Jan、Feb等)
week 周几(0-6,0为周日;或单词缩写Sun、Mon等)
每间隔多久用 [*/数字] 表示
例1:周三的凌晨5点重启cru a Timer_ID1 "0    5   *   *   3   /sbin/reboot"例2:每隔5天的凌晨3点重启cru a Timer_ID2 "0    3   */5   *   *   /sbin/reboot"例2:每隔5分钟重启cru a Timer_ID3 "*/5*   *   *   *   /sbin/reboot"例4:删除定时器Timer_ID3cru d Timer_ID3例5:显示所有定时器列表:cru l

如对你有所帮助,请给予评分以资鼓励,感谢!

happycxm 发表于 2019-8-7 16:03

本帖最后由 happycxm 于 2019-8-7 16:06 编辑

hongh2 发表于 2019-8-7 15:27
两个插件文件修改好权限了吗
权限是修改好了的,但仍存在无法运行问题。
另附,数据更新时相关信息,请问,有什么问题没?
/jffs/scripts$/jffs/scripts/kp.shWill not apply HSTS. The HSTS database mustbe a regular and non-world-writable file.ERROR: could not open HSTS store at'/root/.wget-hsts'. HSTS will be disabled.--2019-08-07 13:57:54-- https://raw.githubusercontent.co ... s/easylistchina.txtResolving raw.githubusercontent.com...151.101.228.133Connecting toraw.githubusercontent.com|151.101.228.133|:443... connected.HTTP request sent, awaiting response... 200OKLength: 1017043 (993K) Saving to: 'daily.txt'
    0K .......... .......... .......... .......... ..........5% 46.3K 20s   50K .......... .......... .......... .......... .......... 10% 92.5K 14s100K .......... .......... .......... .......... .......... 15% 94.1K12s150K .......... .......... .......... .......... .......... 20%111K 10s200K .......... .......... .......... .......... .......... 25% 92.1K 9s   250K.......... .......... .......... .......... .......... 30%131K 8s300K .......... .......... .......... .......... .......... 35%125K 7s350K .......... .......... .......... .......... .......... 40% 92.4K 7s400K .......... .......... .......... .......... .......... 45% 56.7K 6s450K .......... .......... .......... .......... .......... 50% 92.1K 6s500K .......... .......... .......... .......... .......... 55% 92.2K 5s550K .......... .......... .......... .......... .......... 60%123K 4s600K .......... .......... .......... .......... .......... 65%160K 4s650K .......... .......... .......... .......... .......... 70%137K 3s700K .......... .......... .......... .......... .......... 75%182K 3s750K .......... .......... .......... .......... .......... 80% 93.0K 2s800K .......... .......... .......... .......... .......... 85%129K 1s850K .......... .......... .......... .......... .......... 90%120K 1s900K .......... .......... .......... .......... .......... 95%152K 0s950K .......... .......... .......... .......... ...       100% 160K=9.7s
2019-08-07 13:58:05 (102 KB/s) -'daily.txt' saved
Will not apply HSTS. The HSTS database mustbe a regular and non-world-writable file.ERROR: could not open HSTS store at'/root/.wget-hsts'. HSTS will be disabled.--2019-08-07 13:58:05-- https://raw.githubusercontent.co ... anboy-annoyance.txtResolving raw.githubusercontent.com...151.101.228.133Connecting toraw.githubusercontent.com|151.101.228.133|:443... connected.HTTP request sent, awaiting response... 200OKLength: 1091664 (1.0M) Saving to: 'koolproxy.txt'
    0K .......... .......... .......... .......... ..........4% 71.7K 14s   50K .......... .......... .......... .......... ..........9% 43.3K 18s100K .......... .......... .......... .......... .......... 14% 27.0K23s150K .......... .......... .......... .......... .......... 18% 42.9K21s200K .......... .......... .......... .......... .......... 23% 41.2K20s250K .......... .......... .......... .......... .......... 28% 36.0K19s300K .......... .......... .......... .......... .......... 32% 38.4K18s350K .......... .......... .......... .......... .......... 37% 27.7K18s400K .......... .......... .......... .......... .......... 42% 27.8K17s450K .......... .......... .......... .......... .......... 46% 31.2K16s500K .......... .......... .......... .......... .......... 51% 28.0K15s550K .......... .......... .......... .......... .......... 56% 20.1K14s600K .......... .......... .......... .......... .......... 60% 44.2K12s650K .......... .......... .......... .......... .......... 65% 21.4K11s700K .......... .......... .......... .......... .......... 70% 22.0K10s750K .......... .......... .......... .......... .......... 75% 24.2K 9s800K .......... .......... .......... .......... .......... 79% 42.8K 7s850K .......... .......... .......... .......... .......... 84% 52.0K 5s900K .......... .......... .......... .......... .......... 89% 33.8K 4s950K .......... .......... .......... .......... .......... 93% 38.3K 2s 1000K .......... .......... .......... .......... .......... 98% 81.3K0s 1050K .......... ......                                     100%187K=32s
2019-08-07 13:58:37 (33.7 KB/s) -'koolproxy.txt' saved
Will not apply HSTS. The HSTS database mustbe a regular and non-world-writable file.ERROR: could not open HSTS store at'/root/.wget-hsts'. HSTS will be disabled.--2019-08-07 13:58:38--https://raw.githubusercontent.co ... R/data/rules/kp.datResolving raw.githubusercontent.com...151.101.108.133Connecting toraw.githubusercontent.com|151.101.108.133|:443... connected.HTTP request sent, awaiting response... 200OKLength: 37232 (36K)Saving to: 'kp.dat'
    0K .......... .......... .......... ......               100%134K=0.3s
2019-08-07 13:58:39 (134 KB/s) - 'kp.dat'saved
Will not apply HSTS. The HSTS database mustbe a regular and non-world-writable file.ERROR: could not open HSTS store at'/root/.wget-hsts'. HSTS will be disabled.--2019-08-07 13:58:39-- https://raw.githubusercontent.co ... data/rules/user.txtResolving raw.githubusercontent.com...151.101.108.133Connecting toraw.githubusercontent.com|151.101.108.133|:443... connected.HTTP request sent, awaiting response... 200OKLength: 3872 (3.8K) Saving to: 'user.txt'
    0K ...                                                100% 5.44M=0.001s
2019-08-07 13:58:39 (5.44 MB/s) -'user.txt' saved
Will not apply HSTS. The HSTS database mustbe a regular and non-world-writable file.ERROR: could not open HSTS store at'/root/.wget-hsts'. HSTS will be disabled.--2019-08-07 13:58:39-- https://gitee.com/hongh2/kpr_vid ... /kpr_video_list.txtResolving gitee.com... 218.11.0.86Connecting to gitee.com|218.11.0.86|:443...connected.HTTP request sent, awaiting response... 200OKLength: 13966 (14K) Saving to: 'user_tmp.txt'
    0K .......... ...                                       100%267K=0.05s
2019-08-07 13:58:40 (267 KB/s) -'user_tmp.txt' saved
Will not apply HSTS. The HSTS database mustbe a regular and non-world-writable file.ERROR: could not open HSTS store at'/root/.wget-hsts'. HSTS will be disabled.--2019-08-07 13:58:40-- https://raw.githubusercontent.co ... ta/rules/yhosts.txtResolving raw.githubusercontent.com...151.101.108.133Connecting toraw.githubusercontent.com|151.101.108.133|:443... connected.HTTP request sent, awaiting response... 200OKLength: 426391 (416K) Saving to: 'daily_tmp.txt'
    0K .......... .......... .......... .......... .......... 12% 99.3K 4s   50K .......... .......... .......... .......... .......... 24% 2.21M 2s100K .......... .......... .......... .......... .......... 36%489K 1s150K .......... .......... .......... .......... .......... 48%372K 1s200K .......... .......... .......... .......... .......... 60%199K 1s250K .......... .......... .......... .......... .......... 72% 2.31M 0s300K .......... .......... .......... .......... .......... 84%446K 0s350K .......... .......... .......... .......... .......... 96%207K 0s400K .......... ......                                     100%2.39M=1.4s
2019-08-07 13:58:42 (299 KB/s) -'daily_tmp.txt' saved

x1008600011111 发表于 2020-2-16 15:08

我用下载器下载文件没反应,兲朝上网后可以下载,我又把路由器弄上兲朝上网,百分比更新。

ASUSWRT-Merlin R6300V2 380.70-0-X7.9.1 Tue Sep 25 11:47:13 UTC 2018
admin@R6300V2-E31E:/tmp/home/root# /jffs/scripts/kp.sh
--2020-02-16 14:38:03--https://raw.githubusercontent.com/user1121114685/koolproxyR/master/koolproxyR/koolproxyR/data/rules/easylistchina.txt
Resolving raw.githubusercontent.com... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1162503 (1.1M)
Saving to: 'daily.txt'

daily.txt            100%[=======================>]   1.11M5.45KB/s   in 3m 17s

2020-02-16 14:41:27 (5.75 KB/s) - 'daily.txt' saved

--2020-02-16 14:41:27--https://raw.githubusercontent.com/user1121114685/koolproxyR/master/koolproxyR/koolproxyR/data/rules/fanboy-annoyance.txt
Resolving raw.githubusercontent.com... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1144719 (1.1M)
Saving to: 'koolproxy.txt'

koolproxy.txt      100%[=======================>]   1.09M7.04KB/s   in 2m 48s

2020-02-16 14:44:21 (6.64 KB/s) - 'koolproxy.txt' saved

--2020-02-16 14:44:22--https://raw.githubusercontent.com/user1121114685/koolproxyR/master/koolproxyR/koolproxyR/data/rules/kp.dat
Resolving raw.githubusercontent.com... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 50896 (50K)
Saving to: 'kp.dat'

kp.dat               100%[=======================>]49.70K7.23KB/s   in 6.9s

2020-02-16 14:44:34 (7.23 KB/s) - 'kp.dat' saved

--2020-02-16 14:44:34--https://raw.githubusercontent.com/user1121114685/koolproxyR/master/koolproxyR/koolproxyR/data/rules/user.txt
Resolving raw.githubusercontent.com... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3872 (3.8K)
Saving to: 'user.txt'

user.txt             100%[=======================>]   3.78K--.-KB/s   in 0.1s

2020-02-16 14:44:37 (32.1 KB/s) - 'user.txt' saved

--2020-02-16 14:44:37--https://gitee.com/hongh2/kpr_video_list/raw/master/kpr_video_list.txt
Resolving gitee.com... 212.64.62.183
Connecting to gitee.com|212.64.62.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13966 (14K)
Saving to: 'user_tmp.txt'

user_tmp.txt         100%[=======================>]13.64K--.-KB/s   in 0.03s

2020-02-16 14:44:38 (414 KB/s) - 'user_tmp.txt' saved

--2020-02-16 14:44:38--https://raw.githubusercontent.com/user1121114685/koolproxyR/master/koolproxyR/koolproxyR/data/rules/yhosts.txt
Resolving raw.githubusercontent.com... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 453369 (443K)
Saving to: 'daily_tmp.txt'

daily_tmp.txt      100%[=======================>] 442.74K7.07KB/s   in 64s

2020-02-16 14:45:46 (6.91 KB/s) - 'daily_tmp.txt' saved

一点点清洁工作...
koolproxy规则已替换完成,请重新启用koolproxy!
admin@R6300V2-E31E:/tmp/home/root#

a5850447 发表于 2019-7-23 14:20

为什么我的是出错
/jffs/scripts$ /jffs/scripts/kp.sh
/jffs/scripts/kp.sh: cd: line 1: can't cd to /jffs/.koolshare/Koolproxy/data/rules
Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at '/root/.wget-hsts'. HSTS will be disabled.
--2019-07-23 14:14:58--https://raw.githubusercontent.com/user1121114685/KoolproxyR/master/KoolproxyR/KoolproxyR/data/rules/easylistchina.txt
Resolving raw.githubusercontent.com... 151.101.228.133
Connecting to raw.githubusercontent.com|151.101.228.133|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-07-23 14:15:03 ERROR 404: Not Found.

Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at '/root/.wget-hsts'. HSTS will be disabled.
--2019-07-23 14:15:03--https://raw.githubusercontent.com/user1121114685/KoolproxyR/master/KoolproxyR/KoolproxyR/data/rules/fanboy-annoyance.txt
Resolving raw.githubusercontent.com... 151.101.228.133
Connecting to raw.githubusercontent.com|151.101.228.133|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-07-23 14:15:05 ERROR 404: Not Found.

Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at '/root/.wget-hsts'. HSTS will be disabled.
--2019-07-23 14:15:05--https://raw.githubusercontent.com/user1121114685/KoolproxyR/master/KoolproxyR/KoolproxyR/data/rules/kp.dat
Resolving raw.githubusercontent.com... 151.101.228.133
Connecting to raw.githubusercontent.com|151.101.228.133|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-07-23 14:15:07 ERROR 404: Not Found.

Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at '/root/.wget-hsts'. HSTS will be disabled.
--2019-07-23 14:15:07--https://raw.githubusercontent.com/user1121114685/KoolproxyR/master/KoolproxyR/KoolproxyR/data/rules/user.txt
Resolving raw.githubusercontent.com... 151.101.228.133
Connecting to raw.githubusercontent.com|151.101.228.133|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-07-23 14:15:12 ERROR 404: Not Found.

Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at '/root/.wget-hsts'. HSTS will be disabled.
--2019-07-23 14:15:13--https://gitee.com/hongh2/kpr_video_list/raw/master/kpr_video_list.txt
Resolving gitee.com... 116.211.167.14
Connecting to gitee.com|116.211.167.14|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13966 (14K)
Saving to: 'user_tmp.txt'

   0K .......... ...                                        100%410K=0.03s

2019-07-23 14:15:15 (410 KB/s) - 'user_tmp.txt' saved

Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at '/root/.wget-hsts'. HSTS will be disabled.
--2019-07-23 14:15:15--https://raw.githubusercontent.com/user1121114685/KoolproxyR/master/KoolproxyR/KoolproxyR/data/rules/yhosts.txt
Resolving raw.githubusercontent.com... 151.101.228.133
Connecting to raw.githubusercontent.com|151.101.228.133|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-07-23 14:15:17 ERROR 404: Not Found.

hongh2 发表于 2019-7-11 22:21

自己顶自己一下。

Lxl_750629 发表于 2019-7-11 22:22

谢谢分享!

猜破天机 发表于 2019-7-11 22:22

看看是什么好东西

北国冰雪 发表于 2019-7-11 22:43

一定顶起来 好贴

monsun 发表于 2019-7-11 22:48

楼主有 KP 的离线安装包嘛? 刷机发现那边停更了.....

ms6199 发表于 2019-7-11 22:51

看看学习学习

makunjida 发表于 2019-7-11 22:51

感谢楼主感谢楼主感谢楼主

逝水忆流年 发表于 2019-7-11 22:53

看看帖子里藏了啥好东西~~~

wenzhoulong 发表于 2019-7-11 22:56

看着不错,效果如何

zshwq5 发表于 2019-7-11 22:58

食用方法就怎么操作的?

TengT 发表于 2019-7-11 23:08

感谢分享   



wlswan9 发表于 2019-7-11 23:13

感谢大佬分享

pulake 发表于 2019-7-11 23:15

感谢分享,看看有效果没

zuiailanse 发表于 2019-7-11 23:27

这个厉害了,看看好用不
页: [1] 2 3 4 5 6 7 8 9 10
查看完整版本: 转发并完善KoolProxyR rules转换成KoolProxy rules自动更新规则办法