Can someone help me get started on writing a 1.12.1 core? menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    SolitudeGaming's Avatar Member
    Reputation
    2
    Join Date
    Sep 2017
    Posts
    17
    Thanks G/R
    4/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can someone help me get started on writing a 1.12.1 core?

    Hello!

    First off, I know there are already emulators written for this version. I'm not looking for one pre-built. I'm trying to take this on as a learning experience. Anyways...
    I've been trying for a few days to do this on my own, but I'm greatly lost when it comes to SRP6. I just can't seem to wrap my head around the password verifier and generation methods, mainly the ones for SMSG_Logon_Challenge. I've tried reading code and using various resources but I've come up with nothing. If anyone could give me a hand on how I should get started, that would be appreciated

    EDIT: I've also tried reading through this thread: SRP6 and WoW Authentication Process but again, I've come up with absolutely nothing.

    Can someone help me get started on writing a 1.12.1 core?
  2. #2
    Glusk's Avatar Contributor
    Reputation
    105
    Join Date
    Apr 2015
    Posts
    33
    Thanks G/R
    7/32
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why don't you share some code and I'll try to fix it for you.

  3. #3
    SolitudeGaming's Avatar Member
    Reputation
    2
    Join Date
    Sep 2017
    Posts
    17
    Thanks G/R
    4/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Glusk View Post
    Why don't you share some code and I'll try to fix it for you.
    No problem! I deleted most of what I had so I'll have to re-type it out. Also, I'll be including various sources such as the BigInteger wrapper that I believe king48488 wrote.

    /EDIT: I should mention that when I try to view the transmission of packets through the network through Wireshark, I notice the server sent a malformed packet and the client gets disconnected from the server. Give me time to re-write the code I had
    Last edited by SolitudeGaming; 09-07-2017 at 02:15 PM.

  4. #4
    SolitudeGaming's Avatar Member
    Reputation
    2
    Join Date
    Sep 2017
    Posts
    17
    Thanks G/R
    4/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, here is everything:

    The image of the packet captured in Wireshark:
    Can someone help me get started on writing a 1.12.1 core?-c65062e7acbb9b313490f5cdefa12123-gif

    My "PacketMSGLogonChallenge" code:
    Code:
    using Solitude.Lib.Util;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Numerics;
    using System.Security.Cryptography;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Solitude.Lib.Packets
    {
        /** Handles: CMSG/SMSG Logon Challenge **/
        public class PacketMSGLogonChallenge : IPacket
        {
            private BigInteger N = BigInteger.Parse("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", System.Globalization.NumberStyles.HexNumber); // modulus
            private byte[] Salt;
            private byte[] B; // server public
            private byte[] b; // server private
            private BigInteger g = new BigInteger(new byte[] { 7 }); // generator
            private BigInteger k = new BigInteger(new byte[] { 3 }); // multiplier
            private BigInteger v; // verifier
    
            public override void readPacket(Connection connection)
            {
                using (var stream = new MemoryStream(connection.clientData))
                {
                    using (var br = new BinaryReader(stream))
                    {
                        var packetId = br.ReadByte(); // 0x00
                        var error = br.ReadByte(); // 8 for wotlk, 3 for vanilla?
    
                        var size = br.ReadByte();
                        var gamename = Encoding.ASCII.GetString(br.ReadBytes(4)).Remove(0, 1);
                        br.ReadByte(); // 0?
                        var majorVersion = br.ReadByte(); // 3
                        var minorVersion = br.ReadByte(); // 3
                        var alphaVersion = br.ReadByte(); // 5
    
                        var build = br.ReadUInt16(); // 12340
                        var platform = Encoding.ASCII.GetString(br.ReadBytes(4)).Remove(3); // x86
                        var os = Encoding.ASCII.GetString(br.ReadBytes(4)).Remove(3); // Win
                        var country = Encoding.ASCII.GetString(br.ReadBytes(4)); // enGB/enUS
    
                        br.ReadBytes(4); // timezone stuff?
    
                        var ip = br.ReadBytes(4); // 10.0.0.20
                        var i_len = br.ReadByte(); // 8
                        var i = Encoding.ASCII.GetString(br.ReadBytes(i_len)); // Xolitude
    
                        connection.Username = i;
                        connection.IP = string.Format("{0}.{1}.{2}.{3}", ip[0], ip[1], ip[2], ip[3]);
                        connection.Build = build;
                    }
                }
                Logger.Log(string.Format("{0} is attempting to login...", connection.Username));
    
                connection.sendPacket(this);
            }
    
            public override void writePacket(Connection connection)
            {
                var sha1 = SHA1.Create();
    
                /** Generate random bytes for Salt and b **/
                Salt = new byte[32];
                b = new byte[19];
                var crcBytes = new byte[16];
    
                using (var crypto = new RNGCryptoServiceProvider())
                {
                    crypto.GetBytes(Salt);
                    crypto.GetBytes(b);
                    crypto.GetBytes(crcBytes);
                }
    
                /** Get the BigInteger value for salt and b **/
                var saltBI = Utils.makeBigInteger(Salt);
                var bBI = Utils.makeBigInteger(b);
    
                var p = Encoding.UTF8.GetBytes(connection.Username + ":" + "testpass");
                var x = Utils.makeBigInteger(sha1.ComputeHash(Utils.combineData(Salt, sha1.ComputeHash(p))));
    
                /** get v **/
                v = BigInteger.ModPow(g, x, N);
    
                /** calc B **/
                B = Utils.GetBytes(((k * v + BigInteger.ModPow(g, bBI, N)) % N).ToByteArray());
    
                using (var bw = new BinaryWriter(connection.clientStream))
                {
                    bw.Write(Global.SMSG_LOGON_CHALLENGE);
                    bw.Write((byte)0);
                    bw.Write((byte)0);
                    bw.Write(B);
                    bw.Write((byte)g.ToByteArray().Length);
                    bw.Write(g.ToByteArray());
                    bw.Write((byte)N.ToByteArray().Length);
                    bw.Write(N.ToByteArray());
                    bw.Write(Salt);
                    bw.Write(crcBytes);
                    bw.Flush();
                }
            }
        }
    }
    The Utils class code:
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Numerics;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Solitude.Lib.Util
    {
        public class Utils
        {
            public static BigInteger makeBigInteger(byte[] data)
            {
                return new BigInteger(combineData(data, new byte[1]));
            }
    
            public static byte[] combineData(byte[] data, byte[] data2)
            {
                byte[] combined = new byte[data.Length + data2.Length];
                combined = data.Concat(data2).ToArray();
                return combined;
            }
    
            public static byte[] GetBytes(byte[] data, int count = 32)
            {
                if (data.Length == count)
                    return data;
    
                var bytes = new byte[count];
    
                Buffer.BlockCopy(data, 0, bytes, 0, 32);
    
                return bytes;
            }
        }
    }
    And as I said, in Wireshark, the packet from the server appears as a "Malformed" packet. I've tried converting the various byte[] arrays to BigIntegers and sending those byte arrays, I still get the same problem. The size of the packet the server is sending is 118 by the way. If you need anything else let me know. I'm not entirely knowledgeable with SRP6 but it's always been a passion of mine to write my own WoW core and I feel like it can be done with your guys' help

    /EDIT: I don't have any database structure or information as of yet. I don't save any password or store anything. Could this be the issue?

  5. #5
    Glusk's Avatar Contributor
    Reputation
    105
    Join Date
    Apr 2015
    Posts
    33
    Thanks G/R
    7/32
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Packets.cs * GitHub

    Edit: There could be an error when sending N (modulus). I've added an extra zero byte to make it positive, so the byte array is 1 byte longer. I would have fixed it better if I got some code I could test by running it.
    Last edited by Glusk; 09-08-2017 at 05:34 AM.

  6. #6
    SolitudeGaming's Avatar Member
    Reputation
    2
    Join Date
    Sep 2017
    Posts
    17
    Thanks G/R
    4/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've tried adding that zero on the end before. I tried using the code you posted, still instant disconnect and malformed packet I'll post my sauce in a moment!

    /EDIT:
    SolitudeCore.rar Here's my source make sure you add your IP in Global.cs
    Last edited by SolitudeGaming; 09-08-2017 at 09:42 AM.

  7. #7
    Glusk's Avatar Contributor
    Reputation
    105
    Join Date
    Apr 2015
    Posts
    33
    Thanks G/R
    7/32
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check my gist again - added the fix. It appears that BinaryWriter is sending bytes over on every write. It works if you wrap all the packet bytes in one array and send it.

  8. Thanks SolitudeGaming (1 members gave Thanks to Glusk for this useful post)
  9. #8
    SolitudeGaming's Avatar Member
    Reputation
    2
    Join Date
    Sep 2017
    Posts
    17
    Thanks G/R
    4/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hm.. Well, I'm no longer getting a malformed packet in Wireshark, but the client still gets instantly disconnected and does not send the client_proof_logon packet

  10. #9
    Glusk's Avatar Contributor
    Reputation
    105
    Join Date
    Apr 2015
    Posts
    33
    Thanks G/R
    7/32
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was just looking at the challenge code.

  11. #10
    SolitudeGaming's Avatar Member
    Reputation
    2
    Join Date
    Sep 2017
    Posts
    17
    Thanks G/R
    4/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, thanks for what you've done so far I'll work on trying to figure out why the client isn't send their proof.

  12. #11
    Glusk's Avatar Contributor
    Reputation
    105
    Join Date
    Apr 2015
    Posts
    33
    Thanks G/R
    7/32
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im not really a c# expert. Maybe the using block is closing not only your BinaryWriter but also ur connection stream.

  13. Thanks SolitudeGaming (1 members gave Thanks to Glusk for this useful post)
  14. #12
    SolitudeGaming's Avatar Member
    Reputation
    2
    Join Date
    Sep 2017
    Posts
    17
    Thanks G/R
    4/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Holy shit! I hadn't even thought of that and I've been using C# for years xD I guess I just lack a bit in the networking department.

    I changed the code to this, thinking maybe the using block was indeed blocking/closing the stream and bam:
    Code:
    var memStr = new MemoryStream(119);
    
                using (var bw = new BinaryWriter(memStr))
                {
                    byte[] result = new byte[0]
                    .Concat(new byte[] { Global.SMSG_LOGON_CHALLENGE, 0, 0 })
                    .Concat(Utils.GetBytes(B))
                    .Concat(new byte[] { 1, 7, 32 })
                    .Concat(Utils.GetBytes(N.ToByteArray()))
                    .Concat(Salt)
                    .Concat(crcBytes)
                    .Concat(new byte[] { 0 })
                    .ToArray();
    
                    bw.Write(result);
                    bw.Flush();
                }
    
                connection.clientStream.Write(memStr.GetBuffer(), 0, memStr.GetBuffer().Length);
                connection.clientStream.Flush();
    I now receive the client_logon_proof

  15. #13
    Glusk's Avatar Contributor
    Reputation
    105
    Join Date
    Apr 2015
    Posts
    33
    Thanks G/R
    7/32
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps you can even ditch these concatenations that I've added, since you're now writing to the memory stream first.
    Last edited by Glusk; 09-08-2017 at 01:56 PM.

  16. Thanks SolitudeGaming (1 members gave Thanks to Glusk for this useful post)
  17. #14
    SolitudeGaming's Avatar Member
    Reputation
    2
    Join Date
    Sep 2017
    Posts
    17
    Thanks G/R
    4/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    May I ask you why you changed the N value? Did it make any difference?

  18. #15
    Glusk's Avatar Contributor
    Reputation
    105
    Join Date
    Apr 2015
    Posts
    33
    Thanks G/R
    7/32
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you add a zero in front, the integer will become positive. Otherwise it's negative in this case.

Page 1 of 2 12 LastLast

Similar Threads

  1. can someone help me get a worgen skin for my cat form on Nostalrius
    By Shackus in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 09-08-2015, 05:18 PM
  2. Can someone help me get a Wow CD Key
    By Napapoba in forum WoW Scams Help
    Replies: 1
    Last Post: 11-05-2008, 10:20 PM
  3. Can someone help me get BGs to work
    By onesbronson in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 07-17-2008, 07:08 PM
  4. Can someone help me get onto a WoW private server?
    By hyacary in forum Gaming Chat
    Replies: 1
    Last Post: 01-25-2007, 03:14 PM
All times are GMT -5. The time now is 08:33 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search