DoubleHash() public static method

public static DoubleHash ( UInt32 client_token, UInt32 server_token, string password ) : List
client_token System.UInt32
server_token System.UInt32
password string
return List
Beispiel #1
0
        protected void AccountLogin(byte type, List <byte> data)
        {
            if (ClientlessBot.debugging)
            {
                Console.WriteLine("{0}: [BNCS] Logging into the account", m_owner.Account);
            }
            UInt32      client_token = (uint)System.Environment.TickCount;
            List <byte> hash         = Bsha1.DoubleHash(client_token, m_owner.ServerToken, m_owner.Password);

            byte[] packet = BuildPacket((byte)0x3a, BitConverter.GetBytes(client_token), BitConverter.GetBytes(m_owner.ServerToken), hash, System.Text.Encoding.ASCII.GetBytes(m_owner.Account), zero);

            PrintPacket(packet);

            m_stream.Write(packet, 0, packet.Length);
        }
Beispiel #2
0
        protected void RealmList(byte type, List <byte> data)
        {
            UInt32 count  = BitConverter.ToUInt32(data.ToArray(), 8);
            Int32  offset = 12;

            if (ClientlessBot.debugging)
            {
                Console.WriteLine("{0}: [BNCS] List of realms:", m_owner.Account);
            }

            for (ulong i = 1; i <= count; i++)
            {
                offset += 4;
                String realmTitle       = Utils.readNullTerminatedString(System.Text.Encoding.ASCII.GetString(data.ToArray()), ref offset);
                String realmDescription = Utils.readNullTerminatedString(System.Text.Encoding.ASCII.GetString(data.ToArray()), ref offset);
                if (ClientlessBot.debugging)
                {
                    Console.WriteLine("{0}: [BNCS] {1}. {2}, {3}", m_owner.Account, i, realmTitle, realmDescription);
                }

                if (m_owner.Realm == null && i == 1)
                {
                    if (ClientlessBot.debugging)
                    {
                        Console.WriteLine("{0}: [BNCS] No realm was specified in the ini so we're going to connect to {1}", m_owner.Account, realmTitle);
                    }
                    m_owner.Realm = realmTitle;
                }
            }

            if (m_owner.LoggedIn)
            {
                //make_game();
            }
            else
            {
                if (ClientlessBot.debugging)
                {
                    Console.WriteLine("{0}: [BNCS] Logging on to the realm {1}", m_owner.Account, m_owner.Realm);
                }

                UInt32 clientToken = 1;
                byte[] packet      = BuildPacket((byte)0x3e, BitConverter.GetBytes(clientToken), Bsha1.DoubleHash(clientToken, m_owner.ServerToken, "password"), System.Text.Encoding.ASCII.GetBytes(m_owner.Realm), zero);

                byte[] temp = System.Text.Encoding.ASCII.GetBytes(m_owner.Realm);

                if (ClientlessBot.debugging)
                {
                    Console.WriteLine("\tSize of realm string: {0}", temp.Length);

                    Console.WriteLine("\tWriting to Stream: ");
                    for (int i = 0; i < packet.Length; i++)
                    {
                        if (i % 8 == 0 && i != 0)
                        {
                            Console.Write(" ");
                        }
                        if (i % 16 == 0 && i != 0)
                        {
                            Console.WriteLine("");
                        }
                        Console.Write("{0:X2} ", packet[i]);
                    }
                    Console.WriteLine("");
                }
                m_stream.Write(packet, 0, packet.Length);
            }
        }