Login Status


ShareSource Site » Projects » sniffitzt » sniffitztWiki

Project: sniffitzt - a wow logging proxy [Wiki]

(*) Summary   [^] Files   [^] Screenshots   [_] Wiki   [!] Bug Tracker  
(») Mercurial Repository  
Project Wiki (Page: XorAlgorithm)
Last Changed 7 months ago, by arrai

Xor Algorithm

The header of (almost) each packet is encrypted using the following algorithm:

class HeaderEncryption
{
    private int headerSize, keyIndex, prevEncrypted;
    private byte[] sessionKey;

    HeaderEncryption(byte[] sessionKey, int headerSize)
    {
        // headerSize is either 2 or 4
        this.sessionKey = sessionKey;
        this.headerSize = headerSize;
    }

    public void encryptHeader(byte[] packet)
    {
        for (int t = 0; t < headerSize; t++)
        {   
            keyIndex %= sessionKey.length;
            uint8 x = (packet[t] ^ sessionKey[keyIndex]) + prevEncrypted;
            ++keyIndex;
            prevEncrypted = x;
            packet[t] = x;
        } 
    }
}

For an explanation of the cryptographic attack this sniffer performs on the packets, have a look at sessionkey decryption.