XOR ingame

07/15/2017 19:53 player7x9x#1
Hey there,
does anybody know the latest XOR ingame?
I tried every key from 0 to 255 but it isnt working.
Thanks in advance!
07/16/2017 03:48 +Yazzn#2
0xC0 is the key I got from the encryption/decryption routines but from what I can see they've changed the way the packets are being encoded.
07/24/2017 14:52 Sleutel#3
Quote:
Originally Posted by znoeen View Post
Warrock stoped sending ascii packets. But sending a byte array with datatypes.
Still looking into a way to convert it to the original ascii or a way to handle these packets.
Any help would be welcome :)
Code:
    public static class Dump
    {
        private static string DumpToString(byte[] buffer, int bytesPerLine = 16)
        {
            if (buffer == null)
                return "<null>";

            const int firstHexColumn = 11; // 8 characters for the address & 3 spaces

            var bytesLength = buffer.Length;
            var hexChars = "0123456789ABCDEF".ToCharArray();
            var firstCharColumn = firstHexColumn
                                  + bytesPerLine * 3       // - 2 digit for the hexadecimal value and 1 space
                                  + (bytesPerLine - 1) / 8 // - 1 extra space every 8 characters from the 9th
                                  + 2;                  // 2 spaces 

            var lineLength = firstCharColumn
                             + bytesPerLine           // - characters to show the ascii value
                             + Environment.NewLine.Length; // Carriage return and line feed (should normally be 2)

            var line = (new string(' ', lineLength - Environment.NewLine.Length) + Environment.NewLine).ToCharArray();
            var expectedLines = (bytesLength + bytesPerLine - 1) / bytesPerLine;
            var result = new StringBuilder(expectedLines * lineLength);

            for (var i = 0; i < bytesLength; i += bytesPerLine)
            {
                line[0] = hexChars[(i >> 28) & 0xF];
                line[1] = hexChars[(i >> 24) & 0xF];
                line[2] = hexChars[(i >> 20) & 0xF];
                line[3] = hexChars[(i >> 16) & 0xF];
                line[4] = hexChars[(i >> 12) & 0xF];
                line[5] = hexChars[(i >> 8) & 0xF];
                line[6] = hexChars[(i >> 4) & 0xF];
                line[7] = hexChars[(i >> 0) & 0xF];

                var hexColumn = firstHexColumn;
                var charColumn = firstCharColumn;

                for (var j = 0; j < bytesPerLine; j++)
                {
                    if (j > 0 && (j & 7) == 0)
                        hexColumn++;

                    if (i + j >= bytesLength)
                    {
                        line[hexColumn] = ' ';
                        line[hexColumn + 1] = ' ';
                        line[charColumn] = ' ';
                    }
                    else
                    {
                        var b = buffer[i + j];
                        line[hexColumn] = hexChars[(b >> 4) & 0xF];
                        line[hexColumn + 1] = hexChars[b & 0xF];
                        line[charColumn] = b < 32 ? '·' : (char)b;
                    }

                    hexColumn += 3;
                    charColumn++;
                }

                result.Append(line);
            }

            return result.ToString();
        }

        [Conditional("DEBUG")]
        public static void PrintBuffer(string comment, byte[] buffer)
        {
            Console.WriteLine();
            Console.WriteLine(comment);
            Console.WriteLine(DumpToString(buffer));
        }
    }
07/28/2017 17:14 znoeen#4
Quote:
Originally Posted by Sleutel View Post
Code:
    public static class Dump
    {
        private static string DumpToString(byte[] buffer, int bytesPerLine = 16)
        {
            if (buffer == null)
                return "<null>";

            const int firstHexColumn = 11; // 8 characters for the address & 3 spaces

            var bytesLength = buffer.Length;
            var hexChars = "0123456789ABCDEF".ToCharArray();
            var firstCharColumn = firstHexColumn
                                  + bytesPerLine * 3       // - 2 digit for the hexadecimal value and 1 space
                                  + (bytesPerLine - 1) / 8 // - 1 extra space every 8 characters from the 9th
                                  + 2;                  // 2 spaces 

            var lineLength = firstCharColumn
                             + bytesPerLine           // - characters to show the ascii value
                             + Environment.NewLine.Length; // Carriage return and line feed (should normally be 2)

            var line = (new string(' ', lineLength - Environment.NewLine.Length) + Environment.NewLine).ToCharArray();
            var expectedLines = (bytesLength + bytesPerLine - 1) / bytesPerLine;
            var result = new StringBuilder(expectedLines * lineLength);

            for (var i = 0; i < bytesLength; i += bytesPerLine)
            {
                line[0] = hexChars[(i >> 28) & 0xF];
                line[1] = hexChars[(i >> 24) & 0xF];
                line[2] = hexChars[(i >> 20) & 0xF];
                line[3] = hexChars[(i >> 16) & 0xF];
                line[4] = hexChars[(i >> 12) & 0xF];
                line[5] = hexChars[(i >> 8) & 0xF];
                line[6] = hexChars[(i >> 4) & 0xF];
                line[7] = hexChars[(i >> 0) & 0xF];

                var hexColumn = firstHexColumn;
                var charColumn = firstCharColumn;

                for (var j = 0; j < bytesPerLine; j++)
                {
                    if (j > 0 && (j & 7) == 0)
                        hexColumn++;

                    if (i + j >= bytesLength)
                    {
                        line[hexColumn] = ' ';
                        line[hexColumn + 1] = ' ';
                        line[charColumn] = ' ';
                    }
                    else
                    {
                        var b = buffer[i + j];
                        line[hexColumn] = hexChars[(b >> 4) & 0xF];
                        line[hexColumn + 1] = hexChars[b & 0xF];
                        line[charColumn] = b < 32 ? '·' : (char)b;
                    }

                    hexColumn += 3;
                    charColumn++;
                }

                result.Append(line);
            }

            return result.ToString();
        }

        [Conditional("DEBUG")]
        public static void PrintBuffer(string comment, byte[] buffer)
        {
            Console.WriteLine();
            Console.WriteLine(comment);
            Console.WriteLine(DumpToString(buffer));
        }
    }
Very Nice man! Thank you so much for sharing this.