亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: cURL實(shí)現(xiàn)表單提交登陸計(jì)費(fèi)系統(tǒng)[已解決] [打印本頁]

作者: sdglg    時(shí)間: 2006-11-27 13:42
標(biāo)題: cURL實(shí)現(xiàn)表單提交登陸計(jì)費(fèi)系統(tǒng)[已解決]
由于本人玩的linux要上網(wǎng),必須登陸計(jì)費(fèi)系統(tǒng)網(wǎng)頁,提交用戶密碼和IP。即:模擬瀏覽器登陸計(jì)費(fèi)系統(tǒng)
登陸計(jì)費(fèi)系統(tǒng)過程:
計(jì)費(fèi)系統(tǒng)首頁提供一個(gè)表單:
用戶:
密碼:
IP:
連接網(wǎng)絡(luò) 斷開網(wǎng)絡(luò) 帳號(hào)管理

表單部分內(nèi)容:
<FORM method=post action="login.jsp" name=form1 target="_blank">
.....
.....
<TD align=right class=font width=57>用戶名:</TD>
          <TD align=left width=165><INPUT type="text" name="user" onmouseover=this.focus() maxLength="24"></TD>
        </TR>
        <TR vAlign=center align=left>
          <TD align=right class=font width=57>密&nbsp;&nbsp;碼:</TD>
          <TD width=165><INPUT type="password" name="pass" onmouseover=this.focus() maxLength="24"></TD>
         </TR>
        <TR vAlign=center align=left>
          <TD align=right class=font width=57>注冊(cè)IP:</TD>
          <td width="248" valign="right">
            <input type="text" name="ip" value=192.168.1.1 size="20" maxlength="16">
...
<INPUT TYPE="hidden" NAME="type" VALUE = "2" CHECKED>
            <INPUT TYPE="hidden" NAME="type" VALUE = "1" >
......
..
<INPUT style="FONT-SIZE: 12px; BACKGROUND-COLOR: rgb(139,217,132)" type=submit value="連接網(wǎng)絡(luò)" name="action" >
        <INPUT style="FONT-SIZE: 12px; BACKGROUND-COLOR: rgb(139,217,132)" type=submit value="中斷連網(wǎng)" name="action">
        <INPUT style="FONT-SIZE: 12px; BACKGROUND-COLOR: rgb(139,217,132)" type=submit value="賬號(hào)管理" name="action">


第一步必須登陸計(jì)費(fèi)系統(tǒng):
  1. curl -d"user=test&pass=111111&ip=192.168.1.1&type=2&type=1&action=%C1%AC%BD%D3%CD%F8%C2%E7" 192.168.252.4/login.jsp
復(fù)制代碼

第二步提交一個(gè)網(wǎng)絡(luò)連接的action
  1. curl "192.168.252.4/user/network/connect_action.jsp?ip=192.168.1.1&type=2"
復(fù)制代碼

運(yùn)行第一步操作后,然后運(yùn)行第二部操作,發(fā)現(xiàn)出現(xiàn)“請(qǐng)重新登陸的提示,也就是第一步登陸的session cookie沒有保存,導(dǎo)致第二步操作出現(xiàn)問題。

請(qǐng)問版主,如何保存一步的session會(huì)話狀態(tài),然后第二步操作能夠在第一步session的狀態(tài)下執(zhí)行網(wǎng)絡(luò)連接

curl -v http://192.168.252.4 //linux下curl -v查看計(jì)費(fèi)系統(tǒng)顯示如下信息:

