httpclient登錄新浪微博(非SDK方式)
苦逼的折騰了快一星期,總算把新浪微博rsa加密登錄折騰ok了,這里需要注意的是httpclient最好用4.0的,否則cookie管理很是問題。
進入正題,最近新浪微博更新了sso登錄方式,加密算法變成了rsa,獲取nonce和servertime,pubkey,這里涉及到rsa加密,通常用java進行rsa加密一般都是從文件讀取公鑰信息或者是base64編碼的公鑰信息轉換成key,然后進行加密,但是新浪給的不是base64加密,而是給的一個N(參見RSA加密算法,RSA加密算法)
,而我先入為主,把新浪給的pubkey當作base64編碼的公鑰信息,苦逼的折騰了快一天。后來再細看看RSA加密算法感覺pubkey不像是base64編碼,看到網上有人分析新浪的sso.js,於是我也看一下,終於有收獲,看到他把pubkey解析成biginteger,感覺怪怪的,聯想到rsa的百科,發現應該是我搞錯了,遂找到以下方法。用pubkey進行加密。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
public
String
rsaCrypt
(
String
modeHex
,
String
exponentHex
,
String
messageg
)
throws
IllegalBlockSizeException
,
BadPaddingException
,
NoSuchAlgorithmException
,
InvalidKeySpecException
,
NoSuchPaddingException
,
InvalidKeyException
,
UnsupportedEncodingException
{
KeyFactory
factory
=
KeyFactory
.
getInstance
(
"RSA"
)
;
BigInteger
m
=
new
BigInteger
(
modeHex
,
16
)
;
/* public exponent */
BigInteger
e
=
new
BigInteger
(
exponentHex
,
16
)
;
/* modulus */
RSAPublicKeySpec
spec
=
new
RSAPublicKeySpec
(
m
,
e
)
;
RSAPublicKey
pub
=
(
RSAPublicKey
)
factory
.
generatePublic
(
spec
)
;
Cipher
enc
=
Cipher
.
getInstance
(
"RSA"
)
;
enc
.
init
(
Cipher
.
ENCRYPT_MODE
,
pub
)
;
byte
[
]
encryptedContentKey
=
enc
.
doFinal
(
messageg
.
getBytes
(
"GB2312"
)
)
;
return
new
String
(
Hex
.
encodeHex
(
encryptedContentKey
)
)
;
}
|
方法名氣得不是很理想,但是不影響我們學習。搞定加密了,接下來更苦逼的是http-client3這托,我看網上有人弄出來的代碼,參考着弄下,但是他們的驗證方法,參數都有問題,我參照有人用ruby寫的(sso 1.4.2版本的),將該替換的都替換了,一直進行到ajaxlogin這里,可以獲取到我的個人信息,但是苦逼的是,真正登錄的時候不行,我懷疑是cookie問題,因為一直警告我cookie reject,因為新浪sso登錄時候用了些技巧解決跨域。好,那我就山寨點,把cookie domain該了,改成.weibo.com最終獲取用戶主頁時retcode=6102,查了下sso.js代碼,發現是沒登錄成功 ,cookie問題。什么辦法讀想了,抓包,分析,firebug分析,google了無數遍,最后還是沒成功。無奈繼續google,苦心不負有心人,最終發現這篇,http-client4來做的,我隱約記得官方推薦用hc4,於是就搞了下,竟然可以獲得首頁一些信息,雖然不是html的,但應該是成功了,之前沒成功的話獲取個人主頁會得到登錄的html。下面是主要代碼。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
import
java
.
io
.
IOException
;
import
java
.
security
.
InvalidKeyException
;
import
java
.
security
.
NoSuchAlgorithmException
;
import
java
.
security
.
spec
.
InvalidKeySpecException
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
Date
;
import
java
.
util
.
List
;
import
javax
.
crypto
.
BadPaddingException
;
import
javax
.
crypto
.
IllegalBlockSizeException
;
import
javax
.
crypto
.
NoSuchPaddingException
;
import
org
.
apache
.
commons
.
codec
.
binary
.
Base64
;
import
org
.
apache
.
commons
.
logging
.
Log
;
import
org
.
apache
.
commons
.
logging
.
LogFactory
;
import
org
.
apache
.
http
.
NameValuePair
;
import
org
.
apache
.
http
.
HttpException
;
import
org
.
apache
.
http
.
HttpResponse
;
import
org
.
apache
.
http
.
ParseException
;
import
org
.
apache
.
http
.
client
.
HttpClient
;
import
org
.
apache
.
http
.
client
.
entity
.
UrlEncodedFormEntity
;
import
org
.
apache
.
http
.
client
.
methods
.
HttpGet
;
import
org
.
apache
.
http
.
client
.
methods
.
HttpPost
;
import
org
.
apache
.
http
.
client
.
params
.
CookiePolicy
;
import
org
.
apache
.
http
.
impl
.
client
.
DefaultHttpClient
;
import
org
.
apache
.
http
.
message
.
BasicNameValuePair
;
import
org
.
apache
.
http
.
params
.
HttpConnectionParams
;
import
org
.
apache
.
http
.
protocol
.
HTTP
;
import
org
.
apache
.
http
.
util
.
EntityUtils
;
import
org
.
json
.
JSONException
;
import
org
.
json
.
JSONObject
;
public
class
Main
{
static
String
SINA_PK
=
"EB2A38568661887FA180BDDB5CABD5F21C7BFD59C090CB2D24"
+
"5A87AC253062882729293E5506350508E7F9AA3BB77F4333231490F915F6D63C55FE2F08A49B353F444AD39"
+
"93CACC02DB784ABBB8E42A9B1BBFFFB38BE18D78E87A0E41B9B8F73A928EE0CCEE"
+
"1F6739884B9777E4FE9E88A1BBE495927AC4A799B3181D6442443"
;
static
String
username
=
"用戶名"
;
static
String
passwd
=
"密碼"
;
private
static
final
Log
logger
=
LogFactory
.
getLog
(
Main
.
class
)
;
public
static
void
main
(
String
[
]
args
)
throws
HttpException
,
IOException
,
JSONException
,
InvalidKeyException
,
IllegalBlockSizeException
,
BadPaddingException
,
NoSuchAlgorithmException
,
InvalidKeySpecException
,
NoSuchPaddingException
{
DefaultHttpClient
client
=
new
DefaultHttpClient
(
)
;
client
.
getParams
(
)
.
setParameter
(
"http.protocol.cookie-policy"
,
CookiePolicy
.
BROWSER_COMPATIBILITY
)
;
client
.
getParams
(
)
.
setParameter
(
HttpConnectionParams
.
CONNECTION_TIMEOUT
,
5000
)
;
HttpPost
post
=
new
HttpPost
(
"http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.4.2)"
)
;
PreLoginInfo
info
=
getPreLoginBean
(
client
)
;
long
servertime
=
info
.
servertime
;
String
nonce
=
info
.
nonce
;
String
pwdString
=
servertime
+
"\t"
+
nonce
+
"\n"
+
"HMC123$%^"
;
String
sp
=
new
BigIntegerRSA
(
)
.
rsaCrypt
(
SINA_PK
,
"10001"
,
pwdString
)
;
List
<
NameValuePair
>
nvps
=
new
ArrayList
<
NameValuePair
>
(
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"entry"
,
"weibo"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"gateway"
,
"1"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"from"
,
""
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"savestate"
,
"7"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"useticket"
,
"1"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"ssosimplelogin"
,
"1"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"vsnf"
,
"1"
)
)
;
// new NameValuePair("vsnval", ""),
nvps
.
add
(
new
BasicNameValuePair
(
"su"
,
encodeUserName
(
username
)
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"service"
,
"miniblog"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"servertime"
,
servertime
+
""
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"nonce"
,
nonce
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"pwencode"
,
"rsa2"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"rsakv"
,
info
.
rsakv
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"sp"
,
sp
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"encoding"
,
"UTF-8"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"prelt"
,
"115"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"returntype"
,
"META"
)
)
;
nvps
.
add
(
new
BasicNameValuePair
(
"url"
,
"http://weibo.com/ajaxlogin.php?framelogin=1&callback=parent.sinaSSOController.feedBackUrlCallBack"
)
)
;
post
.
setEntity
(
new
UrlEncodedFormEntity
(
nvps
,
HTTP
.
UTF_8
)
)
;
HttpResponse
response
=
client
.
execute
(
post
)
;
String
entity
=
EntityUtils
.
toString
(
response
.
getEntity
(
)
)
;
String
url
=
entity
.
substring
(
entity
.
indexOf
(
"http://weibo.com/ajaxlogin.php?"
)
,
entity
.
indexOf
(
"code=0"
)
+
6
)
;
logger
.
debug
(
"url:"
+
url
)
;
// 獲取到實際url進行連接
HttpGet
getMethod
=
new
HttpGet
(
url
)
;
response
=
client
.
execute
(
getMethod
)
;
entity
=
EntityUtils
.
toString
(
response
.
getEntity
(
)
)
;
entity
=
entity
.
substring
(
entity
.
indexOf
(
"userdomain"
)
+
13
,
entity
.
lastIndexOf
(
"\"
"));
logger.debug(entity);
getMethod = new HttpGet("
http
:
//weibo.com/humingchun?wvr=5&lf=reg");
response
=
client
.
execute
(
getMethod
)
;
entity
=
EntityUtils
.
toString
(
response
.
getEntity
(
)
)
;
// Document doc =
// Jsoup.parse(EntityUtils.toString(response.getEntity()));
System
.
out
.
println
(
entity
)
;
logger
.
debug
(
entity
)
;
}
private
static
PreLoginInfo
getPreLoginBean
(
HttpClient
client
)
throws
HttpException
,
IOException
,
JSONException
{
String
serverTime
=
getPreLoginInfo
(
client
)
;
System
.
out
.
println
(
""
)
;
JSONObject
jsonInfo
=
new
JSONObject
(
serverTime
)
;
PreLoginInfo
info
=
new
PreLoginInfo
(
)
;
info
.
nonce
=
jsonInfo
.
getString
(
"nonce"
)
;
info
.
pcid
=
jsonInfo
.
getString
(
"pcid"
)
;
info
.
pubkey
=
jsonInfo
.
getString
(
"pubkey"
)
;
info
.
retcode
=
jsonInfo
.
getInt
(
"retcode"
)
;
info
.
rsakv
=
jsonInfo
.
getString
(
"rsakv"
)
;
info
.
servertime
=
jsonInfo
.
getLong
(
"servertime"
)
;
return
info
;
}
public
static
String
getPreLoginInfo
(
HttpClient
client
)
throws
ParseException
,
IOException
{
String
preloginurl
=
"http://login.sina.com.cn/sso/prelogin.php?entry=sso&"
+
"callback=sinaSSOController.preloginCallBack&su="
+
"dW5kZWZpbmVk"
+
"&rsakt=mod&client=ssologin.js(v1.4.2)"
+
"&_="
+
getCurrentTime
(
)
;
HttpGet
get
=
new
HttpGet
(
preloginurl
)
;
HttpResponse
response
=
client
.
execute
(
get
)
;
String
getResp
=
EntityUtils
.
toString
(
response
.
getEntity
(
)
)
;
int
firstLeftBracket
=
getResp
.
indexOf
(
"("
)
;
int
lastRightBracket
=
getResp
.
lastIndexOf
(
")"
)
;
String
jsonBody
=
getResp
.
substring
(
firstLeftBracket
+
1
,
lastRightBracket
)
;
System
.
out
.
println
(
jsonBody
)
;
return
jsonBody
;
}
private
static
String
getCurrentTime
(
)
{
long
servertime
=
new
Date
(
)
.
getTime
(
)
/
1000
;
return
String
.
valueOf
(
servertime
)
;
}
private
static
String
encodeUserName
(
String
email
)
{
email
=
email
.
replaceFirst
(
"@"
,
"%40"
)
;
// MzM3MjQwNTUyJTQwcXEuY29t
email
=
Base64
.
encodeBase64String
(
email
.
getBytes
(
)
)
;
return
email
;
}
}
|
測試過的代碼
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.params.CookiePolicy;
import org.apache.http.client.params.HttpClientParams;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.HttpParams;
/**
* 使用httpclient4登陸百度
* @author gohands
*
*/
public class BaiduLogin {
private static String URL_CHARACTER = "gb2312"; // 統一字符集
/**
* @param args
*/
public static void main(String[] args) throws Exception {
//初始化
DefaultHttpClient httpclient = new DefaultHttpClient();
// 這一行必須要加,否則服務器無法獲取登陸狀態
HttpClientParams.setCookiePolicy(httpclient.getParams(),CookiePolicy.BROWSER_COMPATIBILITY);
// 第一次訪問
String url = "http://www.baidu.com";
HttpGet httpget = new HttpGet(url);
HttpResponse response = httpclient.execute(httpget);
System.out.println("Length1::" + response.getEntity().getContentLength());
HttpEntity entity = response.getEntity();
BaiduLogin.printEntity(entity);
// 登陸【使用POST方式登錄】
// 如果要直接執行,麻煩去申請個百度的帳號
// 不好意思,給百度做廣告了
HttpPost httpost = new HttpPost("https://passport.baidu.com/v2/api/?login");
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("username", "dollar625"));
nvps.add(new BasicNameValuePair("password", "********"));
httpost.setEntity(new UrlEncodedFormEntity(nvps, BaiduLogin.URL_CHARACTER));
response = httpclient.execute(httpost);
// 第二次訪問
System.out.println("\n----------------------------------------");
System.out.println(response.getStatusLine());
List<Cookie> cookies = httpclient.getCookieStore().getCookies();
entity = response.getEntity();
BaiduLogin.printEntity(entity);
System.out.println("\n----------------------------------------");
cookies = httpclient.getCookieStore().getCookies();
System.out.println("cookies" + cookies.size());
httpget = new HttpGet(url);
// httpget.setr
// httpget.setHeader(name, value)
response = httpclient.execute(httpget);
System.out.println("Length2::"
+ response.getEntity().getContentLength());
entity = response.getEntity();
BaiduLogin.printEntity(entity);
}
/**
* 輸出entity內容,獲取和輸出返回的HTML文
* @param entity
* @throws IllegalStateException
* @throws IOException
*/
private static void printEntity(HttpEntity entity)
throws IllegalStateException, IOException {
if (entity == null) {
return;
}
System.out.println("HttpEntity start >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println("Response content length: " + entity.getContentLength());
InputStream is = entity.getContent();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
List<Byte> li = new ArrayList();
int i;
//之所以寫的如此復雜是因為了解決中文問題
while ((i = is.read()) != -1) {
li.add((byte) i);
}
byte a[] = new byte[li.size()];
for (i = 0; i < a.length; i++) {
a[i] = (byte) li.get(i);
}
System.out.println(new String(a, BaiduLogin.URL_CHARACTER)); // 打印HTML內容
entity.consumeContent(); // entity銷毀
System.out.println("HttpEntity END >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
}
}
得到的結果:
Length1::10299
HttpEntity start >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Response content length: 10299
<!DOCTYPE html><!--STATUS OK--> <html><head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>?懼害涓??錛??灝辯???/title> <style >html,body{height:100%}html{overflow-y:auto}#wrapper{position:relative;_position:;min-height:100%}#content{padding-bottom:100px;text-align:center}#ftCon{height:100px;position:absolute;bottom:44px;text-align:center;width:100%;margin:0 auto;z-index:0;overflow:hidden}#ftConw{width:720px;margin:0 auto}body{font:12px arial;text-align:;background:#fff}body,p,form,ul,li{margin:0;padding:0;list-style:none}body,form,#fm{position:relative}td{text-align:left}img{border:0}a{color:#00c}a:active{color:#f60}#u{color:#999;padding:4px 10px 5px 0;text-align:right}#u a{margin:0 5px}#u .reg{margin:0}#m{width:720px;margin:0 auto}#nv a,#nv b,.btn,#lk{font-size:14px}#fm{padding-left:110px;text-align:left;z-index:1}input{border:0;padding:0}#nv{height:19px;font-size:16px;margin:0 0 4px;text-align:left;text-indent:137px}.s_ipt_wr{width:418px;height:30px;display:inline-block;margin-right:5px;background:url(http://s1.bdstatic.com/r/www/img/i-1.0.0.png) no-repeat -304px 0;border:1px solid #b6b6b6;border-color:#9a9a9a #cdcdcd #cdcdcd #9a9a9a;vertical-align:top}.s_ipt{width:405px;height:22px;font:16px/22px arial;margin:5px 0 0 7px;background:#fff;outline:0;-webkit-appearance:none}.s_btn{width:95px;height:32px;padding-top:2px\9;font-size:14px;background:#ddd url(http://s1.bdstatic.com/r/www/img/i-1.0.0.png);cursor:pointer}.s_btn_h{background-position:-100px 0}.s_btn_wr{width:97px;height:34px;display:inline-block;background:url(http://s1.bdstatic.com/r/www/img/i-1.0.0.png) no-repeat -202px 0;*position:relative;z-index:0;vertical-align:top}#lg img{vertical-align:top;margin-bottom:3px}#lk{margin:33px 0}#lk span{font:14px "瀹??"}#lm{height:60px}#lh{margin:16px 0 5px;word-spacing:3px}.tools{position:absolute;top:-4px;*top:10px;right:7px}#mHolder{width:62px;position:relative;z-index:296;display:none}#mCon{height:18px;line-height:18px;position:absolute;cursor:pointer;padding:0 18px 0 0;background:url(http://s1.bdstatic.com/r/www/img/bg-1.0.0.gif) no-repeat right -134px;background-position:right -136px\9}#mCon span{color:#00c;cursor:default;display:block}#mCon .hw{text-decoration:underline;cursor:pointer}#mMenu a{width:100%;height:100%;display:block;line-height:22px;text-indent:6px;text-decoration:none;filter:none\9}#mMenu,#user ul{box-shadow:1px 1px 2px #ccc;-moz-box-shadow:1px 1px 2px #ccc;-webkit-box-shadow:1px 1px 2px #ccc;filter:progid:DXImageTransform.Microsoft.Shadow(Strength=2,Direction=135,Color="#cccccc")\9}#mMenu{width:56px;border:1px solid #9b9b9b;list-style:none;position:absolute;right:27px;top:28px;display:none;background:#fff}#mMenu a:hover{background:#ebebeb}#mMenu .ln{height:1px;background:#ebebeb;overflow:hidden;font-size:1px;line-height:1px;margin-top:-1px}#cp,#cp a{color:#666}#seth{display:none;behavior:url(#default#homepage)}#setf{display:none}#sekj{margin-left:14px}#shouji{margin-right:14px}</style> <script>function h(obj){obj.style.behavior='url(#default#homepage)';var a = obj.setHomePage('http://www.baidu.com/');}</script></head><body> <div id="wrapper"><div id="content"> <div id="u"><a href="http://www.baidu.com/gaoji/preferences.html" name="tj_setting">??儲璁劇疆</a>|<a href="https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F" name="tj_login" id="lb" onclick="return false;">?誨?</a><a href="https://passport.baidu.com/v2/?reg®Type=1&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F" target="_blank" name="tj_reg" class="reg">娉ㄥ?</a></div> <div id="m"> <p id="lg"><img src="http://www.baidu.com/img/shouye_b5486898c692066bd2cbaeda86d74448.gif" width="270" height="129" ></p> <p id="nv"><a href="http://news.baidu.com">??nbsp;??/a>??b>緗?nbsp;欏?/b>??a href="http://tieba.baidu.com">璐?nbsp;??/a>??a href="http://zhidao.baidu.com">??nbsp;??/a>??a href="http://music.baidu.com">??nbsp;涔?/a>??a href="http://image.baidu.com">??nbsp;??/a>??a href="http://video.baidu.com">瑙?nbsp;棰?/a>??a href="http://map.baidu.com">??nbsp;??/a></p><div id="fm"><form name="f" action="/s"><span class="s_ipt_wr"><input type="text" name="wd" id="kw" maxlength="100" class="s_ipt"></span><input type="hidden" name="rsv_bp" value="0"><input type=hidden name=ch value=""><input type=hidden name=tn value="baidu"><input type=hidden name=bar value=""><input type="hidden" name="rsv_spt" value="3"><input type="hidden" name="ie" value="utf-8"><span class="s_btn_wr"><input type="submit" value="?懼害涓??" id="su" class="s_btn" onmousedown="this.className='s_btn s_btn_h'" onmouseout="this.className='s_btn'"></span></form><span class="tools"><span id="mHolder"><div id="mCon"><span>杈??娉?/span></div></span></span><ul id="mMenu"><li><a href="#" name="ime_hw">???</a></li><li><a href="#" name="ime_py">?奸?</a></li><li class="ln"></li><li><a href="#" name="ime_cl">?抽?</a></li></ul></div> <p id="lk"><a href="http://baike.baidu.com">?劇?</a>??a href="http://wenku.baidu.com">???</a>??a href="http://www.hao123.com">hao123</a><span> | <a href="http://www.baidu.com/more/">?村?>></a></span></p><p id="lm"></p> </div> </div> <div id="ftCon"><div id="ftConw"> <p ><a id="seth" onClick="h(this)" href="/" onmousedown="return ns_c({'fm':'behs','tab':'homepage','pos':0})">???搴??涓轟富欏?/a><a id="setf" href="http://www.baidu.com/cache/sethelp/index.html" onmousedown="return ns_c({'fm':'behs','tab':'favorites','pos':0})" target="_blank">???搴??涓轟富欏?/a><span id="sekj"><a href="http://liulanqi.baidu.com/ps.php" target="_blank" onmousedown="return ns_c({'fm':'behs','tab':'bdbrwlk','pos':1})">瀹???懼害嫻????/a></span></p><p id="lh"><a href="http://e.baidu.com/?refer=888" onmousedown="return ns_c({'fm':'behs','tab':'btlink','pos':2})">????懼害?ㄥ箍</a> | <a href="http://top.baidu.com">??儲椋??姒?/a> | <a href="http://home.baidu.com">?充??懼害</a> | <a href="http://ir.baidu.com">About Baidu</a></p><p id="cp">©2013 Baidu <a href="/duty/">浣跨??懼害???璇?/a> <a href="http://www.miibeian.gov.cn" target="_blank">浜?CP璇?30173??/a> <img src="http://www.baidu.com/cache/global/img/gs.gif"></p></div></div> </div> </body><script>var bds={se:{},comm : {ishome : 1,sid : "1464_1945_1788",user : "",username : "",sugHost : "http://suggestion.baidu.com/su",personalData : "",loginAction : []}}</script><script type="text/javascript" src="http://s1.bdstatic.com/r/www/cache/global/js/home-2.8.js" charset="gbk"></script><script>var bdUser = null;var w=window,d=document,n=navigator,k=d.f.wd,a=d.getElementById("nv").getElementsByTagName("a"),isIE=n.userAgent.indexOf("MSIE")!=-1&&!window.opera;(function(){if(/q=([^&]+)/.test(location.search)){k.value=decodeURIComponent(RegExp["\x241"])}})();if(n.cookieEnabled){bds.se.sug();};function addEV(o, e, f){if(w.attachEvent){o.attachEvent("on" + e, f);}else if(w.addEventListener){ o.addEventListener(e, f, false);}}function G(id){return d.getElementById(id);}function ns_c(q){var p = encodeURIComponent(window.document.location.href), sQ = '', sV = '', mu='', img = window["BD_PS_C" + (new Date()).getTime()] = new Image();for (v in q) {sV = q[v];sQ += v + "=" + sV + "&";} mu= "&mu=" + p ;img.src = "http://nsclick.baidu.com/v.gif?pid=201&pj=www&rsv_sid=1464_1945_1788&" + sQ + "path="+p+"&t="+new Date().getTime();return true;}if(/\bbdime=[12]/.test(d.cookie)){document.write('<script src=http://s1.bdstatic.com/r/www/cache/ime/js/openime-1.0.1.js charset="gbk"><\/script>');}(function(){var u = G("u").getElementsByTagName("a"), nv = G("nv").getElementsByTagName("a"), lk = G("lk").getElementsByTagName("a"), un = "";var tj_nv = ["news","tieba","zhidao","mp3","img","video","map"];var tj_lk = ["baike","wenku","hao123","more"];un = bds.comm.user == "" ? "" : bds.comm.user;function _addTJ(obj){addEV(obj, "mousedown", function(e){var e = e || window.event;var target = e.target || e.srcElement;ns_c({'fm':'behs','tab':target.name||'tj_user','un':encodeURIComponent(un)});});}for(var i = 0; i < u.length; i++){_addTJ(u[i]);}for(var i = 0; i < nv.length; i++){nv[i].name = 'tj_' + tj_nv[i];}for(var i = 0; i < lk.length; i++){lk[i].name = 'tj_' + tj_lk[i];}})();(function() {var links = {'tj_news': ['word', 'http://news.baidu.com/ns?tn=news&cl=2&rn=20&ct=1&ie=utf-8'],'tj_tieba': ['kw', 'http://tieba.baidu.com/f?ie=utf-8'],'tj_zhidao': ['word', 'http://zhidao.baidu.com/search?pn=0&rn=10&lm=0'],'tj_mp3': ['key', 'http://music.baidu.com/search?fr=ps&ie=utf-8'],'tj_img': ['word', 'http://image.baidu.com/i?ct=201326592&cl=2&nc=1&lm=-1&st=-1&tn=baiduimage&istype=2&fm=&pv=&z=0&ie=utf-8'],'tj_video': ['word', 'http://video.baidu.com/v?ct=301989888&s=25&ie=utf-8'],'tj_map': ['wd', 'http://map.baidu.com/?newmap=1&ie=utf-8&s=s'],'tj_baike': ['word', 'http://baike.baidu.com/search/word?pic=1&sug=1&enc=utf8'],'tj_wenku': ['word', 'http://wenku.baidu.com/search?ie=utf-8']};var domArr = [G('nv'), G('lk')],kw = G('kw');for (var i = 0, l = domArr.length; i < l; i++) {domArr[i].onmousedown = function(e) {e = e || window.event;var target = e.target || e.srcElement,name = target.getAttribute('name'),items = links[name],reg = new RegExp('^\\s+|\\s+\x24'),key = kw.value.replace(reg, '');if (items) {if (key.length > 0) {var wd = items[0], url = items[1],url = url + ( name === 'tj_map' ? encodeURIComponent('&' + wd + '=' + key) : ( ( url.indexOf('?') > 0 ? '&' : '?' ) + wd + '=' + encodeURIComponent(key) ) );target.href = url;} else {target.href = target.href.match(new RegExp('^http:\/\/.+\.baidu\.com'))[0];}}name && ns_c({'fm': 'behs','tab': name,'query': encodeURIComponent(key),'un': encodeURIComponent(bds.comm.user || '') });};}})();addEV(w,"load",function(){k.focus()});w.onunload=function(){};</script><script type="text/javascript" src="http://s1.bdstatic.com/r/www/cache/global/js/tangram-1.3.4c1.0.js"></script><script type="text/javascript" src="http://s1.bdstatic.com/r/www/cache/user/js/u-1.3.4.js" charset="gbk"></script><script>try{document.cookie="WWW_ST=;expires=Sat, 01 Jan 2000 00:00:00 GMT";baidu.on(document.forms[0],"submit",function(){var _t=new Date().getTime();document.cookie = "WWW_ST=" + _t +";expires=" + new Date(_t + 10000).toGMTString()})}catch(e){}</script></html><!--3847f41d362754ab-->
HttpEntity END >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
----------------------------------------
HTTP/1.1 200 OK
HttpEntity start >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Response content length: 439
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<script type="text/javascript">
var url = encodeURI('https://passport.baidu.com/jump.html?error=119998&callback=&index=0&username=&phonenumber=&mail=&tpl=&u=https%3A%2F%2Fpassport.baidu.com%2F&needToModifyPassword=0&gotourl=');
//parent.callback(url)
window.location.replace(url);
</script>
</body>
</html>
HttpEntity END >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
----------------------------------------
cookies2
Length2::10309
HttpEntity start >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Response content length: 10309
<!DOCTYPE html><!--STATUS OK--> <html><head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>?懼害涓??錛??灝辯???/title> <style >html,body{height:100%}html{overflow-y:auto}#wrapper{position:relative;_position:;min-height:100%}#content{padding-bottom:100px;text-align:center}#ftCon{height:100px;position:absolute;bottom:44px;text-align:center;width:100%;margin:0 auto;z-index:0;overflow:hidden}#ftConw{width:720px;margin:0 auto}body{font:12px arial;text-align:;background:#fff}body,p,form,ul,li{margin:0;padding:0;list-style:none}body,form,#fm{position:relative}td{text-align:left}img{border:0}a{color:#00c}a:active{color:#f60}#u{color:#999;padding:4px 10px 5px 0;text-align:right}#u a{margin:0 5px}#u .reg{margin:0}#m{width:720px;margin:0 auto}#nv a,#nv b,.btn,#lk{font-size:14px}#fm{padding-left:110px;text-align:left;z-index:1}input{border:0;padding:0}#nv{height:19px;font-size:16px;margin:0 0 4px;text-align:left;text-indent:137px}.s_ipt_wr{width:418px;height:30px;display:inline-block;margin-right:5px;background:url(http://s1.bdstatic.com/r/www/img/i-1.0.0.png) no-repeat -304px 0;border:1px solid #b6b6b6;border-color:#9a9a9a #cdcdcd #cdcdcd #9a9a9a;vertical-align:top}.s_ipt{width:405px;height:22px;font:16px/22px arial;margin:5px 0 0 7px;background:#fff;outline:0;-webkit-appearance:none}.s_btn{width:95px;height:32px;padding-top:2px\9;font-size:14px;background:#ddd url(http://s1.bdstatic.com/r/www/img/i-1.0.0.png);cursor:pointer}.s_btn_h{background-position:-100px 0}.s_btn_wr{width:97px;height:34px;display:inline-block;background:url(http://s1.bdstatic.com/r/www/img/i-1.0.0.png) no-repeat -202px 0;*position:relative;z-index:0;vertical-align:top}#lg img{vertical-align:top;margin-bottom:3px}#lk{margin:33px 0}#lk span{font:14px "瀹??"}#lm{height:60px}#lh{margin:16px 0 5px;word-spacing:3px}.tools{position:absolute;top:-4px;*top:10px;right:7px}#mHolder{width:62px;position:relative;z-index:296;display:none}#mCon{height:18px;line-height:18px;position:absolute;cursor:pointer;padding:0 18px 0 0;background:url(http://s1.bdstatic.com/r/www/img/bg-1.0.0.gif) no-repeat right -134px;background-position:right -136px\9}#mCon span{color:#00c;cursor:default;display:block}#mCon .hw{text-decoration:underline;cursor:pointer}#mMenu a{width:100%;height:100%;display:block;line-height:22px;text-indent:6px;text-decoration:none;filter:none\9}#mMenu,#user ul{box-shadow:1px 1px 2px #ccc;-moz-box-shadow:1px 1px 2px #ccc;-webkit-box-shadow:1px 1px 2px #ccc;filter:progid:DXImageTransform.Microsoft.Shadow(Strength=2,Direction=135,Color="#cccccc")\9}#mMenu{width:56px;border:1px solid #9b9b9b;list-style:none;position:absolute;right:27px;top:28px;display:none;background:#fff}#mMenu a:hover{background:#ebebeb}#mMenu .ln{height:1px;background:#ebebeb;overflow:hidden;font-size:1px;line-height:1px;margin-top:-1px}#cp,#cp a{color:#666}#seth{display:none;behavior:url(#default#homepage)}#setf{display:none}#sekj{margin-left:14px}#shouji{margin-right:14px}</style> <script>function h(obj){obj.style.behavior='url(#default#homepage)';var a = obj.setHomePage('http://www.baidu.com/');}</script></head><body> <div id="wrapper"><div id="content"> <div id="u"><a href="http://www.baidu.com/gaoji/preferences.html" name="tj_setting">??儲璁劇疆</a>|<a href="https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F" name="tj_login" id="lb" onclick="return false;">?誨?</a><a href="https://passport.baidu.com/v2/?reg®Type=1&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F" target="_blank" name="tj_reg" class="reg">娉ㄥ?</a></div> <div id="m"> <p id="lg"><img src="http://www.baidu.com/img/shouye_b5486898c692066bd2cbaeda86d74448.gif" width="270" height="129" ></p> <p id="nv"><a href="http://news.baidu.com">??nbsp;??/a>??b>緗?nbsp;欏?/b>??a href="http://tieba.baidu.com">璐?nbsp;??/a>??a href="http://zhidao.baidu.com">??nbsp;??/a>??a href="http://music.baidu.com">??nbsp;涔?/a>??a href="http://image.baidu.com">??nbsp;??/a>??a href="http://video.baidu.com">瑙?nbsp;棰?/a>??a href="http://map.baidu.com">??nbsp;??/a></p><div id="fm"><form name="f" action="/s"><span class="s_ipt_wr"><input type="text" name="wd" id="kw" maxlength="100" class="s_ipt"></span><input type="hidden" name="rsv_bp" value="0"><input type=hidden name=ch value=""><input type=hidden name=tn value="baidu"><input type=hidden name=bar value=""><input type="hidden" name="rsv_spt" value="3"><input type="hidden" name="ie" value="utf-8"><span class="s_btn_wr"><input type="submit" value="?懼害涓??" id="su" class="s_btn" onmousedown="this.className='s_btn s_btn_h'" onmouseout="this.className='s_btn'"></span></form><span class="tools"><span id="mHolder"><div id="mCon"><span>杈??娉?/span></div></span></span><ul id="mMenu"><li><a href="#" name="ime_hw">???</a></li><li><a href="#" name="ime_py">?奸?</a></li><li class="ln"></li><li><a href="#" name="ime_cl">?抽?</a></li></ul></div> <p id="lk"><a href="http://baike.baidu.com">?劇?</a>??a href="http://wenku.baidu.com">???</a>??a href="http://www.hao123.com">hao123</a><span> | <a href="http://www.baidu.com/more/">?村?>></a></span></p><p id="lm"></p> </div> </div> <div id="ftCon"><div id="ftConw"> <p ><a id="seth" onClick="h(this)" href="/" onmousedown="return ns_c({'fm':'behs','tab':'homepage','pos':0})">???搴??涓轟富欏?/a><a id="setf" href="http://www.baidu.com/cache/sethelp/index.html" onmousedown="return ns_c({'fm':'behs','tab':'favorites','pos':0})" target="_blank">???搴??涓轟富欏?/a><span id="sekj"><a href="http://liulanqi.baidu.com/ps.php" target="_blank" onmousedown="return ns_c({'fm':'behs','tab':'bdbrwlk','pos':1})">瀹???懼害嫻????/a></span></p><p id="lh"><a href="http://e.baidu.com/?refer=888" onmousedown="return ns_c({'fm':'behs','tab':'btlink','pos':2})">????懼害?ㄥ箍</a> | <a href="http://top.baidu.com">??儲椋??姒?/a> | <a href="http://home.baidu.com">?充??懼害</a> | <a href="http://ir.baidu.com">About Baidu</a></p><p id="cp">©2013 Baidu <a href="/duty/">浣跨??懼害???璇?/a> <a href="http://www.miibeian.gov.cn" target="_blank">浜?CP璇?30173??/a> <img src="http://www.baidu.com/cache/global/img/gs.gif"></p></div></div> </div> </body><script>var bds={se:{},comm : {ishome : 1,sid : "1452_2043_1945_1788",user : "",username : "",sugHost : "http://suggestion.baidu.com/su",personalData : "",loginAction : []}}</script><script type="text/javascript" src="http://s1.bdstatic.com/r/www/cache/global/js/home-2.8.js" charset="gbk"></script><script>var bdUser = null;var w=window,d=document,n=navigator,k=d.f.wd,a=d.getElementById("nv").getElementsByTagName("a"),isIE=n.userAgent.indexOf("MSIE")!=-1&&!window.opera;(function(){if(/q=([^&]+)/.test(location.search)){k.value=decodeURIComponent(RegExp["\x241"])}})();if(n.cookieEnabled){bds.se.sug();};function addEV(o, e, f){if(w.attachEvent){o.attachEvent("on" + e, f);}else if(w.addEventListener){ o.addEventListener(e, f, false);}}function G(id){return d.getElementById(id);}function ns_c(q){var p = encodeURIComponent(window.document.location.href), sQ = '', sV = '', mu='', img = window["BD_PS_C" + (new Date()).getTime()] = new Image();for (v in q) {sV = q[v];sQ += v + "=" + sV + "&";} mu= "&mu=" + p ;img.src = "http://nsclick.baidu.com/v.gif?pid=201&pj=www&rsv_sid=1452_2043_1945_1788&" + sQ + "path="+p+"&t="+new Date().getTime();return true;}if(/\bbdime=[12]/.test(d.cookie)){document.write('<script src=http://s1.bdstatic.com/r/www/cache/ime/js/openime-1.0.1.js charset="gbk"><\/script>');}(function(){var u = G("u").getElementsByTagName("a"), nv = G("nv").getElementsByTagName("a"), lk = G("lk").getElementsByTagName("a"), un = "";var tj_nv = ["news","tieba","zhidao","mp3","img","video","map"];var tj_lk = ["baike","wenku","hao123","more"];un = bds.comm.user == "" ? "" : bds.comm.user;function _addTJ(obj){addEV(obj, "mousedown", function(e){var e = e || window.event;var target = e.target || e.srcElement;ns_c({'fm':'behs','tab':target.name||'tj_user','un':encodeURIComponent(un)});});}for(var i = 0; i < u.length; i++){_addTJ(u[i]);}for(var i = 0; i < nv.length; i++){nv[i].name = 'tj_' + tj_nv[i];}for(var i = 0; i < lk.length; i++){lk[i].name = 'tj_' + tj_lk[i];}})();(function() {var links = {'tj_news': ['word', 'http://news.baidu.com/ns?tn=news&cl=2&rn=20&ct=1&ie=utf-8'],'tj_tieba': ['kw', 'http://tieba.baidu.com/f?ie=utf-8'],'tj_zhidao': ['word', 'http://zhidao.baidu.com/search?pn=0&rn=10&lm=0'],'tj_mp3': ['key', 'http://music.baidu.com/search?fr=ps&ie=utf-8'],'tj_img': ['word', 'http://image.baidu.com/i?ct=201326592&cl=2&nc=1&lm=-1&st=-1&tn=baiduimage&istype=2&fm=&pv=&z=0&ie=utf-8'],'tj_video': ['word', 'http://video.baidu.com/v?ct=301989888&s=25&ie=utf-8'],'tj_map': ['wd', 'http://map.baidu.com/?newmap=1&ie=utf-8&s=s'],'tj_baike': ['word', 'http://baike.baidu.com/search/word?pic=1&sug=1&enc=utf8'],'tj_wenku': ['word', 'http://wenku.baidu.com/search?ie=utf-8']};var domArr = [G('nv'), G('lk')],kw = G('kw');for (var i = 0, l = domArr.length; i < l; i++) {domArr[i].onmousedown = function(e) {e = e || window.event;var target = e.target || e.srcElement,name = target.getAttribute('name'),items = links[name],reg = new RegExp('^\\s+|\\s+\x24'),key = kw.value.replace(reg, '');if (items) {if (key.length > 0) {var wd = items[0], url = items[1],url = url + ( name === 'tj_map' ? encodeURIComponent('&' + wd + '=' + key) : ( ( url.indexOf('?') > 0 ? '&' : '?' ) + wd + '=' + encodeURIComponent(key) ) );target.href = url;} else {target.href = target.href.match(new RegExp('^http:\/\/.+\.baidu\.com'))[0];}}name && ns_c({'fm': 'behs','tab': name,'query': encodeURIComponent(key),'un': encodeURIComponent(bds.comm.user || '') });};}})();addEV(w,"load",function(){k.focus()});w.onunload=function(){};</script><script type="text/javascript" src="http://s1.bdstatic.com/r/www/cache/global/js/tangram-1.3.4c1.0.js"></script><script type="text/javascript" src="http://s1.bdstatic.com/r/www/cache/user/js/u-1.3.4.js" charset="gbk"></script><script>try{document.cookie="WWW_ST=;expires=Sat, 01 Jan 2000 00:00:00 GMT";baidu.on(document.forms[0],"submit",function(){var _t=new Date().getTime();document.cookie = "WWW_ST=" + _t +";expires=" + new Date(_t + 10000).toGMTString()})}catch(e){}</script></html><!--0ba9a2d5f1bcb341-->
HttpEntity END >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
http://bbs.csdn.net/topics/370158939
