如何在路由器页面中使用curl选中复选框?

时间:2019-04-12 17:16:57

标签: javascript php html curl events

我正在尝试在路由器页面中选中启用ssid 2的复选框,然后

使用curl提交它以做一些睾丸。

curl选中框的命令

curl "http://192.168.1.1/getpage.gch?pid=1002^&nextpage=net_wlan_essid_t.gch" -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 "Referer: http://192.168.1.1/getpage.gch?pid=1002^&nextpage=net_wlan_essid_t.gch^&IF_VIEWID=IGD.LD1.WLAN2" --data "IF_ERRORSTR=SUCC^&IF_ERRORPARAM=SUCC^&IF_ERRORTYPE=-1^&IF_CONFIGTAG=Y^&IF_ACTION=apply^&WLAN_INSTNUM=4^&WLAN_SSID0=IGD.LD1.WLAN1^&WLAN_SSID1=IGD.LD1.WLAN2^&WLAN_SSID2=IGD.LD1.WLAN3^&WLAN_SSID3=IGD.LD1.WLAN4^&IF_SSIDATTR1=0^&IF_SSIDATTR2=0^&IF_SSIDATTR3=0^&IF_SSIDATTR4=0^&IF_VIEWID=IGD.LD1.WLAN2^&SettingStatus=CurruntSetting^&CardIsIn=1^&MaxInterface=4^&DeviceMode=InfrastructureAccessPoint^&CardMode=b^%^2Cg^%^2Cn^%^2Cbg^%^2Cgn^%^2Cbgn^&CardRev=0^&Class=255^&PID=33169^&VID=4332^&ValidIf=1^&Enable=1^&RadioStatus=NULL^&Standard=NULL^&BeaconInterval=NULL^&RtsCts=NULL^&Fragment=NULL^&DTIM=NULL^&TxPower=NULL^&CountryCode=NULL^&TxRate=NULL^&Channel=NULL^&ESSID=12345^&ESSIDPrefix=NULL^&ACLPolicy=NULL^&BeaconType=NULL^&WEPAuthMode=NULL^&WEPEncryptionLevel=NULL^&WEPKeyIndex=NULL^&WPAAuthMode=NULL^&WPAEncryptType=NULL^&WPAGroupRekey=NULL^&WPAEAPServerIp=NULL^&RadiusPort=NULL^&RadiusServerPort=NULL^&WPAEAPSecret=NULL^&PossibleChannels=NULL^&BasicDataRates=NULL^&OpDataRates=NULL^&PossibleTxRates=NULL^&OOBAccessEnabled=NULL^&BeaconEnabled=NULL^&ESSIDHideEnable=1^&RegulatoryDomain=NULL^&WlanMode=NULL^&DistanceFromRoot=NULL^&PeerBSSID=NULL^&AuthServiceMode=NULL^&QosType=NULL^&Priority=1^&UAPSDEnabled=NULL^&AutoChannelEnabled=NULL^&ChannelsInUse=NULL^&11iAuthMode=NULL^&11iEncryptType=NULL^&MaxUserNum=32^&SSIDIsolationEnable=NULL^&VapIsolationEnable=0^&Band=2.4G^&11nMode=1^&BandWidth=20Mhz^&SideBand=Lower^&11nRate=Auto^&SGIEnabled=0^&GreenField=0^&WdsMode=WDS_Disable^&Tx2Path=1^&IsPublicWiFiInterface=NULL^&MasterAuthServerIp=0.0.0.0^&MasterAuthServerPort=0^&MasterAuthServerSecret=^&Name=wlan0^&RealRF=1^&ChannelInUsed=8^&TxRateInUsed=Auto^&Bssid=54^%^3Abe^%^3A53^%^3A6a^%^3Af6^%^3Ac0^&IfStatus=Up^&UAPSDSupported=1^&WMMSupported=1^&TotalAssociations=4^&TotalBytesSent=2246220234^&TotalBytesReceived=3268409714^&TotalPacketsSent=22743088^&TotalPacketsReceived=14280169^&ErrorsSent=3057^&ErrorsReceived=0^&NonUnicastPacketsReceived=0^&UnicastPacketsSent=97163073747419137^&UnicastPacketsReceived=61100857587924993^&DiscardPacketsSent=8137^&DiscardPacketsReceived=68^&TotalPSKFailures=66^&TotalIntegrityFailures=6^&NumEasyPair=0^&ConnectStatus=Disconnected^&SingalQuality=0^&SingalStrength=0^&_SESSION_TOKEN=2714922195119803" --compressed

