隨筆 - 1  文章 - 37  trackbacks - 0
          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          留言簿(16)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          test

          搜索

          •  

          最新評論

          數據發送接收情況:
          ........客戶端與Gateserver,Loginserver的數據互換,省略
          1. 客戶端向Gameserver發送[**登錄用戶名/角色名/驗證數1/驗證數2/版本驗證數/1/0]
          2. Gameserver向客戶端發送密文,類似#eLrBHMNx<F=hgmlYA]X]ENtpGM`X@?PuN`LwT_m>RmleJ_l{PAMHQ?pUCpdbENa<F`pjBllQC=HSC\\pT?LduQ_y=PQM>JptK!
          3. 客戶端向Gameserver發送解密后密文,類似#3<<<<<Jx?<<<<<<<<A>xZCNLSHoPpAnQRF?ljIaaUPmlSF^L_BmtfFODJA_X\\A]T`GNlq@L!
          ........歡迎信息,裝備信息等省略

          數據格式
          [#][標識位][指令頭][消息體][!]
          例如 #3<<<<<B\\<<<<<<<<<mi{EhL!

          命令結構體
          typedef struct tag_TDEFAULTMESSAGE
          {
              int     nRecog;
              WORD    wIdent;  3EF
              WORD    wParam;
              WORD    wTag;
              WORD    wSeries;
          } _TDEFAULTMESSAGE, *_LPTDEFAULTMESSAGE;

          解密命令體<<<<<Jx?<<<<<<<<得到wIdent值是3EF(1007),OD打開Mir3.exe,查找常量000003EF,跟蹤進入,得到如下代碼
          >>Method1(未知參數)
            push    esi
            push    edi
            push    0   
            push    0
            push    0
            push    0
            mov     esi, ecx
            push    3EF
            lea     edi, dword ptr [esi+18]  ;esi+18 是命令結構體的首地址
            push    edi         ;命令結構體首地址
            call    004A0D00    ;生成命令結構體 (edi,3ef,0,0,0,0)
            mov     eax, dword ptr [esp+C] ; eax保存第一個參數
            push    0
            push    eax
            push    edi
            mov     ecx, esi    ;傳遞this指針,
            call    0049E450    ;發送數據,arg3: 0, arg2: 第一個參數, arg1: 命令結構體
            pop     edi
            pop     esi
            retn    4

          簡單分析,入棧的4個0和3EF,則對應結構體,該函數至少1個參數,目前不知這個參數是什么意思,跟進0049E450看看
          >>Method2(命令結構體,未知參數,0)
            mov     eax, dword ptr [esp+4]  ;eax=命令結構體
            push    ebx
            push    ebp
            push    esi
            mov     esi, ecx                ;得到this指針
            push    20
            lea     ebp, dword ptr [esi+24] ;esi+18是命令結構體,加密命令結構體得到的字符串保存在esi+24中
            push    ebp                     
            push    eax
            call    004A0CA0                ;跟進發現是加密命令結構體,arg3: 20(32), arg2: esi+24, arg1: 命令結構體地址
            mov     eax, dword ptr [esi+14] ;eax=esi+14=標識位
            cmp     eax, 9
            jl L015                         ;如果標識位小于9,則跳到L015
            mov     dword ptr [esi+14], 1   ;否則標識位重設為1
            jmp L017
          L015:
            inc     eax
            mov     dword ptr [esi+14], eax ;標識位自加1
          L017:
            mov     edx, dword ptr [esp+14] ;edx=第2個參數
            test    edx, edx                ;
            je L048                         ;如果第2個參數為0,則跳轉到L048
            mov     eax, dword ptr [esp+18] ;eax=第3個參數: 0
            test    eax, eax               
            push    edi                 
            jnz L031                        ;eax不等于0則跳轉
            mov     eax, edx                ;eax=第2個參數
            lea     edi, dword ptr [eax+1] 
          L026:
            mov     cl, byte ptr [eax]      ;cl=第2個參數第1個字節
            inc     eax                     ;eax                   
            test    cl, cl                  ;循環得到第一個參數的長度
            jnz L026                        ;沒到字符串尾則繼續循環
            sub     eax, edi               
          L031:
            push    2000
            push    eax
            lea     edi, dword ptr [esi+44]
            push    edi
            push    edx
            call    004A0B10                ;調用加密函數,將edx加密,保存在esi+44中
            mov     ecx, dword ptr [esi+14]
            push    edi
            push    ebp
            push    ecx
            lea     ebx, dword ptr [esi+2044]
            push    004CBFE4                 ; #%d%s%s!
            push    ebx
            call    004BB568
            add     esp, 14
            pop     edi
            jmp L056
          L048:
            mov     edx, dword ptr [esi+14]
            push    ebp
            push    edx
            lea     ebx, dword ptr [esi+2044]
            push    004CBFC4                   ; #%d%s!
            push    ebx
            call    004BB568                   ;sprintf  格式化發送給服務器端的數據
            add     esp, 10
          L056:
            mov     eax, ebx
            lea     edx, dword ptr [eax+1]
          L058:
            mov     cl, byte ptr [eax]
            inc     eax                        ;這個循環得到數據長度
            test    cl, cl
            jnz L058
            push    0
            sub     eax, edx
            push    eax                        ; 數據長度
            mov     eax, dword ptr [esi+6044]
            push    ebx                 ; Data ,要發送的數據
            push    eax                 ; Socket對象
            call    <jmp.&WS2_32.#19>   ;這里是調用send(Socket對象, 要發送的數據, 數據長度, 0 (flag));
            pop     esi
            pop     ebp
            pop     ebx
            retn    0C

          L017和L031說明Method1和Method2中的未知參數就是明文消息體,Method1只有1個消息體參數


           

          posted on 2008-06-01 10:48 Phrancol Yang 閱讀(558) 評論(0)  編輯  收藏 所屬分類: 反匯編
          主站蜘蛛池模板: 灵山县| 陆丰市| 永仁县| 正安县| 临沭县| 隆昌县| 泸定县| 长岛县| 长沙市| 吉林市| 宁陕县| 固镇县| 河东区| 铜梁县| 霍州市| 保康县| 墨江| 上思县| 兴隆县| 许昌县| 新竹市| 巴林右旗| 原阳县| 南华县| 方山县| 平陆县| 青冈县| 乌兰察布市| 西充县| 仙桃市| 化州市| 兖州市| 固始县| 鹰潭市| 右玉县| 高台县| 长汀县| 承德县| 正宁县| 东至县| 舟曲县|