Announcement

Collapse
No announcement yet.

Proxy related question

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Proxy related question

    So, after about almost 5 years of being retired, my friends made me came back to play for a while, and it kinda made me came back to programming some ahaha, so I decided I wanted to go for a proxy for the latest Tibia version (10.96) and while it looked almost ready to use on the real servers, I keep receiving this weird error message "Login failed due corrupt data", I'm pretty sure my RSA de/encryption functions are working correctly, mainly because while requesting and sending the login packet I would get no error whatsoever.

    My code kinda looks like this:

    Client > clientProxy = RequestLoginPacket()->Parse, Decrypt with OT_Rsakey & Encrypt back with Cip_RsaKey and sent to the server
    Server > serverProxy = getCharacterList()->Parse, Decrypt with xtea key obtained above, made custom character list packet with modified login servers, encrypt them and then sent to the client

    Client > clientProxy = Got a 14 bytes minus header as response and forward that to the real server
    PHP Code:
    0C 00 E5 01 E2 05 7B C3 CB F0 2A DB 1F 98 
    Server > serverProxy = Got a 46 bytes minus header, which seems to be an error code.

    PHP Code:
    2C 00 2A 18 AF FB 24 00 14 21 00 4C 6F 67 69 6E 20 66 61 69 6C 65 64 20 64 75 65 20 74 6F 20 63 6F 72 72 75 70 74 20 64 61 74 61 2E 20 E0 
    I'm not sure where I could be going wrong, since I don't think there would be a problem sending a custom character list packet to the client, since if it would parse it correctly then no problem, right?

    This is the structure used for the making of the custom packet:

    PHP Code:
    uint16 full_size
    uint32 adler_checksum
    byte 0x14 MotD_packet_type
    uint16 string_length string_size
    bytes
    [string_lengthstring

    byte 0x64 char_list_packet_type
    byte servers_count

    foreach servers_count

    byte world
    .id
    uint16 string_length world_str_len
    bytes
    [string_lengthworld_name
    uint16 string_length ip_str_len
    bytes
    [string_lengthip_hostname
    ushort port
    byte isPreview

    end

    byte character_count

    foreach character_count

    byte world
    .id
    uint16 string_length char_name_len
    bytes
    [string_lengthchar_name

    end

    byte premium_status
    uint32 premium_timestamp 
    Any help or pointers would be greatly appreciated!

    Thanks
    Last edited by Diego; 19-07-2016, 11:40 PM.

  • #2
    Soooo... Apparently I had to add the session key sent during the login request, I added it to the parser routine and then I started getting in-game data

    PHP Code:
    case 0x28//session key
           
    ePacket.addByte(p.packetType);
           
    string session_key p.read_string();
           
    ePacket.addString(session_key);
           
    Console.WriteLine("Session Key: " session_key);
    break; 

    Comment

    Working...
    X