未选中复选框的curl命令

curl "http://192.168.1.1/getpage.gch?pid=1002^&nextpage=net_wlan_essid_t.gch" -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/getpage.gch?pid=1002^&nextpage=net_wlan_essid_t.gch^&IF_VIEWID=IGD.LD1.WLAN2" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.9,ar;q=0.8" --data "IF_ERRORSTR=SUCC^&IF_ERRORPARAM=SUCC^&IF_ERRORTYPE=-1^&IF_CONFIGTAG=Y^&IF_ACTION=apply^&WLAN_INSTNUM=4^&WLAN_SSID0=IGD.LD1.WLAN1^&WLAN_SSID1=IGD.LD1.WLAN2^&WLAN_SSID2=IGD.LD1.WLAN3^&WLAN_SSID3=IGD.LD1.WLAN4^&IF_SSIDATTR1=0^&IF_SSIDATTR2=0^&IF_SSIDATTR3=0^&IF_SSIDATTR4=0^&IF_VIEWID=IGD.LD1.WLAN2^&SettingStatus=CurruntSetting^&CardIsIn=1^&MaxInterface=4^&DeviceMode=InfrastructureAccessPoint^&CardMode=b^%^2Cg^%^2Cn^%^2Cbg^%^2Cgn^%^2Cbgn^&CardRev=0^&Class=255^&PID=33169^&VID=4332^&ValidIf=1^&Enable=0^&RadioStatus=NULL^&Standard=NULL^&BeaconInterval=NULL^&RtsCts=NULL^&Fragment=NULL^&DTIM=NULL^&TxPower=NULL^&CountryCode=NULL^&TxRate=NULL^&Channel=NULL^&ESSID=NULL^&ESSIDPrefix=NULL^&ACLPolicy=NULL^&BeaconType=NULL^&WEPAuthMode=NULL^&WEPEncryptionLevel=NULL^&WEPKeyIndex=NULL^&WPAAuthMode=NULL^&WPAEncryptType=NULL^&WPAGroupRekey=NULL^&WPAEAPServerIp=NULL^&RadiusPort=NULL^&RadiusServerPort=NULL^&WPAEAPSecret=NULL^&PossibleChannels=NULL^&BasicDataRates=NULL^&OpDataRates=NULL^&PossibleTxRates=NULL^&OOBAccessEnabled=NULL^&BeaconEnabled=NULL^&ESSIDHideEnable=NULL^&RegulatoryDomain=NULL^&WlanMode=NULL^&DistanceFromRoot=NULL^&PeerBSSID=NULL^&AuthServiceMode=NULL^&QosType=NULL^&Priority=1^&UAPSDEnabled=NULL^&AutoChannelEnabled=NULL^&ChannelsInUse=NULL^&11iAuthMode=NULL^&11iEncryptType=NULL^&MaxUserNum=NULL^&SSIDIsolationEnable=NULL^&VapIsolationEnable=NULL^&Band=2.4G^&11nMode=1^&BandWidth=20Mhz^&SideBand=Lower^&11nRate=Auto^&SGIEnabled=0^&GreenField=0^&WdsMode=WDS_Disable^&Tx2Path=1^&IsPublicWiFiInterface=NULL^&MasterAuthServerIp=0.0.0.0^&MasterAuthServerPort=0^&MasterAuthServerSecret=^&Name=wlan0^&RealRF=1^&ChannelInUsed=1^&TxRateInUsed=Auto^&Bssid=54^%^3Abe^%^3A53^%^3A6a^%^3Af6^%^3Ac0^&IfStatus=Up^&UAPSDSupported=1^&WMMSupported=1^&TotalAssociations=3^&TotalBytesSent=140746452^&TotalBytesReceived=23331851^&TotalPacketsSent=143174^&TotalPacketsReceived=88465^&ErrorsSent=2^&ErrorsReceived=0^&NonUnicastPacketsReceived=0^&UnicastPacketsSent=609133736755201^&UnicastPacketsReceived=374834680823809^&DiscardPacketsSent=14^&DiscardPacketsReceived=1^&TotalPSKFailures=0^&TotalIntegrityFailures=0^&NumEasyPair=0^&ConnectStatus=Disconnected^&SingalQuality=0^&SingalStrength=0^&_SESSION_TOKEN=3656933071036814" --compressed

