• Welcome to Valhalla Legends Archive.
 

odd 0x51 response...

Started by mentalCo., February 09, 2005, 10:51 PM

Previous topic - Next topic

mentalCo.

i just added bnls support to my bot just to give it something extra and i was bored etc... anyway when using bnls i get this 0x51 response from battle.net.

ff 51 9 0 1 1 0 0 0

MyndFyre

Quote from: mentalCo. on February 09, 2005, 10:51 PM
i just added bnls support to my bot just to give it something extra and i was bored etc... anyway when using bnls i get this 0x51 response from battle.net.

ff 51 9 0 1 1 0 0 0


According to BnetDocs, that means it's an invalid version.  0x101.
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.

mentalCo.

o ok my switch() for the result was messed up but i changed it.  so whats wrong with my 0x51 packet?  like which part of it has to do with game version?

MyndFyre

Quote from: mentalCo. on February 09, 2005, 11:53 PM
o ok my switch() for the result was messed up but i changed it.  so whats wrong with my 0x51 packet?  like which part of it has to do with game version?

Maybe you should actually look at BnetDocs, you could figure it out?

And a note -- there are components of the game version in both 0x50 and 0x51.
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.

shout

If we could see some of your code (IE: Building and un-building 0x50 and 0x51), we could probably help you a little better.

I am guessing you are using VB & BNLS. Correct me if I am wrong.

Joe[x86]

Well, he said his switch() was messed up, not his Select Case, so I assume hes using a member of the C family.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

mentalCo.

#6
heres my 0x51 packet...


hex :
6a eb 8c 49 3 1 1 1 66 dd 2b 32 1 0 0 0 0 0 0 0 d 0 0 0 1 0 0 0 64 55 4 0 0 0 0 0 9e 2 67 24 8e 91 eb 9c 27 e9 5e 56 d2 1a 5b 20 16 f3 b4 10 53 74 61 72 63 72 61 66 74 2e 65 78 65 20 30 35 2f 32 36 2f 30 34 20 30 30 3a 34 36 3a 30 30 20 31 30 34 38 35 37 36 0 55 47 42 6f 74 4e 65 74 0


ascii :
j ë Œ I     f Ý + 2 
 d U  ž  g $ Ž ‘ ë œ ' é ^ V Ò  [    ó ´  S t a r c r a f t . e x e   0 5 / 2 6 / 0 4   0 0 : 4 6 : 0 0   1 0 4 8 5 7 6 U G B o t N e t



I have went over my code over and over and it seems to be right but i still get 0x101 unrecognized game version.  heres my code for sending 0x51... its a bit complicated because the program supports multiple bots and uhh... i dunno heres the code:


