• Welcome to Valhalla Legends Archive.
 

[VB] 0x51 IP Ban

Started by iNsaNe, March 25, 2007, 12:43 PM

Previous topic - Next topic

iNsaNe

Eveytime I send 0x51 (sid_auth_check), it ip bans me from the server. I'm curious as to why it's doing such, I know I'm sending the packet wrong. Here's the log:

0000   00 09 5b cd 8a 38 00 0c 6e 99 1a 1b 08 00 45 00  ..[..8..n.....E.
0010   00 94 cc f2 40 00 80 06 62 5a c0 a8 00 06 3f f0  [email protected]....?.
0020   ca 78 05 07 17 e0 2b eb a8 43 bb 2f ec f0 50 18  .x....+..C./..P.
0030   ff 11 14 f5 00 00 ff 51 6c 00 f3 1b 9e 00 15 00  .......Ql.......
0040   01 00 c9 4f 02 f2 ff ff ff ff 01 00 00 00 00 00  ...O............
0050   00 00 1a 00 00 00 0e 00 00 00 0a 66 70 00 00 00  ...........fp...
0060   00 00 92 24 5c 8e c8 c3 7a eb 9c 78 bc b8 68 6d  ...$\...z..x..hm
0070   33 81 8e a9 a9 49 77 61 72 33 2e 65 78 65 20 31  3....Iwar3.exe 1
0080   32 2f 32 38 36 20 32 30 3a 33 35 3a 32 31 20 31  2/286 20:35:21 1
0090   35 37 32 33 30 37 00 42 4e 69 2d 50 6f 77 65 52  572307.BNi-PoweR
00a0   2e 00                                            ..


and the code:

    Public Sub SEND_SIDAUTHCHECK()

        Dim BNCS_Packet As New MBNCSUtil.BncsPacket(&H51)

        'C -> S 0x51 (SID_AUTH_CHECK)

        Dim ClientToken As UInteger
        Dim CheckRevision As Long

        Dim MPQNumber As Byte
        Dim HashLength() As Byte

        Dim EXEInfo As String
        Dim EXEVersion As Integer

        Dim Files(2) As String
        Dim CDKeyDecoded As New MBNCSUtil.CdKey(strCDKey)

        ClientToken = GetTickCount

        If strProduct = "Warcraft III RoC" Then

            Files(0) = "C:\Program Files\Warcraft III\war3.exe"
            Files(1) = "C:\Program Files\Warcraft III\storm.dll"
            Files(2) = "C:\Program Files\Warcraft III\game.dll"

            HashLength = CDKeyDecoded.GetHash(ClientToken, ServerToken)
            EXEVersion = MBNCSUtil.CheckRevision.GetExeInfo(Files(0), EXEInfo)

            MPQNumber = MBNCSUtil.CheckRevision.ExtractMPQNumber(MPQFileName)
            CheckRevision = MBNCSUtil.CheckRevision.DoCheckRevision(ValueString, Files, MPQNumber)

            With BNCS_Packet

                .Insert(ClientToken)
                .Insert(EXEVersion)
                .Insert(CheckRevision)
                .Insert(&H1)
                .Insert(&H0)

                .Insert(strCDKey.Length)
                .Insert(CDKeyDecoded.Product)
                .Insert(CDKeyDecoded.Value1)
                .Insert(&H0)

                .Insert(HashLength)
                .InsertCString(EXEInfo)
                .InsertCString(strUsername)

                AddChat(Color.Yellow, "-> Sending 0x51! - [" & BNCS_Packet.GetData().Length & " Bytes]")

                frmMain.winSock.SendData(BNCS_Packet.GetData())

            End With

        End If

    End Sub


then it just disconnects me and ip bans me for ~ 5 mins. It's really annoying me.

Hdx

ff 51 6c 00 .Ql.
f3 1b 9e 00 .... 'Client
15 00 01 00 .... 'Exe version (This is wrong IIRC)
c9 4f 02 f2 .O.. 'Hash
ff ff ff ff .... 'Number of keys... -1? wtfbbq?
01 00 00 00 .... 'Spawn: Yes (Can't do this on WC3 man!)
00 00 00 00 .... 'Length of 0?
1a 00 00 00 .... 'Prod? wtf?
0e 00 00 00 .... 'Public?
0a 66 70 00 .fp. 'Should be 0's
00 00 00 00 92 24 5c 8e c8 c3 7a eb 9c 78 bc b8 68 6d 33 81 .......$\...z..x..hm3.
8e a9 a9 49 77 61 72 33 2e 65 78 65 20 31 32 2f 32 38 36 20 32 30 3a 33 35 3a 32 31 20 31 35 37 32 33 30 37 00    ...Iwar3.exe 12/286 20:35:21 1572307. 'Exe info string
42 4e 69 2d 50 6f 77 65 52 2e 00 BNi-PoweR..

You're all wacked up!
Whats with the -1?

~Hdx

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

iNsaNe

