analysis communication of ucenter

来源:互联网 发布:unity3d中国官网注册 编辑:程序博客网 时间:2024/05/03 08:30
  
 1.机器状况:
    A机器:192.168.1.101
    B机器:192.168.1.204
    2.AB之间调通ucenter
    3.A机器发送uc通信包到B机器,抓包可见
No.     Time        Source                Destination           Protocol Info
     16 5.934133    192.168.1.101         192.168.1.204         HTTP     POST /mall/forum/api/uc.php?code=52c5AmNlWGVhj3Px%2FYIvW09KKpdR7ouLlCcsc4opnBYHwzrPauwCLlhYWcV2PMEBEXwf7nmybkM8Brw9NuY&__times__=1 HTTP/1.0

Frame 16 (1224 bytes on wire, 1224 bytes captured)
Ethernet II, Src: Intel_89:bd:3e (00:18:de:89:bd:3e), Dst: fe:ff:ff:ff:ff:ff (fe:ff:ff:ff:ff:ff)
Internet Protocol, Src: 192.168.1.101 (192.168.1.101), Dst: 192.168.1.204 (192.168.1.204)
Transmission Control Protocol, Src Port: 1384 (1384), Dst Port: http (80), Seq: 1, Ack: 1, Len: 1170
Hypertext Transfer Protocol
    POST /mall/forum/api/uc.php?code=52c5AmNlWGVhj3Px%2FYIvW09KKpdR7ouLlCcsc4opnBYHwzrPauwCLlhYWcV2PMEBEXwf7nmybkM8Brw9NuY&__times__=1 HTTP/1.0/r/n
    Accept: */*/r/n
    Accept-Language: zh-cn/r/n
    Content-Type: multipart/form-data;/r/n
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.18) Gecko/20081029 Firefox/2.0.0.18/r/n
    Host: 192.168.1.204/r/n
    Content-Length: 752
    Connection: Close/r/n
    Cache-Control: no-cache/r/n
    Cookie: /r/n
    /r/n
The multipart dissector could not find the required boundary parameter.
Data (752 bytes)

0000  3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31   <?xml version="1
0010  2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 49 53   .0" encoding="IS
0020  4f 2d 38 38 35 39 2d 31 22 3f 3e 3c 72 6f 6f 74   O-8859-1"?><root
0030  3e 20 3c 69 74 65 6d 5f 33 3e 20 3c 61 70 70 69   > <item_3> <appi
0040  64 3e 33 3c 2f 61 70 70 69 64 3e 20 3c 74 79 70   d>3</appid> <typ
0050  65 3e 44 49 53 43 55 5a 3c 2f 74 79 70 65 3e 20   e>DISCUZ</type>
0060  3c 6e 61 6d 65 3e e5 8d 97 e7 93 9c e8 ae ba e5   <name>..........
0070  9d 9b 3c 2f 6e 61 6d 65 3e 20 3c 75 72 6c 3e 68   ..</name> <url>h
0080  74 74 70 3a 2f 2f 31 39 32 2e 31 36 38 2e 31 2e   ttp://192.168.1.
0090  32 30 34 2f 6d 61 6c 6c 2f 66 6f 72 75 6d 3c 2f   204/mall/forum</
00a0  75 72 6c 3e 20 3c 69 70 3e 3c 2f 69 70 3e 20 3c   url> <ip></ip> <
00b0  63 68 61 72 73 65 74 3e 3c 2f 63 68 61 72 73 65   charset></charse
00c0  74 3e 20 3c 73 79 6e 6c 6f 67 69 6e 3e 31 3c 2f   t> <synlogin>1</
00d0  73 79 6e 6c 6f 67 69 6e 3e 20 3c 65 78 74 72 61   synlogin> <extra
00e0  3e 4e 3b 3c 2f 65 78 74 72 61 3e 20 3c 72 65 63   >N;</extra> <rec
00f0  76 6e 6f 74 65 3e 31 3c 2f 72 65 63 76 6e 6f 74   vnote>1</recvnot
0100  65 3e 20 3c 2f 69 74 65 6d 5f 33 3e 20 3c 69 74   e> </item_3> <it
0110  65 6d 5f 32 3e 20 3c 61 70 70 69 64 3e 32 3c 2f   em_2> <appid>2</
0120  61 70 70 69 64 3e 20 3c 74 79 70 65 3e 45 43 53   appid> <type>ECS
0130  48 4f 50 3c 2f 74 79 70 65 3e 20 3c 6e 61 6d 65   HOP</type> <name
0140  3e e5 8d 97 e7 93 9c e7 bd 91 3c 2f 6e 61 6d 65   >.........</name
0150  3e 20 3c 75 72 6c 3e 68 74 74 70 3a 2f 2f 31 32   > <url>http://12
0160  37 2e 30 2e 30 2e 31 2f 6e 61 6e 67 75 61 3c 2f   7.0.0.1/nangua</
0170  75 72 6c 3e 20 3c 69 70 3e 3c 2f 69 70 3e 20 3c   url> <ip></ip> <
0180  63 68 61 72 73 65 74 3e 75 74 66 2d 38 3c 2f 63   charset>utf-8</c
0190  68 61 72 73 65 74 3e 20 3c 73 79 6e 6c 6f 67 69   harset> <synlogi
01a0  6e 3e 31 3c 2f 73 79 6e 6c 6f 67 69 6e 3e 20 3c   n>1</synlogin> <
01b0  65 78 74 72 61 3e 4e 3b 3c 2f 65 78 74 72 61 3e   extra>N;</extra>
01c0  20 3c 72 65 63 76 6e 6f 74 65 3e 31 3c 2f 72 65    <recvnote>1</re
01d0  63 76 6e 6f 74 65 3e 20 3c 2f 69 74 65 6d 5f 32   cvnote> </item_2
01e0  3e 20 3c 69 74 65 6d 5f 34 3e 20 3c 61 70 70 69   > <item_4> <appi
01f0  64 3e 34 3c 2f 61 70 70 69 64 3e 20 3c 74 79 70   d>4</appid> <typ
0200  65 3e 4f 54 48 45 52 3c 2f 74 79 70 65 3e 20 3c   e>OTHER</type> <
0210  6e 61 6d 65 3e 44 45 44 45 43 4d 53 3c 2f 6e 61   name>DEDECMS</na
0220  6d 65 3e 20 3c 75 72 6c 3e 68 74 74 70 3a 2f 2f   me> <url>http://
0230  31 39 32 2e 31 36 38 2e 31 2e 32 30 34 2f 64 65   192.168.1.204/de
0240  64 65 63 6d 73 3c 2f 75 72 6c 3e 20 3c 69 70 3e   decms</url> <ip>
0250  3c 2f 69 70 3e 20 3c 63 68 61 72 73 65 74 3e 75   </ip> <charset>u
0260  74 66 2d 38 3c 2f 63 68 61 72 73 65 74 3e 20 3c   tf-8</charset> <
0270  73 79 6e 6c 6f 67 69 6e 3e 31 3c 2f 73 79 6e 6c   synlogin>1</synl
0280  6f 67 69 6e 3e 20 3c 65 78 74 72 61 3e 4e 3b 3c   ogin> <extra>N;<
0290  2f 65 78 74 72 61 3e 20 3c 72 65 63 76 6e 6f 74   /extra> <recvnot
02a0  65 3e 31 3c 2f 72 65 63 76 6e 6f 74 65 3e 20 3c   e>1</recvnote> <
02b0  2f 69 74 65 6d 5f 34 3e 20 3c 55 43 5f 41 50 49   /item_4> <UC_API
02c0  3e 68 74 74 70 3a 2f 2f 31 32 37 2e 30 2e 30 2e   >http://127.0.0.
02d0  31 2f 6e 61 6e 67 75 61 2f 75 63 65 6e 74 65 72   1/nangua/ucenter
02e0  3c 2f 55 43 5f 41 50 49 3e 3c 2f 72 6f 6f 74 3e   </UC_API></root>

No.     Time        Source                Destination           Protocol Info
     18 5.941275    192.168.1.204         192.168.1.101         HTTP     HTTP/1.1 200 OK (text/html)

Frame 18 (238 bytes on wire, 238 bytes captured)
Ethernet II, Src: fe:ff:ff:ff:ff:ff (fe:ff:ff:ff:ff:ff), Dst: Intel_89:bd:3e (00:18:de:89:bd:3e)
Internet Protocol, Src: 192.168.1.204 (192.168.1.204), Dst: 192.168.1.101 (192.168.1.101)
Transmission Control Protocol, Src Port: http (80), Dst Port: 1384 (1384), Seq: 1, Ack: 1171, Len: 184
Hypertext Transfer Protocol
    HTTP/1.1 200 OK/r/n
    Date: Wed, 10 Dec 2008 05:20:35 GMT/r/n
    Server: Apache/2.2.9 (Unix) PHP/5.2.6/r/n
    X-Powered-By: PHP/5.2.6/r/n
    Content-Length: 1
    Connection: close/r/n
    Content-Type: text/html/r/n
    /r/n
Line-based text data: text/html
    1

4.查看代码,可知道,uc是通过下面代码加密key及一些参数后进行通信
    
    function get_url_code($operation, $getdata, $appid) {
        $app = $this->apps[$appid];
        $authkey = $this->db->result_first("SELECT authkey FROM ".UC_DBTABLEPRE."applications WHERE appid='$appid'");
        $url = $app['url'];
        $action = $this->operations[$operation][1];
        $code = urlencode(uc_authcode("$action&".($getdata ? "$getdata&" : '')."time=".$this->base->time, 'ENCODE', $authkey));
        return $url."/api/uc.php?code=$code";
    }

5.所以两边要通信必须密钥要对,另外通信的url加上/api/uc.php这个东西要存在,因为是post到这里通信的
原创粉丝点击