[python] wow packet logging proxy menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    argh44z's Avatar Member
    Reputation
    19
    Join Date
    Nov 2007
    Posts
    93
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [python] wow packet logging proxy

    Hi folks, attached is a outdated (e.g, works w/ 3.0.x and hasn't been updated for 3.1.x as I don't play the game at the moment). Might give people some ideas for those interested in doing things at the packet level (the WorldPacketConsumer class might be the most useful).

    It is written in python. Implements a proxying Realm Server and a proxying World Server and decrypts a few types of packets (and logs the rest). It reads the session key directly from the wow process using ReadProcessMemory.

    When I re-up my account I might update it for 3.1, but till then hope it is useful for someone. I'd probably use libpcap/winpcap in the future.

    credits: kynox, author of sniffzit, boogieman
    Attached Files Attached Files

    [python] wow packet logging proxy
  2. Thanks Sixfeet (1 members gave Thanks to argh44z for this useful post)
  3. #2
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A little bit more on packets now, what you said was that for the 6 bytes that we send per packet, the 40-bit key is used. It would be like this:

    bits 0-6
    bits 7-12
    bits 13-18
    etc...

  4. #3
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not quite lanman92.

    Different packets have different headers.

    (Thanks to Clain for the following)
    Code:
    SMSG World: 4 bytes. (uint16 Len, uint16 Opcode,
    CMSG World: 6 bytes. (uint16 Len, uint16 Opcode, uint16 JunkBytes)
    
    SMSG Auth: 3 bytes. (byte Opcode, uint16 Len) ?
    CMSG Auth: 1 byte. (byte Opcode) ?
    A session key (which is the 20 bytes you're referring to) is sent somewhere during the logon process. Once that packet is sent, all subsequent packets are encrypted, and compressed using the 20 byte session key. The headers are never encrypted. (Or was it only the headers are encrypted? Bah...)

  5. #4
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've found the AuthSendPacket function. It's different from the normal sendpacket. Than you for clarifying this, Apoc. +rep

    EDIT: Btw, only the headers are encrypted, or else WPE would suck :P

    EDIT2: Doesn't this mean that the session key could be ripped from the login process?
    Last edited by lanman92; 06-05-2009 at 07:12 PM.

  6. #5
    BoogieManTM's Avatar Active Member
    Reputation
    52
    Join Date
    May 2008
    Posts
    193
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    Not quite lanman92.

    Different packets have different headers.

    (Thanks to Clain for the following)
    Code:
    SMSG World: 4 bytes. (uint16 Len, uint16 Opcode,
    CMSG World: 6 bytes. (uint16 Len, uint16 Opcode, uint16 JunkBytes)
    
    SMSG Auth: 3 bytes. (byte Opcode, uint16 Len) ?
    CMSG Auth: 1 byte. (byte Opcode) ?
    A session key (which is the 20 bytes you're referring to) is sent somewhere during the logon process. Once that packet is sent, all subsequent packets are encrypted, and compressed using the 20 byte session key. The headers are never encrypted. (Or was it only the headers are encrypted? Bah...)
    Send/Recv have their own individual 'index' of the key to track their progress, so it only applies to the direction of the packet. but you're correct, that CMSG's are 2 bytes longer (with the extra junk in the trunk thats useless)

    However, the session key is _never_ sent over the wire (not in any usable form, anyways). The session key is an HMAC sha1 of K in SRP6 implementation used for authentication (see: SRP: Design Specifications - though wow does reverse a few values, it's the same concept). Once you're connected to the world server, the server requests authentication, sending a seed, requesting a digest of your seed + the server seed and you're calculated K (for proofing purposes, of course). The client then sends the auth response with that digest, and any traffic after that (headers only), is encrypted.
    Last edited by BoogieManTM; 06-06-2009 at 02:50 AM.

  7. #6
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, what's the best way to store the packet? I thought about a class, but how would you store the header? unsigned char[]? That would be annoying to manually assign like that whenever I wanted a new packet though. More help is appreciated.

    EDIT: ehhhh,

    Code:
    struct Packet
    {
    public:
        uint16                opcode;
        uint16                size;
        uint16                junk;
        unsigned int        movementFlags;
        short                unk1;
        unsigned int        timestamp;
        float                x;
        float                y;
        float                z;
        float                orientation;
        unsigned int        unk2;
    };
    Last edited by lanman92; 06-06-2009 at 03:01 AM.

  8. #7
    BoogieManTM's Avatar Active Member
    Reputation
    52
    Join Date
    May 2008
    Posts
    193
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by lanman92 View Post
    So, what's the best way to store the packet? I thought about a class, but how would you store the header? unsigned char[]? That would be annoying to manually assign like that whenever I wanted a new packet though. More help is appreciated.

    EDIT: ehhhh,

    Code:
    struct Packet
    {
    public:
        uint16                opcode;
        uint16                size;
        uint16                junk;
        unsigned int        movementFlags;
        short                unk1;
        unsigned int        timestamp;
        float                x;
        float                y;
        float                z;
        float                orientation;
        unsigned int        unk2;
    };
    I use a variant of BinaryWriter in C# to build my packets. For C++ I use a ByteBuffer class, similar to wow's CDataStore. It's basically the same concept, an abstract class to manage a raw array of bytes. The ByteBuffer class (you can find it in Ascent's code, possibly mangos too) is just a utility class wrapped around a std::vector of bytes, appending appropriate based on size.

    So you would do something like this:

    Packet newPacket(OPCODE);
    newPacket << MovementFlags;
    newPacket << X;
    newPacket << Y;
    .... etc


    That way you have a generic container to build any packets you want. When i go to encrypt the header, you know any packet going out, you just encrypt the first 6 bytes of the data in that packet prior to it being sent out. I also calculate size just prior to encryption.

  9. #8
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Final question, does GetTickCount() return a valid number for the timestamp? or is it one of the other timing functions?

  10. #9
    namreeb's Avatar Legendary

    Reputation
    668
    Join Date
    Sep 2008
    Posts
    1,029
    Thanks G/R
    8/222
    Trade Feedback
    0 (0%)
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by lanman92 View Post
    Final question, does GetTickCount() return a valid number for the timestamp? or is it one of the other timing functions?
    I believe I have seen calls to GetTickCount() in my thus-far brief examination of the relevant code.

    Originally Posted by BoogieManTM View Post
    That way you have a generic container to build any packets you want. When i go to encrypt the header, you know any packet going out, you just encrypt the first 6 bytes of the data in that packet prior to it being sent out. I also calculate size just prior to encryption.
    Do you have your own encryption routine(s) or do you use WoW's? If the later, can you offer some guidance on locating it?

  11. #10
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Throw your packet into the base send function. It encrypts and everything. FOR YOU. Or you could make a packet using 0x8361B0. And then call send at 0x5F92F0. Look at any of the lua functions and their sub-calls. They call the first address a few times, and then call send. Neat stuff.

  12. #11
    namreeb's Avatar Legendary

    Reputation
    668
    Join Date
    Sep 2008
    Posts
    1,029
    Thanks G/R
    8/222
    Trade Feedback
    0 (0%)
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Which function do you mean by 'base send' function?

  13. #12
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    0x5F92F0 is send. It takes some class as a parameter. Look at my thread.

  14. #13
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by bierstud View Post
    I believe I have seen calls to GetTickCount() in my thus-far brief examination of the relevant code.
    My examinations of packet data have shown a few different time formats. One of the more common is a "milliseconds since sync" value. You'll see various [S/C]MSG_TIME_SYNC_REQUEST packets where the client and server basically agree upon a sync time that is a millisecond value. I've looked at the actual number and it doesn't make sense in any known format (epoch time, etc.), so it's most likely something that's only locally relevant, like milliseconds since some server was rebooted, or something. But that's not important, since you know the time when the sync response was sent, and you know the "magic number," and you know it's in milliseconds. You can do the math from there, for future packets, if you capture the sync response.

    Originally Posted by bierstud View Post
    Do you have your own encryption routine(s) or do you use WoW's? If the later, can you offer some guidance on locating it?
    You can encrypt/decrypt completely out of process. All you need are the client and server seeds, and the session key. Everything else is using standard cryptology methods available in just about every language. The seeds you can hardcode (do they ever change? doesn't matter since they're easy to find in the binary), and the session key you can just rip from memory. I've got it working in C# (with massive props to the sniffitzt guys, who produced the initial code, albeit in -- *shudder* -- java). I would release it, but I believe that that would technically be a DMCA "anti-circumvention" breach, and I really don't want to be sued.
    Don't believe everything you think.

  15. #14
    BoogieManTM's Avatar Active Member
    Reputation
    52
    Join Date
    May 2008
    Posts
    193
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by amadmonk View Post
    My examinations of packet data have shown a few different time formats. One of the more common is a "milliseconds since sync" value. You'll see various [S/C]MSG_TIME_SYNC_REQUEST packets where the client and server basically agree upon a sync time that is a millisecond value. I've looked at the actual number and it doesn't make sense in any known format (epoch time, etc.), so it's most likely something that's only locally relevant, like milliseconds since some server was rebooted, or something. But that's not important, since you know the time when the sync response was sent, and you know the "magic number," and you know it's in milliseconds. You can do the math from there, for future packets, if you capture the sync response.
    My understanding of the time_sync packets are just the server's way of verifying the client's system tick. Probably for use with checking to see if someone is altering their timestamps in movement packets, but not altering the time sync.

    In my clientless, all I'm sending for my CMSG_TIME_SYNC is the sequence id, and Environment.TickCount. server seems to be fine with that

  16. #15
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting... well that's certainly easier than the method I was using!
    Don't believe everything you think.

Page 1 of 2 12 LastLast

Similar Threads

  1. Connect to wow through a proxy server
    By stickcorporation in forum World of Warcraft Guides
    Replies: 19
    Last Post: 09-09-2012, 09:18 PM
  2. Playing WoW trough a proxy (when behind a school/work firewall)
    By Nero in forum World of Warcraft Guides
    Replies: 27
    Last Post: 01-29-2011, 01:41 PM
  3. [Mac Release] Python WoW API - Unfinished
    By flukes1 in forum WoW Memory Editing
    Replies: 0
    Last Post: 09-15-2009, 02:47 PM
  4. [How to] Play WoW with an Proxy
    By Arus in forum World of Warcraft Bots and Programs
    Replies: 19
    Last Post: 05-21-2009, 02:14 PM
  5. WoW packets.. where are they?
    By Stretch in forum World of Warcraft General
    Replies: 0
    Last Post: 01-28-2007, 01:54 PM
All times are GMT -5. The time now is 12:29 AM. 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