Legend登陆验证说明

正文概述 开源人   2024-10-16 15:37:41  
客户端  在各种闲置状态 发送

执行QueryDynCode

刚登陆场景就发送CM_QUERYDYNCODE

并加密

cnsIntro 登陆场景 

           dMsg := MakeDefaultMsg(CM_QUERYDYNCODE, 0, 0, 0, 0);

            DCP_mars.InitStr(('sWebSite'));//加密密码

            S := DCP_mars.DecryptString(g_pRcHeader.sWebSite);//sWebSite 用网站地址解密

            DCP_mars.InitStr(S);//解密后的地址用作加密密码

            S := DCP_mars.EncryptString(S);//加密

            SendSocket(EncodeMessage(dMsg) + EncodeString(S)); //发送给登陆网关

Format('#1%s!', [{Code, } sendstr])



登陆网关解密 //DecodeBuf misc单元 其实和edcode单元的一样

nDeCodeLen := DecodeBuf(Addr, Len, nABuf);

解密分析后 再加密2次

Randomize();

          nRand := Random(High(Word));//得到一个随机数

          g_DCP_mars.InitStr(IntToStr(nRand));//把这个随机数作为加密的Key

          g_DCP_mars.Reset;

          szKey1 := EncodeString(g_DCP_mars.EncryptString(g_pszDecodeKey^));

g_pszDecodeKey就是网址作为加密密匙 //配置工具写入的

          m_wRandKey := Random(High(Word));//再次取得一个随机数



   Cmd.ident := SM_QUERYDYNCODE;

          Cmd.Recog := g_pLTCrc^;//logintool CRC 长度

          Cmd.param := nRand;//这是用于加密和解密的Key,但是需要转成String

          Cmd.tag := m_wRandKey;

          Cmd.Series := Length(szKey1);



          EncodeBuf(Integer(@Cmd), SizeOf(TCmdPack), Integer(@pszBuf[0]));//把Cmd加密,保存到pszBuf中

          EncodeBuf(Integer(@g_pszEndeBuffer[0]), g_nEndeBufLen, nBBuf);

          szSend := '#' + StrPas(@pszBuf[0]) + szKey1 + StrPas(PChar(nBBuf)) + '!';

返回客户端    m_tIOCPSender.SendData(m_pOverlapSend, @szSend[1], Length(szSend));



客户端全局消息处理函数处理

SM_QUERYDYNCODE

          g_bLoginKey^ := False;

          Str := Copy(body, 1, msg.series);

          Str := DecodeString(Str);

          DCP_mars.InitStr(IntToStr(msg.param));

          Str := DCP_mars.DecryptString(Str);

DCP_mars.InitStr('');

          Str := DCP_mars.DecryptString(Str);



          DCP_mars.InitStr(('sWebSite'));//解密密码

          Str2 := DCP_mars.DecryptString(g_pRcHeader.sWebSite);



          if CompareText(Str, Str2) = 0 then begin

            g_bLoginKey^ := True;

            g_pkeywords := NewStr('');

            g_pkeywords^ := IntToHex(msg.tag, 8);



            rdstr := Copy(body, msg.series + 1, Length(body) - msg.series);

            edBuf := FEndeBuffer;

            FillChar(edBuf^, 16 * 1024, #0);

            len := DecodeBuf(Integer(@rdstr[1]), Length(rdstr), Integer(edBuf));

            nFuncPos := Integer(@FEndeBuffer);



            //asm pushad end;

            ptrGetFunc := LPGETDYNCODE(nFuncPos);







cnsSelChr, cnsReSelChr 选择人物场景

            dMsg := MakeDefaultMsg(CM_QUERYSELCHARCODE, 0, 0, 0, 0);

            SendSocket(EncodeMessage(dMsg));//直接发送给selgate


声明:本文系互联网搜索而收集整理,不以盈利性为目的,文字、图文资料源于互联网且共享于互联网。
如有侵权,请联系 admin#1234f.com (#改@) 删除。