Zodiac - Tantra Development Reboot

Page 3 of 3 FirstFirst 123
Results 31 to 38 of 38
  1. #31
    Programmer cyberinferno is offline
    True MemberRank
    Jun 2009 Join Date
    BangaloreLocation
    562Posts

    Re: Zodiac - Tantra Development Reboot

    Quote Originally Posted by master_unknown View Post
    Nope, I dont know anything about that.
    Thanks. When you have time please take a look at k3 server source which was released long back. It has packet building and reading logic. Packet reading and building logic is available. I quite didn't understand the logic as I am not an expert in C++.

  2. #32
    Red subscription Reaguee is offline
    SubscriberRank
    Jan 2011 Join Date
    68Posts

    Re: Zodiac - Tantra Development Reboot

    @cyberinferno: if i understand you, what you want to know is: how the data is transfer from client to server and viceversa. If that is what you want to know, then here is a brief explanation.

    Lets start by saying that almost all packets from client and server are encrypted with and algorithm made by hanbit, That algorithm use a 1024 char array to encrypt/decrypt pakets.
    Do you remember that thread where someone said "change the [jo]" to bind the client to the server? if so, i will say that that "jo" is just 2 bytes of the 1024 char array used to encrypt/decrypt the packet.

    Because you are c# programmer as I am, I will show u part of my code that is the c++ translation:


    that is part of the code used by the client & server to encrypt packets, where:
    ClientKey is the 1024 char array, as you may see client and server will take different start point of that array based on the stored oldchecksum and so on.
    the first 12 bytes of the packet, will not be encrypted, because those bytes stores the message code, the checksum, and the time stamp of the message.
    If for example the client fails to receive a response from the server, client will try to send the packet again, but, this 2do time the packet will not be the same, because the oldchecksum will not longer be 0 so the other stored vars.

    to really understand how it works you have to do some like I did, make a hook on the client & server "send/recv" functions from WS2_32 dll, and then have fun with the reverse engineering, will be easy for you since you have the c++ source.

    BTW the CPSock class didnt change at all from the sources you have til now days so that class is not outdated as you said in your other thread. The classes outdated are HTNetWorkHandle & TNNetworkManager coz they added more functions on them.

    P.D I didnt show you the c# version of the ReadClientMessage function because it is allmost correctly explained in your other thread (at least the logic of it by @Nothilvien he/she have some errors but just because he/she is just explaining the code you posted w/o having for that time the whole class on his/her hands)
    Last edited by Reaguee; 30-07-18 at 08:42 PM.

  3. #33
    Programmer cyberinferno is offline
    True MemberRank
    Jun 2009 Join Date
    BangaloreLocation
    562Posts

    Re: Zodiac - Tantra Development Reboot

    Quote Originally Posted by Reaguee View Post
    @cyberinferno: if i understand you, what you want to know is: how the data is transfer from client to server and viceversa. If that is what you want to know, then here is a brief explanation.

    Lets start by saying that almost all packets from client and server are encrypted with and algorithm made by hanbit, That algorithm use a 1024 char array to encrypt/decrypt pakets.
    Do you remember that thread where someone said "change the [jo]" to bind the client to the server? if so, i will say that that "jo" is just 2 bytes of the 1024 char array used to encrypt/decrypt the packet.

    Because you are c# programmer as I am, I will show u part of my code that is the c++ translation:


    that is part of the code used by the client & server to encrypt packets, where:
    ClientKey is the 1024 char array, as you may see client and server will take different start point of that array based on the stored oldchecksum and so on.
    the first 12 bytes of the packet, will not be encrypted, because those bytes stores the message code, the checksum, and the time stamp of the message.
    If for example the client fails to receive a response from the server, client will try to send the packet again, but, this 2do time the packet will not be the same, because the oldchecksum will not longer be 0 so the other stored vars.

    to really understand how it works you have to do some like I did, make a hook on the client & server "send/recv" functions from WS2_32 dll, and then have fun with the reverse engineering, will be easy for you since you have the c++ source.

    BTW the CPSock class didnt change at all from the sources you have til now days so that class is not outdated as you said in your other thread. The classes outdated are HTNetWorkHandle & TNNetworkManager coz they added more functions on them.

    P.D I didnt show you the c# version of the ReadClientMessage function because it is allmost correctly explained in your other thread (at least the logic of it by @Nothilvien he/she have some errors but just because he/she is just explaining the code you posted w/o having for that time the whole class on his/her hands)
    If you have converted encryption/decryption algorithm in C# please share!

  4. #34
    Red subscription Reaguee is offline
    SubscriberRank
    Jan 2011 Join Date
    68Posts

    Re: Zodiac - Tantra Development Reboot

    I'm start thinking that you don't like to code by yourself at all.

    I already shared with you how client and server encrypts the packet, the decryption is done in the opposite way :
    for (int i = 12; i < Size; i++, pos++)
    {
    int rst = pos % 1024;
    var Trans = ClientKey[2 * rst + KeywordFlag];
    int mod = i & 0x3;
    if (mod == 0) pMsg[i] = (byte)(pMsg[i] - (Trans << 2));
    if (mod == 1) pMsg[i] = (byte)(pMsg[i] + (Trans >> 1));
    if (mod == 2) pMsg[i] = (byte)(pMsg[i] - (Trans << 1));
    if (mod == 3) pMsg[i] = (byte)(pMsg[i] + (Trans >> 2));
    Sum += pMsg[i];
    }
    of course the dif is that the Sum of the byte values (which is the CheckSum) on the decrypt is done after the packet is decrypted, so it can be compared with the one that client sent on the 3rd byte of the buffer: pRecvBuffer[nProcPosition + 3].

    BTW if you still on the C# emulator, then I will recommend you to start understanding c++, so you can convert the code. And as I said in my previous post, hook a send & recv functions of the WS2_32 dll, or hook ReadClientMessage & AddClientMessage from CPSock so you can see the packet before and after the encryption/decryption
    Last edited by Reaguee; 31-07-18 at 08:05 AM.

  5. #35
    Programmer cyberinferno is offline
    True MemberRank
    Jun 2009 Join Date
    BangaloreLocation
    562Posts

    Re: Zodiac - Tantra Development Reboot

    Quote Originally Posted by Reaguee View Post
    I'm start thinking that you don't like to code by yourself at all.

    I already shared with you how client and server encrypts the packet, the decryption is done in the opposite way :
    for (int i = 12; i < Size; i++, pos++)
    {
    int rst = pos % 1024;
    var Trans = ClientKey[2 * rst + KeywordFlag];
    int mod = i & 0x3;
    if (mod == 0) pMsg[i] = (byte)(pMsg[i] - (Trans << 2));
    if (mod == 1) pMsg[i] = (byte)(pMsg[i] + (Trans >> 1));
    if (mod == 2) pMsg[i] = (byte)(pMsg[i] - (Trans << 1));
    if (mod == 3) pMsg[i] = (byte)(pMsg[i] + (Trans >> 2));
    Sum += pMsg[i];
    }
    of course the dif is that the Sum of the byte values (which is the CheckSum) on the decrypt is done after the packet is decrypted, so it can be compared with the one that client sent on the 3rd byte of the buffer: pRecvBuffer[nProcPosition + 3].

    BTW if you still on the C# emulator, then I will recommend you to start understanding c++, so you can convert the code. And as I said in my previous post, hook a send & recv functions of the WS2_32 dll, or hook ReadClientMessage & AddClientMessage from CPSock so you can see the packet before and after the encryption/decryption
    You think I didn't try? I tried and failed so asked. Maybe I should make this encryption part a dll and use.

    If you feel I don't code you probably check my github account https://github.com/cyberinferno which has tools like https://github.com/cyberinferno/tant...hark-dissector

  6. #36
    Red subscription Reaguee is offline
    SubscriberRank
    Jan 2011 Join Date
    68Posts

    Re: Zodiac - Tantra Development Reboot

    May I know why you said you failed? I mean..are you getting some kind of response from Zone when you send your packet with your emulator? if you don't receive a response, have you check what the Zone logs registered?

  7. #37
    Programmer cyberinferno is offline
    True MemberRank
    Jun 2009 Join Date
    BangaloreLocation
    562Posts

    Re: Zodiac - Tantra Development Reboot

    Quote Originally Posted by Reaguee View Post
    May I know why you said you failed? I mean..are you getting some kind of response from Zone when you send your packet with your emulator? if you don't receive a response, have you check what the Zone logs registered?
    When I sent reply packets to client, the client just got stuck. It did not show server selection screen.

  8. #38
    Red subscription Reaguee is offline
    SubscriberRank
    Jan 2011 Join Date
    68Posts

    Re: Zodiac - Tantra Development Reboot

    A cording to your post, are you saying that you send a packet from Zone Server to the client, when the client hits OK on the Login window?

    I don't know if you already know this, if not hope helps:
    After you type your account id and password and hit OK, client send a request to the Login Server (not to the zone server) and receive a response with a code which defines if the login was success or not, then client set g_iLoginResultID == to the response which then makes the StateMachine tell to HTIntroManager to move on to the Server Select window IF and ONLY IF g_iLoginResultID ==1.

    As you may see, moving to the server select window, is NOT managed by an encrypted response from the zone server.

    LOGIN server does not encrypt packets.



Page 3 of 3 FirstFirst 123

Advertisement