AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1424328
Accepted
mina nageh
mina nageh
Asked: 2019-04-12 08:16:54 +0800 CST2019-04-12 08:16:54 +0800 CST 2019-04-12 08:16:54 +0800 CST

为什么我不能使用 curl -d 选项登录到我的路由器?

  • 772

用于登录的 curl 命令

curl "http://192.168.1.1/" -H "Connection: keep-alive" -H "Cache-Control: max-age=0" -H "Origin: http://192.168.1.1" -H "Upgrade-Insecure-Requests: 1" -H "DNT: 1" -H "Content-Type: application/x-www-form-urlencoded" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,ar;q=0.8" --data "frashnum=^&action=login^&Frm_Logintoken=9^&Username=admin^&Password=admin" --compressed 

顺便说一句 --compressed 不起作用所以我在输入命令之前将其删除在此处输入图像描述

登录前的 curl 命令

curl "http://192.168.1.1/" -H "Connection: keep-alive" -H "Cache-Control: max-age=0" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" -H "DNT: 1" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,ar;q=0.8" --compressed 
curl "http://192.168.1.1/css/login.css" -H "DNT: 1" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,ar;q=0.8" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" -H "Accept: text/css,*/*;q=0.1" -H "Referer: http://192.168.1.1/" -H "Connection: keep-alive" --compressed 
curl "http://192.168.1.1/css/styleen.css" -H "DNT: 1" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,ar;q=0.8" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" -H "Accept: text/css,*/*;q=0.1" -H "Referer: http://192.168.1.1/" -H "Connection: keep-alive" --compressed 

登录后

curl "http://192.168.1.1/" -H "Connection: keep-alive" -H "Cache-Control: max-age=0" -H "Origin: http://192.168.1.1" -H "Upgrade-Insecure-Requests: 1" -H "DNT: 1" -H "Content-Type: application/x-www-form-urlencoded" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,ar;q=0.8" --data "frashnum=^&action=login^&Frm_Logintoken=9^&Username=admin^&Password=admin" --compressed 
curl "http://192.168.1.1/start.ghtml" -H "Connection: keep-alive" -H "Cache-Control: max-age=0" -H "Upgrade-Insecure-Requests: 1" -H "DNT: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,ar;q=0.8" --compressed 
curl "http://192.168.1.1/top.gch" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "DNT: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" -H "Referer: http://192.168.1.1/start.ghtml" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,ar;q=0.8" --compressed 
curl "http://192.168.1.1/template.gch" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "DNT: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" -H "Referer: http://192.168.1.1/start.ghtml" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,ar;q=0.8" --compressed 

重要的提示

Frm_Logintiken 是由路由器生成的令牌,每次成功登录时它基本上加一!

尽管我将其更改为路由器页面,但该命令仍然无效!

每次响应都是一样的,就像它只处理命令的第一部分一样curl "http://192.168.1.1/"

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>&#90;&#88;&#72;&#78;&#32;&#72;&#49;&#48;&#56;&#78;&#32;&#86;&#50;&#46;&#53;</title>
<LINK REL="stylesheet" HREF="css/login.css" TYPE="text/css" />
<LINK REL="stylesheet" HREF="css/styleen.css" TYPE="text/css" />
<script>

function getObj(id)
{
return(document.getElementById(id));
}
var SetTFlag = 0;
var maxtime;
var interval;
function setTime()
{
if(window.name>=60 || window.name<0 || window.name=="")
{
maxtime = Math.min(60, 0 + 60 - 800881);
}
else
{
maxtime = window.name;
}
if(maxtime>=0)
{
seconds = maxtime;
getObj("time").innerHTML=seconds+" secs";
if (maxtime == 0)
{
setDisable();
SetTFlag =0;
window.name="";
if(interval)
{
clearInterval(interval);
interval = 0;
}
}
else
{
--maxtime;
SetTFlag = 1;
window.name = maxtime;
}
}
}
function setinner(type)
{
if (SetTFlag ==0)
{
getObj("myLayer").style.visibility = type ;
}
}
function Transfer_meaning(id,value)
{
getObj(id).value=value;
}
function ChangeLang()
{
var lang = "English";
getObj("_lang").disabled = false;
getObj("Frm_Username").disabled = true;
getObj("Frm_Password").disabled = true;
if(true != getObj("TestLang01").disabled)
{
if ("English" == lang)
{
getObj("_lang").value = "Chinese";
}
else if ("Chinese" == lang)
{
getObj("_lang").value = "English";
}
getObj("action").value = "setlang";
getObj("Frm_Username").disabled = true;
getObj("Frm_Password").disabled = true;
getObj("LoginId").disabled = true;
document.fLogin.submit();
}
}
</script>
</head>

<body>
<div id="container">
<div id="myLayer" onmousedown="setinner('hidden')" style="position:absolute; width:185px; height:91px; z-index:9; right: 50px; top: 140px; background: url(img/pop_up.gif) no-repeat; border: 1px none #000000; visibility: hidden;">
<div id="Layer1" style="position:absolute; width:180px; height:45px; z-index:10; left: 2px; top: 28px;">
<table width="183" border="0">
<tr>
<td width="183">&nbsp;&nbsp;<font id="errmsg" class="notecontent" ></font><span id="time" style="color:red;display:none;"></span></td>
</tr>
</table>
</div>
<div id="Layer3" style="position:absolute; width:140px; height:10px; z-index:11; left: 34px; top: 9px; font-size: 8pt;">
<font  class="note" id="errnote">&nbsp;Error</font>
</div>
</div>
<!--head▓┐╖╓┐¬╩╝-->
<div id="head">
<div class="type"><font id="">&#90;&#88;&#72;&#78;&#32;&#72;&#49;&#48;&#56;&#78;&#32;&#86;&#50;&#46;&#53;</font></div>
<div id="banner" style="background-image:url(img/banner.gif); background-repeat:no-repeat"></div>
</div>
<!--head▓┐╖╓╜ß╩°-->
<!--content▓┐╖╓┐¬╩╝-->
<div id="loginArea">
<form name="fLogin" id="fLogin" method="post"  onsubmit="return false;" action="">
<input type="hidden" name="_lang" id="_lang" value="" disabled>
<input type="hidden" name="frashnum" id="frashnum" value="">
<input type="hidden" name="action" id="action" value="login">
<input type="hidden" name="Frm_Logintoken" id="Frm_Logintoken" value="">
<!--─┌╚▌┐¬╩╝-->
<div class="login_frame">
<ul class="login_title">
<li class="login_title_left"></li>
<li class="login_title_center">Please login to continue...</li>

<li class="login_title_right"></li>
</ul>
<div class="content login_content">
<ul class="login_blank"></ul>
<ul class="login_ul_1">
<li class="login_li_1"><span>Username</span></li>
<li class="login_li_2">
<input type="text" class="username" name="Username" id="Frm_Username">
</li>
</ul>
<ul class="login_blank"></ul>
<ul class="login_ul_1">
<li class="login_li_1"><span>Password</span></li>
<li class="login_li_2">
<input type="password" class="password" name="Password"  id="Frm_Password">
</li>
<li class="login_li_3">
<input class="login" type="submit"  id="LoginId"  value="Login"  onclick="dosubmit()">
</li>
</ul>
</div>
</div>
<!--─┌╚▌╜ß╩°-->
</form>
</div>
<!--bottom▓┐╖╓┐¬╩╝-->

<div style="font-family: Arial;font-size: 12px;text-align:center;"> &copy; 2008-2015 ZTE Corporation. All rights reserved </div>

<div class="bottom_line"></div>
<div id="bottomx"></div>
<!--bottom▓┐╖╓╜ß╩°-->
</div>
</body>
</html>
<script>

window.name="";

function SetDisabled()
{
getObj("errmsg").innerHTML = "You have input the wrong username or password for three times. Please try again a minute later.";
getObj("Frm_Username").disabled = true;
getObj("Frm_Password").disabled = true;
getObj("LoginId").disabled = true;

getObj("myLayer").style.visibility = "visible" ;
getObj("time").style.display = "" ;
interval = setInterval("setTime()",1000);
}
function setDisable()
{
if (SetTFlag == 1)
{
getObj("Frm_Username").disabled = false;
getObj("Frm_Password").disabled = false;
getObj("LoginId").disabled = false;

getObj("time").style.display = "none";
getObj("myLayer").style.visibility = "hidden";
}
}
function dosubmit()
{
if (getObj("Frm_Username").value == "")
{
getObj("errmsg").innerHTML = "Username cannot be empty.";
getObj("myLayer").style.visibility = "visible" ;
return;
}
else
{
getObj("LoginId").disabled = true;
getObj("Frm_Logintoken").value = "16";
document.fLogin.submit();
}
}
</script>

从浏览器开发人员工具网络点击请求标头

POST / HTTP/1.1
Host: 192.168.1.1
Connection: keep-alive
Content-Length: 77
Cache-Control: max-age=0
Origin: http://192.168.1.1
Upgrade-Insecure-Requests: 1
DNT: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Referer: http://192.168.1.1/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,ar;q=0.8

来自浏览器开发者工具网络水龙头的回应

HTTP/1.1 302 Moved Temporarily
Server: Mini web server 1.0 ZTE corp 2005.
Content-Type: text/html; charset=iso-8859-1
Accept-Ranges: bytes
Connection: close
Cache-Control: no-cache,no-store
Content-Length: 0
Location: /start.ghtml
google-chrome networking router
  • 1 1 个回答
  • 529 Views

1 个回答

  • Voted
  1. Best Answer
    mina nageh
    2019-04-13T11:48:50+08:002019-04-13T11:48:50+08:00

    只需从命令中删除向上插入符号 ^

    像这样

       curl "http://192.168.1.1/" --data "frashnum=&action=login&Frm_Logintoken=9&Username=admin&Password=admin"
    

    并且不要忘记更新 Frm_Logintoken

    Frm_Logintiken 是由路由器生成的令牌,每次成功登录时它基本上加一!

    你从路由器页面的 html 或在结果的末尾得到这个命令

    curl "http://192.168.1.1/"
    
    • 0

相关问题

  • NAT 后面的 NAT 如何工作(路由器的 NAT 和 ISP 的 NAT)?

  • 浏览器不会在 Windows 7 64 位操作系统上获得压缩页面

  • Win10 1803:如何让移动热点成为专用网络?

  • nc如何识别服务名称

  • Jupyter 笔记本中的字体已更改

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    Windows 10 服务称为 AarSvc_70f961。它是什么,我该如何禁用它?

    • 2 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Marko Smith

    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1056)

    • 4 个回答
  • Marko Smith

    我如何知道 Windows 安装在哪个驱动器上?

    • 6 个回答
  • Martin Hope
    Albin 支持结束后如何激活 WindowsXP? 2019-11-18 03:50:17 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    Kagaratsch Windows 10 删除大量小文件的速度非常慢。有什么办法可以加快速度吗? 2019-09-23 06:05:43 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    Inter Sys Ctrl+C 和 Ctrl+V 是如何工作的? 2019-05-15 02:51:21 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve