datocp
31 天前
这种有 ssh 最好,可以自己在其它路由用 sshpass 进行远程登录重启
sshpass -p 'your_password' ssh user@remote_host 'sudo reboot'
其它的分析网页的有点麻烦,但是当年也尝试成功了。
Reboot TP-Link Router TL-WA7510N using Curl
Posted By Abir Pathak on Nov 2, 2015 | 1 comment
Tags: automated, curl, reboot, script, TL-WA7510N, tp-link, WA7510N
I have a TP-Link outdoor AP point router:
Hardware Version: WA7510N v2
It sometimes freezes and I need to manually reboot it. My downloads suffer and I am a bit OCDic about continuous downloads and no speed wasted.
So, I had been trying to find a way to have an automated process for that.
The router has this URL for rebooting it:
http://192.168.1.254:8888/userRpm/SysRebootRpm.htm?Reboot=Reboot
You need your username/password with curl:
(Make sure to replace the correct IP, port, username and password for your router)
CURL Command Line:
1
curl -D -s --header "Referer: http://192.168.1.254:8888/userRpm/SysRebootRpm.htm" -u "admin:password" "http://192.168.1.254:8888/userRpm/SysRebootRpm.htm?Reboot=Reboot"
Note: Adding referer header is very important. Without it, you will get an error:
“You have no authority to access this router”
Another way you can do this is if you can find your Authorization key.
(In case you need to keep your script out in the open. And don’t want to put your username and password for everyone to see.)
Once you login to your router in your web browser, just look at any HTTP request/response. You can use Developer tools (F12) -> Network (Chrome). Or maybe an HTTP capture tool like Fiddler, Charles etc. In any of the request/responses you capture you’ll be able to see a header like: Authorization:Basic ABCdef123456
You can use it like this:
1
curl -D -s --header "Authorization:Basic ABCdef123456" --header "Referer: http://192.168.1.254:8888/userRpm/SysRebootRpm.htm" "http://192.168.1.254:8888/userRpm/SysRebootRpm.htm?Reboot=Reboot"
No need to add username and password in this command. Unfortunately you’ll need to find your Authorization string manually.
You can also put this command in a batch script.