Quote from: Hdx on March 25, 2007, 03:04 PM
Whats with the -1?
Yeah I know wtf? Here, a new packet log and I changed the code a bit:

            With BNCS_Packet

                .Insert(ClientToken)
                .Insert(EXEVersion)
                .Insert(CheckRevision)
                .InsertInt32(&H1)
                .InsertInt32(&H0)

                .Insert(strCDKey.Length)
                .Insert(CDKeyDecoded.Product)
                .Insert(CDKeyDecoded.Value1)
                .InsertInt32(&H0)

                ''' .Insert(HashLength) <--- Removed

                .InsertCString(EXEInfo)
                .InsertCString(strUsername)

                AddChat(Color.Yellow, "-> Sending 0x51! - [" & BNCS_Packet.GetData().Length & " Bytes]")

                frmMain.winSock.SendData(BNCS_Packet.GetData())
                MsgBox("works")

            End With



0000   00 09 5b cd 8a 38 00 0c 6e 99 1a 1b 08 00 45 00  ..[..8..n.....E.
0010   00 80 8b b1 40 00 80 06 a3 af c0 a8 00 06 3f f0  ....@.........?.
0020   ca 78 06 8f 17 e0 03 b1 01 12 12 99 96 74 50 18  .x...........tP.
0030   ff 11 ad 4e 00 00 ff 51 58 00 c4 f8 43 01 15 00  ...N...QX...C...
0040   01 00 38 39 c5 51 00 00 00 00 01 00 00 00 00 00  ..89.Q..........
0050   00 00 1a 00 00 00 0e 00 00 00 0a 66 70 00 00 00  ...........fp...
0060   00 00 77 61 72 33 2e 65 78 65 20 31 32 2f 32 38  ..war3.exe 12/28
0070   36 20 32 30 3a 33 35 3a 32 31 20 31 35 37 32 33  6 20:35:21 15723
0080   30 37 00 42 4e 69 2d 50 6f 77 65 52 2e 00        07.BNi-PoweR..


Still same problem..

Barabajagal

You didn't read the comments on each line, did you?

Hdx

ff 51 58 00 .QX. 'Header
c4 f8 43 01 ..C. 'Client
15 00 01 00 .... 'EXE Version
38 39 c5 51 89.Q 'Checksum
00 00 00 00 .... 'Number of keys... 0?
01 00 00 00 .... 'Spawn 1 ? cant do this
00 00 00 00 .... 'CDKey Len of 0 once again
1a 00 00 00 .... 'Invalid product
0e 00 00 00 .... 'Invalid Public
0a 66 70 00 .fp. 'Should be 0, but isn't...
00 00 00 00 77 61 72 33 2e 65 78 65 20 31 32 2f 32 38 36 20 ....war3.exe 12/286 'CDkey Hash seems you omitted it idiot, you need it!
32 30 3a 33 35 3a 32 31 20 31 35 37 32 33 30 37 00 20:35:21 1572307. 'Exe Information
42 4e 69 2d 50 6f 77 65 52 2e 00 BNi-PoweR.. 'CDKey Owner

Why in HELL did you remove the cdkey hash?
Thats not your problem
For some stupid reason you're treating your Checksum result as a 64-bit integer instead of a 32
Which is throwing everything else off a DWORD.
LEARN TO READ your own dammen packets and maby you will understand what the hell you are doing wrong. It's obvious!
~Hdx

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

MyndFyre

The following is the code used to build the 0x51 packet in the JinxBot BNCS plugin:

431            BncsPacket pck0x51 = new BncsPacket((byte)BncsPacketId.AuthCheck);
432            pck0x51.Insert(m_clientToken);  // Client Token
433            pck0x51.Insert(exeVer);  // EXE version (from CheckRevision)
434            pck0x51.Insert(crResult); // Checksum (From CheckRevision)
435            if (m_prodCode == "D2XP" || m_prodCode == "W3XP")  // number of keys present in packet
436                pck0x51.Insert(2);
437            else
438                pck0x51.Insert(1);
439            pck0x51.Insert(false);  // Is Spawn?
440            pck0x51.Insert(key1.Key.Length); // Key 1 length
441            pck0x51.Insert(key1.Product); // Key 1 product
442            pck0x51.Insert(key1.Value1); // Key 1 public
443            pck0x51.Insert(0);  // Should be 0
444            pck0x51.Insert(key1.GetHash(m_clientToken, m_srvToken)); // Key 1 hash
445            if (key2 != null)  // if there are two keys:
446            {
447                pck0x51.Insert(key2.Key.Length); // key 2 length
448                pck0x51.Insert(key2.Product); // key 2 product
449                pck0x51.Insert(key2.Value1); // key 2 public
450                pck0x51.Insert(0); //  Should be 0
451                pck0x51.Insert(key2.GetHash(m_clientToken, m_srvToken)); // key 2 hash
452            }
453            pck0x51.InsertCString(exeInfo); // EXE information
454            pck0x51.InsertCString("JinxBot"); // CD key owner
455
456            Send(pck0x51.GetData());

(full code for this class is here).

Compared to your most recently posted code, which:
Client Token
EXE Version
Checksum
1 key
Not spawn
Key length
Key product
Key public
0
Key hash is MISSING.
EXE info
CD key owner "BNi-PoweR"

QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

raylu

I think it would be much easier if you had just explained that he had an extra null DWORD after his Checksum.

Check the length of your CheckRevision variable (why is it called that anyway?). Also, note that all DWORDS are basically Int32s - if you insert them as such, you will get an error (which is better than not erroring and getting IPbanned).
Pie?

brew

Quote from: raylu on March 27, 2007, 04:17 PM
I think it would be much easier if you had just explained that he had an extra null DWORD after his Checksum.

Check the length of your CheckRevision variable (why is it called that anyway?).
Because it is supposed to check the revisions made with the dlls it downloads from bnet's ftp server and is supposed to include in it's mpq
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

raylu

Um...what I'm saying is that he should be adding the CheckSum to the packet, not CheckRevision formula. I'm asking him why he's calling it that.
Pie?

brew

I answered the question you asked in parentheses
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Baroness

#10
EDIT:  Just posted the solution, went to read it, saw Hdx already pointed it out.  :-X