Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ChinaUnicom 模拟登陆

laike9m
December 31, 2013

ChinaUnicom 模拟登陆

laike9m

December 31, 2013
Tweet

More Decks by laike9m

Other Decks in Programming

Transcript

  1. 任务:通过程序完成ChinaUnicom模拟登陆 - by laike9m 1. 通过IE9进行探查,确定各参数含义 (1) 准备工作 操作:先进入登陆页面,F12打开开发工具,工具->清空当前域的缓存/cookie,工具->导航时不要清除任 何东西,输入用户名密码,开始捕获,点击登录按钮,登陆完成,停止捕获

    实际上第一个GET请求就是我们所需要的东西: 详细内容如下: Request Header 键 值 请求 GET /login.do? callback=jQuery17100013734368553252607_1378108363139 &username=13051687401&password=123456 &passwordType=6&wlanuserip=&userOpenAddress=bj& checkbox=1&basname=&setUserOnline=& sap=&macAddr=&bandMacAuth=0&isMacAuth=& basPushUrl=http%253A%252F%252F202.106.46.37%252F &passwordkey=&_=1378108463014 HTTP/1.1 X-Requested- With XMLHttpRequest Accept text/javascript, application/javascript, application/ecmascript, application/x- ecmascript, */*; q=0.01 Referer http://202.106.46.37/index.do Accept- Language zh-CN Accept- Encoding gzip, deflate User-Agent Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0) Host 202.106.46.37 DNT 1 Connection Keep-Alive Cookie JSESSIONID=48274E1BD81CA48374ED7D8C1E5AEEA9 Request Body:由于是GET所以为空 Response Header 键 值 响应 HTTP/1.1 200 OK Server Apache-Coyote/1.1 Set-Cookie 13051687401=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT
  2. Set-Cookie user_name=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT Set-Cookie OpenAdress=""; Expires=Thu, 01-Jan-1970

    00:00:10 GMT Set-Cookie checkbox=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT Content-Type text/html;charset=UTF-8 Transfer-Encoding chunked Date Mon, 02 Sep 2013 07:54:23 GMT Response Body j Q u e r y 1 7 1 0 0 0 1 3 7 3 4 3 6 8 5 5 3 2 5 2 6 0 7 _ 1 3 7 8 1 0 8 3 6 3 1 3 9 ( { ' r e s u l t ' : { " b a s N a m e " : " " , " s e s s i o n I d " : " " , " u s e r i n f o I d " : " " , " u s e r o n l i n e I d " : " 0 4 c d d d 2 5 4 0 c f 0 f e a 0 1 4 0 d d a a 5 b 8 5 1 f a f " , " k e e p A l i v e T i m e " : " 3 0 0 0 0 0 " , " u s e r N a m e " : " 1 3 0 5 1 6 8 7 4 0 1 " , " u s e r N a m e D o m a i n " : " 1 3 0 5 1 6 8 7 4 0 1 @ w l a n . b j . c h i n a u n i c o m . c n " , " i s L o g i n " : " t r u e " , " m e s s a g e " : " s u c c e s s " , " r o a m i n g M e s s a g e " : " " , " s e t U s e r O n l i n e " : " 0 " , " u s e r O p e n A d r e s s " : " 1 1 " , " t i m e l o n g " : " " , " o p e n A d r e s s " : " " , " s a p " : " " , " w l a n u s e r i p " : " " , " c l i e n t A u t h T y p e " : " " , " m a c A d d r " : " " , " l o g o u t C o o r d i n a t e " : " " , " d i r e c t o r y " : " " , " f s t y p e " : " " , " c l i e n t T y p e " : " 2 " , " i s M a c A u t h " : " " , " b a s P u s h U r l " : " h t t p : / / 2 0 2 . 1 0 6 . 4 6 . 3 7 / " , " p z P a g e " : " " , " p z P r e f i x " : " " , " p z D o m a i n " : " " , " s t a r t T i m e " : " 1 5 : 5 4 : 2 3 " , " l e f t P a t h " : " " , " v l a n i d " : " " , " o k U r l " : " h t t p : / / 2 0 2 . 1 0 6 . 3 3 . 1 5 8 / w l a n " , " f o r m " : " " , " c a r r i e r " : " " , " h o m e C o u n t r y " : " " , " h o m e C a r r i e r " : " " , " p r e f i x " : " " , " s u f f i x " : " " , " l o g i n T i m e " : " 2 0 1 3 - 0 9 - 0 2 0 3 : 5 4 : 2 3 " , " c a r r i e r N a m e " : " " , " a c c o u n t T y p e " : " " , " a c c o u n t " : " 1 3 0 5 1 6 8 7 4 0 1 " } } ) Cookie 方向 键 值 过期时间 域 路 径 安 全 仅 HTTP 已发 送 JSESSIONID 48274E1BD81CA48374ED7D8C1E5AEEA9 已接 收 13051687401 "" Thu, 01-Jan-1970 00:00:10 GMT 否 否 已接 收 user_name "" Thu, 01-Jan-1970 00:00:10 GMT 否 否 已接 收 OpenAdress "" Thu, 01-Jan-1970 00:00:10 GMT 否 否 已接 收 checkbox "" Thu, 01-Jan-1970 00:00:10 GMT 否 否 (2) 分析各参数含义 jquery后面跟的那串数字可能无法模拟,暂时考虑就用原来的 主要是cookie JSESSIONID=48274E1BD81CA48374ED7D8C1E5AEEA9要搞清楚来历 结论是cookie在不手动清除的情况下是不会改变的,当前cookie: JSESSIONID=4003A8C5A8DE955BABAC66B0A6405C02 以后用这个应该就可以 为了保险起见可以把这几个cookie也写上 方向 键 值 已发送 13051687401 123456 已发送 user_name 13051687401 已发送 OpenAdress bj 已发送 checkbox true