Accept: */*
Referer: http://192.168.252.4/
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Host: 192.168.252.4
Content-Length: 87
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=af7DHRWsfwse; CNGASSESSION=ADS2FYAAGKK6A9B2RUJC//會(huì)話session
......

[ 本帖最后由 sdglg 于 2006-11-27 14:56 編輯 ]
作者: HonestQiao    時(shí)間: 2006-11-27 13:56
http://www.91fd.com/blog/?newid=1151716837
作者: sdglg    時(shí)間: 2006-11-27 14:54
非常感謝HonestQiao
向老法王,致敬。。
linux下命令行用cURL終于可以實(shí)現(xiàn)表單提交登陸計(jì)費(fèi)系統(tǒng)和連接網(wǎng)絡(luò),解決了session cookie保存問題。
問題看一樓帖子,現(xiàn)在發(fā)現(xiàn)非常的簡(jiǎn)單,呵呵。

修改代碼如下:
這一步實(shí)現(xiàn)登陸計(jì)費(fèi)系統(tǒng),把產(chǎn)生的cookie保存在fee.cookie文件里
  1. curl -d "user=test&pass=111111&ip=192.168.1.1&type=2&type=1&action=%C1%AC%BD%D3%CD%F8%C2%E7" --cookie-jar fee.cookie 192.168.252.4/login.jsp
復(fù)制代碼


這一步實(shí)現(xiàn)連接網(wǎng)絡(luò),讀取上一步產(chǎn)生的session cookie即fee.cookie文件。共享上一步操作的session cookie值
  1. curl --cookie fee.cookie --referer -d "http://192.168.252.4/user/network/connect_action.jsp?ip=192.168.1.1&type=2"
復(fù)制代碼


聯(lián)網(wǎng)成功后顯示的部分網(wǎng)頁代碼:
.....
<td align="center" valign="middle" height="26" colSpan="2" class=font1><b>連接結(jié)果</b></td>
    </tr>
    <tr>
      <td>
        <br />
        <br />
        聯(lián)網(wǎng)成功!<br>在不使用網(wǎng)絡(luò)時(shí),請(qǐng)及時(shí)斷開網(wǎng)絡(luò)
........

可以上網(wǎng)了。呵呵,dns查詢可以返回結(jié)果了

  1. [root@dns2 tmp]# nslookup www.chinaunix.net
  2. Server:         10.1.10.197
  3. Address:        10.1.10.197#53

  4. Non-authoritative answer:
  5. Name:   www.chinaunix.net
  6. Address: 159.226.63.26
復(fù)制代碼

作者: dataclose1    時(shí)間: 2006-11-27 15:19
我也研究過這類問題, 隨便也拿來 共享一下!!~:em11:

  1. curl -D "/client/GK.txt" -d "spcode=608511&sppassword=sohu332416" "lu.blog.com:80/sp/login.do"

  2. -D   將JSESSIONID 等值放入 GK.txt 文件中

  3. curl -b "JSESSIONID=EC0AE12D30BA57B10AB68E558067B765;" -d "tonetype=0.5" "http://lu.blog.com/sp/UploadServlet?tonetype=0.5"

  4. -b 帶入JSESSIONID
  5. -d 以POST方式提交

  6. curl -b "JSESSIONID=AAB5E9FBA659044518C09A18B2310271;" -F file1/childring_file/7/1/愛神厄洛斯的漫游.asf"  "lu.blog.com/sp/UploadServlet"

  7. -F 上傳文件
復(fù)制代碼

作者: david410    時(shí)間: 2007-02-16 22:46
太強(qiáng)了,這樣也行啊 。真是服了。。!
作者: fl_mapleleaf    時(shí)間: 2011-11-23 12:54
如果要查看的網(wǎng)頁使用了框架怎么辦,

<frameset rows=102,* cols=* framespacing=0 frameborder=0 border=0>
<frame name=banner scrolling=no noresize target=contents src=title.htm marginwidth=0 marginheight=0>
<frameset rows=* cols=180,*>
<frame name=contents target=main src=menu_admin.htm marginwidth=0 marginheight=0 scrolling=auto>
<frame name=main_screen src=system.htm target=_self scrolling=auto marginwidth=0 marginheight=0 noresize>
</frameset>
<noframes>
<body>
<p>此網(wǎng)頁使用了框架,但您的瀏覽器不支持框架。</p>
</body>
</noframes>
</frameset>
作者: meiyuhan    時(shí)間: 2013-02-03 01:26
就是喜歡你的帖子 沒辦法




歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2