wget post表单重新启动路由器
我想重新开始我的Fritz!使用wget的方框7390。 webinterface有一个重新启动表单,如下所示:wget post表单重新启动路由器,wget,router,reboot,fritzbox,Wget,Router,Reboot,Fritzbox,我想重新开始我的Fritz!使用wget的方框7390。 webinterface有一个重新启动表单,如下所示: <form action="/system/reboot.lua" method="POST"> <div id="btn_form_foot"> <input type="hidden" name="sid" value="beb5683181c2ab9f"> <button type="submit" name="reboot">N
<form action="/system/reboot.lua" method="POST">
<div id="btn_form_foot">
<input type="hidden" name="sid" value="beb5683181c2ab9f">
<button type="submit" name="reboot">Neu starten</button>
</div>
</form>
每次我加载页面时,sid似乎都会改变
但我不确定这是否是问题所在,因为我可以通过在url中添加?sid=example来修复sid。你不能只发布到该url。您首先需要获取有效的会话id。这可以通过在
http://fritz.box/checklogin.lua
并从位置
标题值抓取它。然后您可以使用此功能发布到http://fritz.box/system/reboot.lua
包括会话id
以下是实现自动化的最低步骤:
SID=$(curl -s -I "http://fritz.box/logincheck.lua" | grep -Fi Location | awk -F'[=]' '{print $2}')
SID=$(curl -s -i -H "Content-Type: application/x-www-form-urlencoded" -H "Origin: http://fritz.box" -H "Referer: http://fritz.box/system/reboot.lua\?sid\=$SID" --data "reboot=&sid=$SID" -L http://fritz.box/system/reboot.lua | grep -Fi Location | awk -F'[=]' '{print $2}')
curl -s http://fritz.box/reboot.lua?ajax=1&sid=$REBOOT_SID
我创建了一个带有一些额外检查的小脚本,您可以在此处找到完整的脚本,包括检查,请访问:建议当前软件(v7.20+)的步骤是什么?
最好用于受密码保护的路由器 我尝试使用Chrome开发工具信息更新它以使用最近的路径。
它给出一个状态码
200
和响应:{“重新启动状态”:“外部”}
但没有重启 Chrome Developer Tools表示,按下UI中的
重启
按钮时的url为:
curl 'http://fritz.box/reboot.lua' \
-H 'Connection: keep-alive' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'User-Agent: Mozilla/5.0 (...) Chrome/86.0.4240.111 Safari/537.36' \
-H 'DNT: 1' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: */*' \
-H 'Origin: http://fritz.box' \
-H 'Referer: http://fritz.box/' \
-H 'Accept-Language: en,en-US;q=0.9,nl;q=0.8,de;q=0.7,la;q=0.6' \
--data-raw 'ajax=1&sid=1fd4370b50b14b07&no_sidrenew=1&xhr=1&useajax=1' \
--compressed \
--insecure
(
sid
每次登录后都会发生明显变化)您的wget命令看起来很正确。能否在浏览器中启用网络检查器并尝试重新启动路由器?共享正在发送的数据包的详细信息。它应该揭示问题所在。如何在chrome中启用网络检查器?右键单击页面,选择Inspect Element,然后移动到网络选项卡。然后单击网页上的重置按钮
curl 'http://fritz.box/reboot.lua' \
-H 'Connection: keep-alive' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'User-Agent: Mozilla/5.0 (...) Chrome/86.0.4240.111 Safari/537.36' \
-H 'DNT: 1' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: */*' \
-H 'Origin: http://fritz.box' \
-H 'Referer: http://fritz.box/' \
-H 'Accept-Language: en,en-US;q=0.9,nl;q=0.8,de;q=0.7,la;q=0.6' \
--data-raw 'ajax=1&sid=1fd4370b50b14b07&no_sidrenew=1&xhr=1&useajax=1' \
--compressed \
--insecure