Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
NetworkMessage Creating a new
Results 1 to 9 of 9

Thread: NetworkMessage Creating a new

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    10

    NetworkMessage Creating a new [v860] LoginPacket

    In that code i have a exception.. my buffer always is 126 bytes long... so i have a diff of 2 between temp and usable area of buffer. Why i have that ? is a xteaKey Problem ? A protocol problem ? where is my mistake ?



    Here information about how i try make that instance.

    Code:
            //Rsa class
            public static bool RsaEncrypt(BigInteger e, BigInteger m, ref byte[] buffer, int position)
            {
     
                byte[] temp = new byte[128];
                try {
                    Array.Copy(buffer, position, temp, 0, 128);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("temp["+temp.Length+"] buffer["+(buffer.Length-position)+"]");
                    Console.WriteLine(ex.GetBaseException());
     
                }
                BigInteger input = new BigInteger(temp);
                BigInteger output = input.modPow(e, m);
                // it's sometimes possible for the results to be a byte short
                // and this can break some software so we 0x00 pad the result
                Array.Copy(GetPaddedValue(output), 0, buffer, position, 128);
     
         
                return true;
            }
     
            //NetworkMessage creator
     public static NetworkMessage Create(byte OS, ushort Version,
                byte[] Signatures, byte[] XteaKey, string AccountName, string Password, bool OpenTibia)
            {
                NetworkMessage msg = new NetworkMessage(149);
                msg.AddByte(0x95);
                msg.AddByte(0x00);
                msg.Position += 4;
                msg.AddByte(0x01);
                msg.AddUInt16(OS);
                msg.AddUInt16(Version);
                msg.AddBytes(Signatures);
                int offset = msg.Data.Length;
                int rsaStart = msg.Position;
                msg.AddByte(0x0);
                msg.AddBytes(XteaKey);
                msg.AddString(AccountName);
                msg.AddString(Password);
                int toAdd = 128 - (msg.Position - 6 - rsaStart);
                System.Console.WriteLine("offset " + offset + " rsaStart " + rsaStart + " " + toAdd);
                msg.RsaOTEncrypt(23);
                msg.AddAdler32();
                return msg;
            }
     
     
            byte[] xteaKey = new byte[16];
            rand.NextBytes(xteaKey);
            // Instancing a new NetworkMessage
            NetworkMessage networkMessage = LoginServerRequestPacket.Create(
                (byte)2,     // SO Version
                (ushort)860, // Tibia Version
                (new byte[12]{0x7A,0x60,0x3D,0x49,0x7C,0x4E,0x3D,0x49,0x78,0x41,0x14,0x49}), // Signature is Right ?
                xteaKey,    // key generate above
                "1",        //user
                "1",        //passwd
                true        // OpenTibia
                );

    Topics unsolved about login protocol.

    http://tpforums.org/forum/threads/48...ddPaddingBytes
    http://tpforums.org/forum/threads/47...ddPaddingBytes


    I really dont have any reference to that problem.
    { Remember that code dont use client it is not a possibility }
    Last edited by vincity; 12-05-2014 at 05:03 AM. Reason: Code pasted in topic [ removed pastebin ]

  2. #2
    Junior Member
    Join Date
    Sep 2009
    Posts
    10
    bring up my post

  3. #3
    Junior Member
    Join Date
    Sep 2009
    Posts
    10
    bring up my post

  4. #4
    Junior Member
    Join Date
    Sep 2009
    Posts
    10
    bring up my post

  5. #5
    Junior Member
    Join Date
    Sep 2009
    Posts
    10
    bring up my post

  6. #6
    Try that.
    Code:
    NetworkMessage msg = new NetworkMessage(0x94);
    msg.AddByte(0x94); // implementing msg.SetSize() instead of calculating by yourself would be better
    msg.AddByte(0x00);
    msg.Position += 4;
    //msg.AddByte(0x01); ? 
    msg.AddUInt16(OS);
    msg.AddUInt16(Version);
    msg.AddBytes(Signatures);
    int offset = msg.Data.Length;
    int rsaStart = msg.Position;
    msg.AddByte(0x0);
    msg.AddBytes(XteaKey);
    msg.AddString(AccountName);
    msg.AddString(Password);
    int toAdd = 128 - (msg.Position - rsaStart);
    System.Console.WriteLine("offset " + offset + " rsaStart " + rsaStart + " " + toAdd);
    msg.RsaOTEncrypt(rsaStart);
    msg.AddAdler32();
    Hard to tell without rest of code, also this may help you
    https://github.com/opentibia/server/...tocollogin.cpp
    Last edited by Cater; 11-10-2014 at 12:31 PM.

  7. #7
    Junior Member
    Join Date
    Sep 2009
    Posts
    10
    im using default clientless class from tibia api with some modifications in tibiaapi class ( for understand how in 8 60 login. )


    I will post here.. ( that project is focused in debuging so have some ugly things )

    Here project..
    @Cater
    https://mega.co.nz/#!QchgFCKT!khL6-R...s1Q_rRClOeg6Yo

  8. #8

  9. #9
    Junior Member
    Join Date
    Sep 2009
    Posts
    10
    It working O:
    I will check what i do wrong..

    Thnkx bro you help me alot


    Now I will try understand gameServer join packets omg..
    Last edited by vincity; 11-11-2014 at 07:04 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •