找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 52624|回复: 372

【2019-5-31】AC9改好GPIO增加User_Scripts基于华硕3.0.0.4.382.51610源码16M固件

 火... [复制链接]
本帖最后由 aoeII 于 2019-5-31 16:43 编辑

采用ASUS官方源码修改编译而来。


源码下载地址:https://dlcdnets.asus.com/pub/ASUS/wireless/RT-AC1200G+/GPL_RT-AC1200GPlus_300438251610.zip?_ga=2.53265576.1240088749.1559268863-196246637.1546938074

固件说明:

1、修改init.c,适配GPIO(包含在了增加用户脚本User_Scripts源码修改文件里)

2、增加用户脚本User_Scripts功能,源码修改文件见帖子附件

3、用梅林源码里的wget 1.20替换官方源码里的1.16,以适应某些网站对tls 1.2的要求
     wget 1.20 源码下载地址:https://github.com/RMerl/asuswrt-merlin.ng/tree/master/release/src/router/wget

4、修改Makefile,把源码中编译出来的curl 7.21.7安装到/usr/sbin下面(官方源码只编译不安装curl,除非选用speedtest组件)
     修改方法:找到判断speedtest是否安装的语句注释或删除
  1. curl-7.21.7-install: curl-7.21.7
  2.         @$(SEP)
  3.         install -D curl-7.21.7/lib/.libs/libcurl.so.4.2.0 $(INSTALLDIR)/curl-7.21.7/usr/lib/libcurl.so.4.2.0
  4.         $(STRIP) $(INSTALLDIR)/curl-7.21.7/usr/lib/libcurl.so.4.2.0
  5.         cd $(INSTALLDIR)/curl-7.21.7/usr/lib && ln -sf libcurl.so.4.2.0 libcurl.so && ln -sf libcurl.so.4.2.0 libcurl.so.4
  6. # ifeq ($(RTCONFIG_SPEEDTEST),y)
  7.         # for speedtest
  8.         install -D curl-7.21.7/src/.libs/curl $(INSTALLDIR)/curl-7.21.7/usr/sbin/curl
  9.         $(STRIP) $(INSTALLDIR)/curl-7.21.7/usr/sbin/curl
  10. # endif
复制代码


用户脚本使用方法:
1、在系统设置里打开SSH,为安全起见,仅内网Lan可登录



2、用putty等终端软件登陆路由器SHELL环境,执行以下命令,并等待路由器重启
  1. nvram set jffs2_on=1
  2. nvram set jffs2_enable=1
  3. nvram set jffs2_format=1
  4. nvram set jffs2_scripts=1
  5. nvram commit
  6. reboot
复制代码


3、用Winscp登录路由器,可以看到/jffs下已自动建立configs和scripts两个子目录,可以写入自定义配置文件和脚本了。

附上一个我自己用的脚本/jffs/scripts/init-start,实现自定义hosts文件
  1. #!/bin/sh
  2. i=0
  3. while [ $i -le 20 ]; do
  4.       success_start_service=`nvram get success_start_service`
  5.       if [ "$success_start_service" == "1" ]; then
  6.               break
  7.       fi
  8.       i=$(($i+1))
  9.       echo "autorun APP: wait $i seconds...";
  10.       sleep 1
  11. done
  12. #从下方开始你的脚本
  13. rm -f /etc/hosts
  14. cp -rf /jffs/configs/hosts /etc/hosts
  15. sleep 30
  16. killall -SIGHUP dnsmasq
复制代码