未检查与已检查 enter image description here

路由器页面中ssid的Java脚本

> <script language="javascript">var CONFIG_PARA = new Array("Enable","RadioStatus","Standard","BeaconInterval","RtsCts","Fragment","DTIM","TxPower","CountryCode","TxRate","Channel","ESSID","ESSIDPrefix","ACLPolicy","BeaconType","WEPAuthMode","WEPEncryptionLevel","WEPKeyIndex","WPAAuthMode","WPAEncryptType","WPAGroupRekey","WPAEAPServerIp","RadiusPort","RadiusServerPort","WPAEAPSecret","PossibleChannels","BasicDataRates","OpDataRates","PossibleTxRates","OOBAccessEnabled","BeaconEnabled","ESSIDHideEnable","RegulatoryDomain","WlanMode","DistanceFromRoot","PeerBSSID","AuthServiceMode","QosType","Priority","UAPSDEnabled","AutoChannelEnabled","ChannelsInUse","11iAuthMode","11iEncryptType","MaxUserNum","SSIDIsolationEnable","VapIsolationEnable","IsPublicWiFiInterface");function getmsg(id){var str = new Array();str[0] = new Array(101, " cannot be empty, please input again.");str[1] = new Array(102, "'s length is error, please make the length of characters within ");str[2] = new Array(103, ".");str[3] = new Array(113, " is error, please input legal SSID Name.");str[4] = new Array(118, "Current operation is ineffective, please check whether ");str[5] = new Array(119, " is legal.");str[6] = new Array(122, "Current operation is ineffective, please check configuration parameters.");str[7] = new Array(115, " is error, please input legal integer.");str[8] = new Array(116, " is error, please input integer in the range of ");str[9] = new Array(117, ".");return getMsgFormArray(str, arguments);}function Wireless_switch(){if(getValue("RealRF") == "1"){jslDiDisplay("t_warn");jslEnable("Frm_SSID_SET","Frm_ESSIDHideEnable","Frm_Enable","Frm_ESSID","Frm_Priority","Btn_Submit","Btn_Cancel","Frm_VapIsolationEnable","Frm_MaxUserNum");ESSID_Enable();}else {jslEnDisplay("t_warn");jslDisable("Frm_SSID_SET","Frm_ESSIDHideEnable","Frm_Enable","Frm_ESSID","Frm_Priority","Btn_Submit","Btn_Cancel","Frm_VapIsolationEnable","Frm_MaxUserNum");}}function SubParaGetValue(){if(getValue("ESSIDHideEnable") == "1"){setChecked("Frm_ESSIDHideEnable", true);}else {setChecked("Frm_ESSIDHideEnable", false);}if(getValue("VapIsolationEnable") == "1"){setChecked("Frm_VapIsolationEnable", true);}else {setChecked("Frm_VapIsolationEnable", false);}jslSetValue("Frm_MaxUserNum","MaxUserNum");jslSetValue("Frm_ESSID","ESSID");if(getValue("Priority") == ""){setValue("Frm_Priority","0");}else {jslSetValue("Frm_Priority","Priority");}}function ESSID_Enable(){if(getChecked("Frm_Enable")==false){SubParaGetValue();jslDisable("Frm_ESSIDHideEnable","Frm_ESSID","Frm_Priority","Frm_VapIsolationEnable","Frm_MaxUserNum");}else {jslEnable("Frm_ESSIDHideEnable","Frm_ESSID","Frm_Priority","Frm_VapIsolationEnable","Frm_MaxUserNum");PageAttrInfo();}}function checkNum(frm_id, fnt_id, isNull, minValue, maxValue){var msg = "";if( 0 == isNull && false == checkNull(getValue(frm_id)) ){return true;}var numCheck = checkIntegerRange(getValue(frm_id), minValue, maxValue);if("-1"== numCheck){msg = getmsg(101);ShowErrorForCom(frm_id, fnt_id, msg);return false;}if("-2"== numCheck){msg = getmsg(115);ShowErrorForCom(frm_id, fnt_id, msg);return false;}else if("-3"== numCheck){msg = getmsg(116, minValue, maxValue);ShowErrorForCom(frm_id, fnt_id, msg);return false;}else {}return true;}function ESSIDCheck(){var check;if(getChecked("Frm_Enable")==false){return true;}check = checkEssid(getValue("Frm_ESSID"));if (check == -1){msg = getmsg(101);ShowErrorForCom("Frm_ESSID","Fnt_ESSID",msg);return false;}if (check == -3){msg = getmsg(102,1,32);ShowErrorForCom("Frm_ESSID","Fnt_ESSID",msg);return false;}if (check == false){msg = getmsg(113);ShowErrorForCom("Frm_ESSID","Fnt_ESSID",msg);return false;}if(false == checkNum("Frm_MaxUserNum", "Fnt_MaxUserNum", 1, 1, 32)){return false;}return true;}function AllCheck(){if (ESSIDCheck() == false){return false;}return true;}function ESSID_Choose(){var url = getURL("net_wlan_essid_t.gch", "IF_VIEWID", getValue("Frm_SSID_SET"));DisableALL();location.href = url;}function pageLoad(url){moveErrLayer(580,95);getObj("fSubmit").action = url;var errstr= getValue("IF_ERRORSTR");var errpara = getValue("IF_ERRORPARAM");ProcessRet(errstr, errpara);pageGetValue();}function hideSSIDParm(){var tmp = getValue("IsPublicWiFiInterface");if("1"== tmp){jslDiDisplay("TR_HideSSID", "ssidenable", "TR_IsolateSSID");}else {jslEnDisplay("TR_HideSSID", "ssidenable", "TR_IsolateSSID");}}function PageAttrInfo(){var essidname=getValue("Frm_SSID_SET");var i = essidname.charAt(12);var attr = getValue("IF_SSIDATTR"+i);if(attr == "3"){jslDisable("Frm_ESSID");}else {jslEnable("Frm_ESSID");}}function pageGetValue(){jslSetValue("Frm_SSID_SET","IF_VIEWID");if(getValue("Enable") == "1"){setChecked("Frm_Enable", true);}else {setChecked("Frm_Enable", false);}SubParaGetValue();hideSSIDParm();Wireless_switch();}function pageSetValue(){HiddenParaInit(CONFIG_PARA);if(getChecked("Frm_Enable") == true){setValue("Enable", "1");jslSetValue("ESSID","Frm_ESSID");if(getChecked("Frm_ESSIDHideEnable") == true){setValue("ESSIDHideEnable", "1");}else {setValue("ESSIDHideEnable", "0");}if(getChecked("Frm_VapIsolationEnable") == true){setValue("VapIsolationEnable", "1");}else {setValue("VapIsolationEnable", "0");}jslSetValue("MaxUserNum","Frm_MaxUserNum");}else {setValue("Enable", "0");}jslSetValue("Priority","Frm_Priority");}function pageSubmit(){ReSetValueRmZero("Frm_MaxUserNum");if(AllCheck() == true){jslDisable("Btn_Submit","Btn_Cancel");pageSetValue();setValue("IF_ACTION", "apply");setValue("IF_CONFIGTAG", "Y");setValue("IF_VIEWID", getValue("Frm_SSID_SET"));DisableALL();getObj("fSubmit").submit();}}function pageCancel(){jslDisable("Btn_Submit","Btn_Cancel");DisableALL();getObj("fSubmit").submit();}</script>

