天天看點

Web版微信協定分析—版本2微信web協定分析(微信網頁版 wx2.qq.com)

1.打開首頁,配置設定一個随機uuid,

2.根據該uuid擷取二維碼圖檔。

3.微信用戶端掃描該圖檔,在用戶端确認登入。

4.浏覽器不停的調用一個接口,如果傳回登入成功,則調用登入接口

5.此時可以擷取聯系人清單,可以發送消息。然後不斷調用同步接口。

6.如果同步接口有傳回,則可以擷取新消息,然後繼續調用同步接口。

API

擷取 UUID

url

<a href="https://login.weixin.qq.com/jslogin" target="_blank">https://login.weixin.qq.com/jslogin</a>

method

GET

data

URL Encode

params

appid : wx782c26e4c19acffb 

fun : new 

lang: zh_CN 

_ : 時間戳

傳回資料(String):

顯示二維碼

POST

t : webwx &lt;br/&gt; _ : 時間戳

二維碼掃描登入

<a href="https://login.weixin.qq.com/cgi-bin/mmwebwx-bin/login" target="_blank">https://login.weixin.qq.com/cgi-bin/mmwebwx-bin/login</a>

tip : 1:未掃描 0:已掃描 

uuid : 擷取到的uuid 

webwxnewloginpage

<a href="https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage" target="_blank">https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage</a>

ticket : xxx 

uuid : xxx 

lang : zh_CN 

scan : xxx 

fun : new

傳回資料(XML):

在這一步擷取xml中的 <code>skey</code>, <code>wxsid</code>, <code>wxuin</code>, <code>pass_ticket</code>

webwxinit

<a href="https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxinit" target="_blank">https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxinit</a>

JSON

header

Content-Type: application/json; charset=UTF-8

     BaseRequest: { 

         Uin: xxx, 

         Sid: xxx, 

         Skey: xxx, 

         DeviceID: xxx, 

     } 

}

傳回資料(JSON):

這一步中擷取 <code>SyncKey</code>, <code>User</code> 後面的消息監聽用。

webwxstatusnotify

<a href="https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxstatusnotify" target="_blank">https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxstatusnotify</a>

     BaseRequest: { Uin: xxx, Sid: xxx, Skey: xxx, DeviceID: xxx }, 

     Code: 3, 

     FromUserName: 自己的ID, 

     ToUserName: 自己的ID, 

     ClientMsgId: 時間戳 

webwxgetcontact

<a href="https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxgetcontact" target="_blank">https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxgetcontact</a>

ContentType: application/json; charset=UTF-8

synccheck

<a href="https://webpush2.weixin.qq.com/cgi-bin/mmwebwx-bin/synccheck" target="_blank">https://webpush2.weixin.qq.com/cgi-bin/mmwebwx-bin/synccheck</a>

webwxsync

<a href="https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxsync?sid=xxx&amp;skey=xxx&amp;pass_ticket=xxx" target="_blank">https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxsync?sid=xxx&amp;skey=xxx&amp;pass_ticket=xxx</a>

     SyncKey: xxx, 

     rr: <code>時間戳取反</code> 

webwxsendmsg

<a href="https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsg?pass_ticket=xxx" target="_blank">https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsg?pass_ticket=xxx</a>

     Msg: { 

         Type: 1 文字消息, 

         Content: 要發送的消息, 

         FromUserName: 自己的ID, 

         ToUserName: 好友的ID, 

         LocalID: 與clientMsgId相同, 

         ClientMsgId: 時間戳左移4位随後補上4位随機數 

更多資料:

<a href="https://github.com/xiangzhai/qwx" target="_blank">https://github.com/xiangzhai/qwx</a>

<a href="https://github.com/Urinx/WeixinBot" target="_blank">https://github.com/Urinx/WeixinBot</a>

<a href="http://www.07net01.com/2016/01/1201188.html" target="_blank">http://www.07net01.com/2016/01/1201188.html</a>

<a href="http://www.cnblogs.com/xiaozhi_5638/p/4923811.html" target="_blank">http://www.cnblogs.com/xiaozhi_5638/p/4923811.html</a>