dnspod动态域名更新脚本/jffs/scripts/wan-start(没有修改出custom_ddns,需要改动的地方比较多,先用这个凑合一下)
  1. #!/bin/sh
  2. #################################################
  3. # AnripDdns v5.08
  4. # 基于DNSPod用户API实现的动态域名客户端
  5. # 作者: 若海[mail@anrip.com]
  6. # 介绍: http://www.anrip.com/ddnspod
  7. # 时间: 2016-02-24 16:25:00
  8. # Mod: 荒野无灯 http://ihacklog.com  2016-03-16
  9. # Mod: aoeii https://aoeii.com  2019-05-30
  10. #################################################
  11. # 等待获得外网IP (wan0=第1wan  wan1=第2wan)
  12. i=0
  13. while [ $i -le 30 ]; do
  14.           wan_ip_last3digits=`nvram get wan0_ipaddr | awk -F "." '{print $4}'`
  15.           if [ "$wan_ip_last3digits" != "255" ]; then
  16.               break
  17.       fi
  18.       i=$(($i+1))
  19.       echo "autorun APP: wait $i seconds...";
  20.       sleep 1
  21. done
  22. #延迟两分钟,等待ntp服务同步路由器时间
  23. sleep 120
  24. # 获得本地外网IP (wan0=第1wan  wan1=第2wan)
  25. arIpAdress() {
  26.     local inter=`nvram get wan0_ipaddr`
  27.     echo $inter
  28. }
  29. # 查询域名地址
  30. # 参数: 待查询域名
  31. arNslookup() {
  32.     local inter="http://ip.taobao.com/service/getIpInfo2.php?ip=myip"
  33.     local ipstr=`wget --quiet --output-document=- $inter$1`
  34.     if [ $? != 0 ]; then
  35.         local ipstr=`curl -s  $inter$1`
  36.     fi   
  37.     echo $ipstr$1 | awk -F"ip" '{print $2}' | awk -F'"' '{print $3}'
  38. }
  39. # 读取接口数据
  40. # 参数: 接口类型 待提交数据
  41. arApiPost() {
  42.     local agent="AnripDdns/5.07(mail@anrip.com)"
  43.     local inter="https://dnsapi.cn/${1:?'Info.Version'}"
  44.         if [ "x${arToken}" = "x" ]; then # undefine token
  45.         local param="login_email=${arMail}&login_password=${arPass}&format=json&${2}"
  46.         else
  47.             local param="login_token=${arToken}&format=json&${2}"
  48.         fi
  49.         wget --quiet --no-check-certificate --output-document=- --user-agent=$agent --post-data $param $inter
  50.     if [ $? != 0 ]; then
  51.             curl --silent -X POST -H 'charset=UTF-8;' --user-agent "$agent" --data "$param" $inter
  52.     fi
  53. }
  54. # 更新记录信息
  55. # 参数: 主域名 子域名
  56. arDdnsUpdate() {
  57.     local domainID recordID recordRS recordCD
  58.     # 获得域名ID
  59.     domainID=$(arApiPost "Domain.Info" "domain=${1}")
  60.     domainID=$(echo $domainID | sed 's/.\+{"id":"\([0-9]\+\)".\+/\1/')
  61.     # 获得记录ID
  62.     recordID=$(arApiPost "Record.List" "domain_id=${domainID}&sub_domain=${2}")
  63.         recordID=$(echo $recordID | sed 's/.\+\[{"id":"\([0-9]\+\)".\+/\1/')
  64.         # 更新记录IP
  65.         recordRS=$(arApiPost "Record.Ddns" "domain_id=${domainID}&record_id=${recordID}&sub_domain=${2}&record_line=默认&value=$hostIP")
  66.         recordCD=$(echo $recordRS | sed 's/.\+{"code":"\([0-9]\+\)".\+/\1/')
  67.         # 输出记录IP
  68.         if [ "$recordCD" == "1" ]; then
  69.             echo $recordRS | sed 's/.\+,"value":"\([0-9\.]\+\)".\+/\1/'
  70.             return 1
  71.         fi
  72.         # 输出错误信息
  73.         echo $recordRS | sed 's/.\+,"message":"\([^"]\+\)".\+/\1/'
  74. }
  75. # 动态检查更新
  76. # 参数: 主域名 子域名
  77. arDdnsCheck() {
  78.     local postRS
  79.     local hostIP=$(arIpAdress)
  80.         local lastIP=$(arNslookup)
  81.     echo "hostIP: ${hostIP}"
  82.         echo "lastIP: ${lastIP}"
  83.     if [ "$lastIP" != "$hostIP" ]; then
  84.         postRS=$(arDdnsUpdate $1 $2)
  85.             echo "postRS: ${postRS}"
  86.         if [ $? -ne 1 ]; then
  87.             return 1
  88.         fi
  89.     fi
  90.     return 0
  91. }
  92. ###################################################
  93. # 使用Token认证(免登陆,安全性更高,推荐使用) 请去 https://www.dnspod.cn/console/user/security 获取
  94. arToken="12345,123456789abcdefghijklmnopq"
  95. # 使用邮箱和密码认证(不启用Token用这个)
  96. arMail=""
  97. arPass=""
  98. ###################################################
  99. # 检查更新域名
  100. arDdnsCheck "aaa.com" "www"
  101. arDdnsCheck "bbb.com" ""
  102. arDdnsCheck "ccc.com" "pic"
  103. if [ $? -ne 0 ]; then
  104.         echo -n '##'"$(date "+%Y-%m-%d %H:%M:%S")"'## ''更新DDNS成功' >> /jffs/ddns.log
  105. else
  106.     echo -n '##'"$(date "+%Y-%m-%d %H:%M:%S")"'## ''IP未改变或更新失败' >> /jffs/ddns.log
  107. fi
复制代码


别忘了给脚本加上执行权限:

  1. chmod +x /jffs/scripts/*.*
复制代码
固件及修改文件下载地址:

固件:
https://aoeii.com/router/image-1 ... et1.20-curl7.21.zip

Makefile:
https://aoeii.com/router/Makefile.zip

wget 1.20:
https://aoeii.com/router/wget_1.20.zip

启用user_scripts功能的源码修改






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 9恩山币 +13 收起 理由
ant*** + 6 感谢你的分享,无论怎样,你都是最无私的人!来,说说,你E盘上还有啥一起给我吧!
sx*** -1 刷完路由器无限重启 不拆机救都就不回来
Everw*** + 1 强大的恩山!(以下重复1万次)
95*** + 1 一看就是觉得高端、大气、上档次!
馕*** + 1 强大的恩山!(以下重复1万次)
懒*** + 1 强大的恩山!(以下重复1万次)能否出个8M精简固件,大佬。
crazyb*** + 1 强大的恩山!(以下重复1万次)
ph*** + 2 强大的恩山!(以下重复1万次)
sa*** + 1 一看就是觉得高端、大气、上档次!

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
6666666666666666666
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

终于有AC9的固件更新了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

楼主辛苦,顶
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报


终于有AC9的固件更新了,
楼主辛苦,顶!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
看看哈哈哈
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

没硬改的就看看,精简的用起来还不错
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

楼主牛逼~~~~~~~~~~~~~~~~~~
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
楼主666666666666666666666666
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

马上测试一下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

终于有人更新了!!!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

感谢分享!!辛苦了~~~
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

感谢分享!!辛苦了~~~
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

卧槽,强大!!!大神入住AC9呐  可喜可贺

点评

8M精简版的坛子里已经有改好GPIO的了,你可以搜一下,50264以后的源码编译出来的固件比之前的版本要大,精简起来总是顾头不顾尾,试着精简了几次,ddns页面打开都不正常,也不知道还要改哪些文件,就放弃了。  详情 回复 发表于 2019-6-1 00:13
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

感谢分享····
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-27 10:47

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表