Need help to fix client connection menu

User Tag List

Results 1 to 5 of 5
  1. #1
    /dev/not/null's Avatar Member
    Reputation
    12
    Join Date
    Oct 2018
    Posts
    31
    Thanks G/R
    9/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help to fix client connection

    This is my python wow server emulator for 2.4.3. Currently client stucks on 'Connected' after SMSG_AUTH_RESPONSE.
    Help me please with debugging the problem.

    As I can see from wireshark client sends nothing after SMSG_AUTH_RESPONSE, but I wish it should send CMSG_CHAR_ENUM.
    Last edited by /dev/not/null; 11-21-2018 at 06:02 PM. Reason: typo

    Need help to fix client connection
  2. #2
    drolean's Avatar Member
    Reputation
    18
    Join Date
    Jan 2012
    Posts
    3
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i believe your problem is here wowcore/AuthSessionManager.py at 878f24ff0ad3f6776dcab6d2a42c659134b93f04 . sergio-ivanuzzo/wowcore . GitHub

    this packet must be transmitted with encrypt header

  3. Thanks /dev/not/null (1 members gave Thanks to drolean for this useful post)
  4. #3
    /dev/not/null's Avatar Member
    Reputation
    12
    Join Date
    Oct 2018
    Posts
    31
    Thanks G/R
    9/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by drolean View Post
    i believe your problem is here wowcore/AuthSessionManager.py at 878f24ff0ad3f6776dcab6d2a42c659134b93f04 . sergio-ivanuzzo/wowcore . GitHub

    this packet must be transmitted with encrypt header
    Unfortunately, even when encryption is set before SMSG_AUTH_RESPONSE, this not help. Client still stucks on 'Connected'.
    When I connecting, this output from wow client console:
    GRUNT: state: LOGIN_STATE_CONNECTING result: LOGIN_OK
    GRUNT: state: LOGIN_STATE_CONNECTED result: LOGIN_OK 127.0.0.1:3724
    GRUNT: state: LOGIN_STATE_AUTHENTICATING result: LOGIN_OK
    GRUNT: state: LOGIN_STATE_CHECKSUM result: LOGIN_OK
    GRUNT: state: LOGIN_STATE_HANDSHAKING result: LOGIN_OK
    GRUNT: state: LOGIN_STATE_AUTHENTICATED result: LOGIN_OK
    ClientConnection Initiating: COP_CONNECT code=CSTATUS_CONNECTING
    ClientConnection Completed: COP_CONNECT code=RESPONSE_CONNECTED result=TRUE
    ClientConnection Initiating: COP_AUTHENTICATE code=CSTATUS_AUTHENTICATING
    GRUNT: state: LOGIN_STATE_DISCONNECTED result: LOGIN_OK
    Client returns GRUNT: state: LOGIN_STATE_DISCONNECTED result: LOGIN_OK because LoginServer close connection after returning Realmlist.
    When I leave connection alive, wow client console returns next output:

    GRUNT: state: LOGIN_STATE_CONNECTING result: LOGIN_OK
    GRUNT: state: LOGIN_STATE_CONNECTED result: LOGIN_OK 127.0.0.1:3724
    GRUNT: state: LOGIN_STATE_AUTHENTICATING result: LOGIN_OK
    GRUNT: state: LOGIN_STATE_CHECKSUM result: LOGIN_OK
    GRUNT: state: LOGIN_STATE_HANDSHAKING result: LOGIN_OK
    GRUNT: state: LOGIN_STATE_AUTHENTICATED result: LOGIN_OK
    ClientConnection Initiating: COP_CONNECT code=CSTATUS_CONNECTING
    ClientConnection Completed: COP_CONNECT code=RESPONSE_CONNECTED result=TRUE
    ClientConnection Initiating: COP_AUTHENTICATE code=CSTATUS_AUTHENTICATING
    After that client hangs on 'Connected' too, but with another console output.
    Last edited by /dev/not/null; 11-23-2018 at 05:24 PM.

  5. #4
    /dev/not/null's Avatar Member
    Reputation
    12
    Join Date
    Oct 2018
    Posts
    31
    Thanks G/R
    9/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, after thinking and debugging I know what the reason now. Client stucks on 'Connected' because of my encryption alg is not correct. Python byte value should be in range of (0, 256), so my encryption code had to take this limitation. My code below:

    Code:
    class HeaderCrypt(object):
    
        ENCRYPT_HEADER_SIZE = 4
        DECRYPT_HEADER_SIZE = 6
    
        def __init__(self, session_key):
            self.session_key = session_key
            self.send_i = 0
            self.send_j = 0
            self.recv_i = 0
            self.recv_j = 0
    
        def encrypt(self, data):
            assert len(data) >= HeaderCrypt.ENCRYPT_HEADER_SIZE
            encrypted_header = [0] * HeaderCrypt.ENCRYPT_HEADER_SIZE
    
            for index in range(HeaderCrypt.ENCRYPT_HEADER_SIZE):
                enc = (data[index] ^ self.session_key[self.send_i]) + self.send_j
                enc %= 0x100
                encrypted_header[index] = self.send_j = enc
                self.send_i = (self.send_i + 1) % len(self.session_key)
    
            return bytes(encrypted_header) + data[HeaderCrypt.ENCRYPT_HEADER_SIZE:]
    
        def decrypt(self, data):
            assert len(data) >= HeaderCrypt.DECRYPT_HEADER_SIZE
            decrypted_header = [0] * HeaderCrypt.DECRYPT_HEADER_SIZE
    
            for index in range(self.DECRYPT_HEADER_SIZE):
                dec = (data[index] - self.recv_j) ^ self.session_key[self.recv_i]
                dec %= 0x100
                decrypted_header[index] = dec
                self.recv_j = data[index]
                self.recv_i = (self.recv_i + 1) % len(self.session_key)
    
            return bytes(decrypted_header) + data[HeaderCrypt.DECRYPT_HEADER_SIZE:]
    Now I'm trying to understand how to fix my alg. Any help would be appreciated.
    Last edited by /dev/not/null; 12-05-2018 at 01:06 PM.

  6. #5
    /dev/not/null's Avatar Member
    Reputation
    12
    Join Date
    Oct 2018
    Posts
    31
    Thanks G/R
    9/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Solved this! All I need (according to Mangos source code) is adding key generating:

    Code:
        def _generate_key(self, session_key):
            seed = b'8\xa7\x83\x15\xf8\x92%0q\x98g\xb1\x8c\x04\xe2\xaa'
            hashed = hmac.new(seed, session_key, sha1)
            return hashed.digest()
    This is the key for HeaderCrypt.
    Last edited by /dev/not/null; 12-11-2018 at 02:03 PM.

Similar Threads

  1. Replies: 3
    Last Post: 09-01-2016, 07:19 AM
  2. [WTH?] Funny bug about lua... yet i need help to fix it
    By Ellenor in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 02-26-2008, 09:42 AM
  3. need help to find some programs
    By Drakee in forum Community Chat
    Replies: 4
    Last Post: 05-01-2007, 07:58 AM
  4. Need help to change race
    By Kuth in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 03-27-2007, 07:07 AM
  5. need help to a pala Q
    By Spooch in forum World of Warcraft General
    Replies: 3
    Last Post: 01-11-2007, 05:35 AM
All times are GMT -5. The time now is 09:06 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search