private short Send_0x51(byte[] mpqname, byte[] hashcmd, byte[] encryptvalue, string cdkey, int myID)
{
uint PRODUCT_STARCRAFT = 0x01;
uint PRODUCT_BROODWAR = 0x02;
uint PRODUCT_WAR2BNE = 0x03;
uint PRODUCT_DIABLO2 = 0x04;
uint PRODUCT_LOD = 0x05;
uint PRODUCT_JAPANSTARCRAFT = 0x06;
uint PRODUCT_WARCRAFT3 = 0x07;
uint PRODUCT_TFT = 0x08;

uint ProdID = 0;
uint mpqversion = 9;
mpqversion = Convert.ToUInt32(mpqname[7]);

AddChat(rtbGreen, "mpqversion: \r\n");

AddChat(rtbBlue, ((char)mpqversion).ToString() + "\r\n");

switch(Bots[myID].product.ToLower())
{
case "rats":
ProdID = PRODUCT_STARCRAFT;
break;
case "pxes":
ProdID = PRODUCT_BROODWAR;
break;
case "nb2w":
ProdID = PRODUCT_WAR2BNE;
break;
case "vd2d":
ProdID = PRODUCT_DIABLO2;
break;
case "px2d":
ProdID = PRODUCT_LOD;
break;
case "rtsj":
ProdID = PRODUCT_JAPANSTARCRAFT;
break;
case "3raw":
ProdID = PRODUCT_WARCRAFT3;
break;
case "px3w":
ProdID = PRODUCT_TFT;
break;
}

if(!Bots[myID].controls.PacketBuff.conBnls())
{
AddChat(rtbRed, "[BNLS]Could not connect to bnls server.\r\n");
return -1;
}

AddChat(rtbGreen, "[BNLS]Connected.\r\n");

Bots[myID].controls.PacketBuff.AddByteArray(encryptvalue);
Bots[myID].controls.PacketBuff.AddNTString(cdkey);
if(!Bots[myID].controls.PacketBuff.send(2, 0x01))
{
AddChat(rtbRed, "[BNLS]Packet could not be written to stream.\r\n");
return -1;
}

byte[] pbuff=new byte[2000];
short psize=0;
int ppos=0;
int pid=0;
bool Continue=true;



byte[] cdkeydata=new byte[9*4];
byte[] version=new byte[4];
byte[] checksum=new byte[4];
byte[] versionstring=new byte[128];
byte[] clientsessionkey=new byte[4];

AddChat(rtbGreen, "\r\n[BNLS]0x01 Sent.\r\n");

while(Bots[myID].controls.PacketBuff.tcpClients[2].GetStream().CanRead && Continue)
{
if(Bots[myID].controls.PacketBuff.tcpClients[2].GetStream().DataAvailable)
{
ppos=0;
while(ppos<3)
{
ppos += Bots[myID].controls.PacketBuff.tcpClients[2].GetStream().Read(pbuff,ppos,3-ppos);
//ppos += Bots[myID].controls.PacketBuff.tcpClients[3].GetStream().Read(pbuff,ppos,3-ppos);
}

psize=(short)pbuff[0];
pid=pbuff[2];

while(ppos<psize)
{
ppos += Bots[myID].controls.PacketBuff.tcpClients[2].GetStream().Read(pbuff,ppos,psize-ppos);
//ppos += Bots[myID].controls.PacketBuff.tcpClients[3].GetStream().Read(pbuff,ppos,psize-ppos);
}

AddChat(rtbGreen, "[BNLS]s->c 0x" + pid.ToString() + "(len " + psize.ToString() + ")\r\n Hex:\r\n");

for(int i =0;i<psize;i++)
{
AddChat(rtbBlue, pbuff[i].ToString("x") + " ");
}

switch(pid)
{
case 0x01://BNLS_CDKEY
switch((uint)pbuff[3])
{
case 0x1:
AddChat(rtbGreen, "BNLS_CDKEY data correct.\r\n");
Array.Copy(pbuff, 7, clientsessionkey, 0, 4);
Array.Copy(pbuff, 11, cdkeydata, 0, 9*4);

Bots[myID].controls.PacketBuff.AddDword(ProdID);
Bots[myID].controls.PacketBuff.AddDword(mpqversion);
Bots[myID].controls.PacketBuff.AddByteArray(hashcmd);
AddChat(rtbGreen, "wholepacket with size[" + Bots[myID].controls.PacketBuff.m_p.ToString() + "\r\n");
for(int p=0;p<Bots[myID].controls.PacketBuff.m_p;p++)
{
AddChat(rtbBlue, Bots[myID].controls.PacketBuff.m_data.ToArray()[p].ToString("x") + " ");
}
AddChat(rtbGreen, "\r\n");
Bots[myID].controls.PacketBuff.send(2, 0x09);
break;
case 0x0:
AddChat(rtbRed, "BNLS_CDKEY data incorrect.\r\n");
Continue = false;
break;
}
break;
case 0x09://BNLS_VERSIONCHECK
switch(pbuff[3])
{
case 0x1:
AddChat(rtbGreen, "BNLS_VERSIONCHECK passed.\r\n");
Array.Copy(pbuff, 7, version, 0, 4);
Array.Copy(pbuff, 11, checksum, 0, 4);
Array.Copy(pbuff, 15, versionstring, 0, psize-15);

Bots[myID].controls.PacketBuff.AddByteArray(clientsessionkey);
AddChat(rtbGreen, "clientsessionkey\r\n");
for(int p=0;p<4;p++)
{
AddChat(rtbBlue, clientsessionkey[p].ToString("x") + " ");
}
AddChat(rtbGreen, "\r\n");

Bots[myID].controls.PacketBuff.AddByteArray(version);
AddChat(rtbGreen, "version\r\n");
for(int p=0;p<4;p++)
{
AddChat(rtbBlue, version[p].ToString("x") + " ");
}
AddChat(rtbGreen, "\r\n");

Bots[myID].controls.PacketBuff.AddByteArray(checksum);
AddChat(rtbGreen, "checksum\r\n");
for(int p=0;p<4;p++)
{
AddChat(rtbBlue, checksum[p].ToString("x") + " ");
}
AddChat(rtbGreen, "\r\n");

if(Bots[myID].expansion)
{
//add expansion support here
}
else
{
Bots[myID].controls.PacketBuff.AddDword((int)1);
}
if(Bots[myID].spawn)
{
//add spawn support here
}
else
{
Bots[myID].controls.PacketBuff.AddDword((int)0);
}
Bots[myID].controls.PacketBuff.AddByteArray(cdkeydata);
AddChat(rtbGreen, "cdkeydata\r\n");
for(int p=0;p<9*4;p++)
{
AddChat(rtbBlue, cdkeydata[p].ToString("x") + " ");
}
AddChat(rtbGreen, "\r\n");
Bots[myID].controls.PacketBuff.AddByteArray(versionstring, psize - 15);
AddChat(rtbGreen, "versionstring\r\n");
for(int p=0;p<psize - 15;p++)
{
AddChat(rtbBlue, versionstring[p].ToString("x") + " | ");
}
AddChat(rtbGreen, "\r\n");

Bots[myID].controls.PacketBuff.AddNTString(Bots[myID].cdkeyname);

AddChat(rtbGreen, "wholepacket with size[" + Bots[myID].controls.PacketBuff.m_p.ToString() + "\r\n");
for(int p=0;p<Bots[myID].controls.PacketBuff.m_p;p++)
{
AddChat(rtbBlue, Bots[myID].controls.PacketBuff.m_data.ToArray()[p].ToString("x") + " ");
}
AddChat(rtbGreen, "wholepacket ascii\r\n");
for(int p=0;p<Bots[myID].controls.PacketBuff.m_p;p++)
{
AddChat(rtbBlue, ((char)Convert.ToInt32(Bots[myID].controls.PacketBuff.m_data.ToArray()[p].ToString())).ToString() + " ");
}
Bots[myID].controls.PacketBuff.send(1, 0x51);
Continue = false;
break;
case 0x2:
AddChat(rtbRed, "BNLS_VERSIONCHECK failed.\r\n");
break;
}
break;

}
AddChat(rtbGreen, "\r\n");
}
}
Bots[myID].controls.PacketBuff.tcpClients[2].GetStream().Close();
return 1;
}




and the parameters that are passed to Send_0x51() are:


byte[] servertoken=new byte[4];
byte[] mpqname=new byte[13];
byte[] hashcmd=new byte[63];

Array.Copy(pbuff,8,servertoken,0,4);
Array.Copy(pbuff, 24, mpqname, 0, 13);
Array.Copy(pbuff, 37, hashcmd, 0, 62);



heres what my bot outputs:


botA is about to connect with username of mentalCo.
botA [BNET]Connected.
botA [BNET]c->s 0x50
botA [BNET]Reading Packet
[BNET]s->c 0258
Hex:
ff 25 8 0 60 c a 43
Ascii:
ÿ %  `
C
botA [BNET]Reading Packet
[BNET]s->c 05099
Hex:
ff 50 63 0 0 0 0 0 16 2b b 89 1b d4 5 0 0 ac 41 43 25 b c5 1 49 58 38 36 76 65 72 30 2e 6d 70 71 0 41 3d 39 30 38 36 30 35 32 39 33 20 42 3d 33 32 36 38 34 33 39 35 32 20 43 3d 37 37 35 37 31 37 30 31 31 20 34 20 41 3d 41 5e 53 20 42 3d 42 2b 43 20 43 3d 43 2d 41 20 41 3d 41 5e 42 0
Ascii:
ÿ P c  +
&#137;  Ô  ¬ A C %
Å  I X 8 6 v e r 0 . m p q A = 9 0 8 6 0 5 2 9 3   B = 3 2 6 8 4 3 9 5 2   C = 7 7 5 7 1 7 0 1 1   4   A = A ^ S   B = B + C   C = C - A   A = A ^ B

botA [BNET]hashcmd:
A = 9 0 8 6 0 5 2 9 3   B = 3 2 6 8 4 3 9 5 2   C = 7 7 5 7 1 7 0 1 1   4   A = A ^ S   B = B + C   C = C - A   A = A ^ B
mpqversion:
0
[BNLS]Connected.

[BNLS]0x01 Sent.
[BNLS]s->c 0x1(len 47)
Hex:
2f 0 1 1 0 0 0 92 8a 96 49 d 0 0 0 1 0 0 0 64 55 4 0 0 0 0 0 57 6e dc 51 19 77 d0 30 1f df 45 d8 40 ee 8d 2c 25 eb 6c 51 BNLS_CDKEY data correct.
wholepacket with size[71
1 0 0 0 30 0 0 0 41 3d 39 30 38 36 30 35 32 39 33 20 42 3d 33 32 36 38 34 33 39 35 32 20 43 3d 37 37 35 37 31 37 30 31 31 20 34 20 41 3d 41 5e 53 20 42 3d 42 2b 43 20 43 3d 43 2d 41 20 41 3d 41 5e 42 0 0

[BNLS]s->c 0x9(len 55)
Hex:
37 0 9 1 0 0 0 3 1 1 1 31 11 13 af 53 74 61 72 63 72 61 66 74 2e 65 78 65 20 30 35 2f 32 36 2f 30 34 20 30 30 3a 34 36 3a 30 30 20 31 30 34 38 35 37 36 0 BNLS_VERSIONCHECK passed.
clientsessionkey
92 8a 96 49
version
3 1 1 1
checksum
31 11 13 af
cdkeydata
d 0 0 0 1 0 0 0 64 55 4 0 0 0 0 0 57 6e dc 51 19 77 d0 30 1f df 45 d8 40 ee 8d 2c 25 eb 6c 51
versionstring
53 | 74 | 61 | 72 | 63 | 72 | 61 | 66 | 74 | 2e | 65 | 78 | 65 | 20 | 30 | 35 | 2f | 32 | 36 | 2f | 30 | 34 | 20 | 30 | 30 | 3a | 34 | 36 | 3a | 30 | 30 | 20 | 31 | 30 | 34 | 38 | 35 | 37 | 36 | 0 |
wholepacket with size[105
92 8a 96 49 3 1 1 1 31 11 13 af 1 0 0 0 0 0 0 0 d 0 0 0 1 0 0 0 64 55 4 0 0 0 0 0 57 6e dc 51 19 77 d0 30 1f df 45 d8 40 ee 8d 2c 25 eb 6c 51 53 74 61 72 63 72 61 66 74 2e 65 78 65 20 30 35 2f 32 36 2f 30 34 20 30 30 3a 34 36 3a 30 30 20 31 30 34 38 35 37 36 0 55 47 42 6f 74 4e 65 74 0 wholepacket ascii
&#146; &#138; &#150; I     1   ¯ 
 d U  W n Ü Q  w Ð 0  ß E Ø @ î ? , % ë l Q S t a r c r a f t . e x e   0 5 / 2 6 / 0 4   0 0 : 4 6 : 0 0   1 0 4 8 5 7 6 U G B o t N e t
botA [BNET]Reading Packet
[BNET]s->c 0519
Hex:
ff 51 9 0 1 1 0 0 0
Ascii:
ÿ Q  
Game version unrecognized.