ssid复选框html代码

 <option value="IGD.LD1.WLAN2" id="Frm_SSID_SET1">SSID2</option> <tr
 id="ssidenable"> <td class="td1">Enable SSID</td> <td
 class="td2"><input name="" type="checkbox" value="" checked="checked"
 id="Frm_Enable" onclick="ESSID_Enable()"></td> </tr>

提交按钮代码

<input name="Submit" type="button" id="Btn_Submit" onclick="pageSubmit()" class="button" value=" Submit

事件监听器

enter image description here

命令的输出

*   Trying 192.168.1.1...
* TCP_NODELAY set
* Connected to 192.168.1.1 (192.168.1.1) port 80 (#0)
> POST /getpage.gch?pid=1002^&nextpage=net_wlan_essid_t.gch HTTP/1.1
> Host: 192.168.1.1
> Accept: */*
> 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
> Referer: http://192.168.1.1/getpage.gch?pid=1002^&nextpage=net_wlan_essid_t.gch^&IF_VIEWID=IGD.LD1.WLAN2
> Content-Length: 2229
> Expect: 100-continue
>
* Done waiting for 100-continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< 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: 770
<

<html>
<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>
<script>
function logout_redirect()
{
alert("Session\x20timeout\x2c\x20please\x20login\x20again\x2e");
document.getElementById("flogout").submit();
}
</script>
</head>
<body>
<form name="flogout" id="flogout" method="post" onsubmit="return false;" action="/" target="_top">
<input type="hidden" name="logout" id="logout" value="1">
<input type="hidden" name="logout_from" id="logout_from" value="login_timeout">
</form>
<script>
logout_redirect();
</script>
</body>
</html>* Closing connection 0

我不知道为什么我的会话过期了,尽管它是新令牌

编辑:我从当前页面进行了会话

我的会话没有过期,但仍然无法选中该框!

输出.html

https://ufile.io/f3qgc

部分回复

function doAddLogic()
{
var session_token = "0292389717453905";
var forms = document.getElementsByTagName("form");
for ( var i=0; i<forms.length; i++ )
{
var tempform = forms[i];
var sEnctype = tempform.getAttribute("enctype");
if ( sEnctype != null &&
"multipart/form-data" == sEnctype.toLowerCase() )
{
continue;
}
var tokenInput = document.createElement("input");
tokenInput.setAttribute("id", "_SESSION_TOKEN");
tokenInput.setAttribute("name", "_SESSION_TOKEN");
tokenInput.setAttribute("type", "hidden");
tokenInput.setAttribute("value", session_token);
tempform.appendChild(tokenInput);
}
}
if( window.onload == null )
{
window.onload=function(){
doAddLogic();
}
}
else
{
var tempfunction = window.onload;
window.onload=function(){
tempfunction();
doAddLogic();
}
}
}
addToken2AllForms();
</script>
</body>
</html>* Closing connection 0

我不知道为什么令牌不断变化!

每一个答复表示赞赏

1 个答案:

答案 0 :(得分:-1)

我从命令中删除了每个^,并且可以正常使用

注意:不要忘记更新SESSION_TOKEN