Valhalla Legends Forums Archive | Battle.net Bot Development | [c++] SID_AUTH_CHECK Problems

AuthorMessageTime
Tejjoj
[code]

#define PACKET_GENERATE() BYTE PACKET_BUF[8000]; INT PACKET_POS; PACKET_POS=0; memset(PACKET_BUF,NULL,8000);
#define PACKET_ADDDWORD(x) *(DWORD*)&PACKET_BUF[PACKET_POS] = (DWORD)x; PACKET_POS+=sizeof(DWORD);
#define PACKET_ADDWORD(x) *(WORD*)&PACKET_BUF[PACKET_POS] = (WORD)x; PACKET_POS+=sizeof(WORD);
#define PACKET_ADDCHAR(x) *(CHAR*)&PACKET_BUF[PACKET_POS] = (CHAR)x; PACKET_POS+=sizeof(CHAR);
#define PACKET_ADDBYTE(x) *(BYTE*)&PACKET_BUF[PACKET_POS] = (BYTE)x; PACKET_POS+=sizeof(BYTE);
#define PACKET_ADDINT(x) *(INT*)&PACKET_BUF[PACKET_POS] = (INT)x; PACKET_POS+=sizeof(INT);
#define PACKET_ADDSTRING(x) strcpy((CHAR*)PACKET_BUF+PACKET_POS,x); PACKET_POS+=strlen(x);
#define PACKET_ADDNULLSTRING(x) strcpy((CHAR*)PACKET_BUF+PACKET_POS,x); PACKET_POS+=strlen(x) + 1;
#define PACKET_SEND(x) SendPacket(PACKET_BUF,x,PACKET_POS);

VOID BNLS_HashKey(CHAR* CDKey, BYTE KeyHash[9*4])
{
BYTE CDKEY_HASH[100] = {0};
DWORD pSize = 0;
*(DWORD*)&CDKEY_HASH[0] = BNET.ServerToken;
pSize += sizeof(DWORD);
strcpy((char*)CDKEY_HASH+pSize,CDKey);
pSize += strlen(CDKey) + 1;
SendBNLSPacket(CDKEY_HASH,BNLS_CDKEY,pSize);
printf("[BNLS] CDKey Hash sent!\n");

pSize = 0;
CHAR CDKEY_RESPONSE[100];

DWORD dwSize = recv(BNLS.sock,CDKEY_RESPONSE,100,0);
printf("[BNLS] CDKey Response! Packet Size: %d\n",dwSize);
pSize = 0x03; // Cutting away the Header
printf("[BNLS] CDKey Hash Bool %d\n",CDKEY_RESPONSE[pSize]);
pSize += sizeof(BOOL);
printf("[BNLS] CDKey Client Session Key 0x%x\n",*(DWORD*)&CDKEY_RESPONSE[pSize]);
pSize += sizeof(DWORD);

for(UINT i = 0; i < 9*4; i++)
{
*(BYTE*)&KeyHash[i] = CDKEY_RESPONSE[pSize+i];
}
}

VOID BNLS_CheckRevision(VOID)
{
DWORD pSize = 0;
BYTE VERSIONCHECK[1024] = {0};
BYTE VERSIONCHECK_RESPONSE[1024] = {0};

*(DWORD*)&VERSIONCHECK[pSize] = PRODUCT_LORDOFDESTRUCTION;
pSize += sizeof(DWORD);
*(DWORD*)&VERSIONCHECK[pSize] = BNET.MPQNo;
pSize += sizeof(DWORD);
strcpy((CHAR*)VERSIONCHECK+pSize,BNET.ValueForma);
pSize += strlen(BNET.ValueForma) + 1;

SendBNLSPacket(VERSIONCHECK,BNLS_VERSIONCHECK,pSize);
printf("[BNLS] VERSIONCHECK sent!\n");

DWORD dwSize = recv(BNLS.sock,(CHAR*)VERSIONCHECK_RESPONSE,1024,0);
printf("[BNLS] VERSIONCHECK response!\n");

pSize = 3; // Remove the BNLS Header

printf("[BNLS] VERSIONCHECK_RESPONSE %s(%d)\n", VERSIONCHECK_RESPONSE[pSize] ?
"was sucessfull" : "failed", VERSIONCHECK_RESPONSE[pSize]);
pSize+=sizeof(BOOL);

BNET.EXEVersion = *(DWORD*)&VERSIONCHECK_RESPONSE[pSize];
pSize+=sizeof(DWORD);
BNET.EXEChecksum = *(DWORD*)&VERSIONCHECK_RESPONSE[pSize];
pSize += sizeof(DWORD);
strcpy(BNET.ExeInformations,(CHAR*)VERSIONCHECK_RESPONSE+pSize);
}

VOID SID_AUTH_INFO_HANDLER(BYTE* data,DWORD dwSize)
{
printf("[BNET] AUTH_INFO response\n");

DWORD Checksum;
DWORD Version;
CHAR ExeInfo[1024] = {0};
CHAR Mpqname[1024] = {0};

strcpy(Mpqname,(CHAR*)data + (sizeof(DWORD)*3) + sizeof(FILETIME) + 4);

BNET.ServerToken = *(DWORD*)&data[7]; // Extracting the Server Token
BNET.ClientToken = 0x00000000; // Define our Client Token
BNET.MPQNo = extractMPQNumber((CHAR*)data + (sizeof(DWORD)*3) + sizeof(FILETIME) + 4);
strcpy(BNET.ValueForma,
(CHAR*)data + ( (sizeof(DWORD)*3) + sizeof(FILETIME)
+ strlen((CHAR*)data + (sizeof(DWORD)*3) + sizeof(FILETIME) + 4) + 5));

printf("ServerToken: 0x%x\nClientToken: 0x%x\nMPQNumber: %d (%s)\nValueForma: %s\n",
BNET.ServerToken,BNET.ClientToken,BNET.MPQNo,
(CHAR*)data + (sizeof(DWORD)*3) + sizeof(FILETIME) + 4,BNET.ValueForma);

BNLS_HashKey(KEY_CLASSIC,BNET.KeyClassic);
BNLS_HashKey(KEY_LOD,BNET.KeyLoD);

BNLS_CheckRevision();

BNET.ExeInformations[0] = ::toupper(BNET.ExeInformations[0]);

printf("EXEChecksum: 0x%x\nEXEVersion: 0x%x\nEXEInformations: %s\n",
BNET.EXEChecksum,BNET.EXEVersion,BNET.ExeInformations);

PACKET_GENERATE();
PACKET_ADDDWORD(BNET.ClientToken)
PACKET_ADDDWORD(BNET.EXEVersion)
PACKET_ADDDWORD(Checksum)
PACKET_ADDDWORD(0x02)
PACKET_ADDDWORD(0x00)


for(INT x = 0; x < 9*4; x++) {
PACKET_ADDBYTE((BYTE*)BNET.KeyClassic[x]);
}

for(INT x = 0; x < 9*4; x++) {
PACKET_ADDBYTE((BYTE*)BNET.KeyLoD[x]);
}

PACKET_ADDNULLSTRING(BNET.ExeInformations)
PACKET_ADDNULLSTRING("Gerbot");
PACKET_SEND(SID_AUTH_CHECK);
}
[/code]

Everytime the Packet I generate with this function I get 0x203 back or 0x101 from the S>C SID_AUTH_CHECK Packet. Anyone knows what's wrong there?


[Kp edit: broke up long lines.]
September 9, 2007, 11:04 AM
Barabajagal
Packet log?
September 9, 2007, 11:10 AM
Tejjoj
[code]
00A308E8  FF 51 8B 00 00 00 00 00  ÿQ‹.....
00A308F0  00 0B 00 01 00 00 00 00  . .....
00A308F8  02 00 00 00 00 00 00 00  .......
00A30900  10 00 00 00 06 00 00 00  ......
00A30908  4F B9 D6 00 00 00 00 00  O¹Ö.....
00A30910  EF FA 31 A7 E5 53 62 CF  ïú1§åSbÏ
00A30918  D7 82 CC C2 FC 49 0B C2  ׂÌÂüI Â
00A30920  CA 95 C8 34 10 00 00 00  Ê•È4...
00A30928  0A 00 00 00 F6 25 3E 00  ....ö%>.
00A30930  00 00 00 00 41 7B 36 0A  ....A{6.
00A30938  AC D6 60 7B CD 34 33 E0  ¬Ö`{Í43à
00A30940  FE 88 56 23 A1 85 99 47  þˆV#¡…™G
00A30948  47 61 6D 65 2E 65 78 65  Game.exe
00A30950  20 30 34 2F 30 39 2F 30  04/09/0
00A30958  37 20 32 32 3A 31 35 3A  7 22:15:
00A30960  33 34 20 32 31 32 39 39  34 21299
00A30968  32 30 00 53 6B 61 6C 62  20.Skalb
00A30970  6F 74 00                ot.

[/code]

I fished it out with ollydbg
September 9, 2007, 11:15 AM
Barabajagal
That packet doesn't look right at all.
For refrence: http://bnetdocs.dementedminds.net/?op=packet&pid=408

[code]Client:  00 00 00 00 (BLANK)
EXEVer:  00 0B 00 01
Checkum: 00 00 00 00 (BLANK)
Keys:    02 00 00 00
Spawn:  00 00 00 00
Key 1 -
KeyLen: 10 00 00 00
KeyPrd: 06 00 00 00
KeyPub: 4F B9 D6 00
Unknwn: 00 00 00 00
Hash:  EF FA 31 A7
        E5 53 62 CF
        D7 82 CC C2
        FC 49 0B C2
        CA 95 C8 34
Key 2 -
KeyLen: 10 00 00 00
KeyPrd: 0A 00 00 00
KeyPub: F6 25 3E 00
Unknwn: 00 00 00 00
Hash:  41 7B 36 0A
        AC D6 60 7B
        CD 34 33 E0
        FE 88 56 23
        A1 85 99 47
EXEInfo: 47 61 6D 65 2E 65 78 65 20 30 34 2F 30 39 2F 30 37 20 32 32 3A 31 35 3A 33 34 20 32 31 32 39 39 32 30 00
        (Game.exe 04/09/07 22:15:34 2129920)
Owner:  53 6B 61 6C 62 6F 74 00
        (Skalbot)[/code]
Your checksum and client token are both blank.
September 9, 2007, 11:26 AM
Tejjoj
Thanks! I will go after that :)

EDIT:

I insert now the checksum I get from the BNLS server. But I still get 0x200 back inclusive IP Ban
The new packetlog
[code]
00A30908  FF 51 8B 00 9C D6 4B 00  ÿQ‹.œÖK.
00A30910  00 0B 00 01 0E A7 80 B6  . .§€¶
00A30918  02 00 00 00 00 00 00 00  .......
00A30920  10 00 00 00 06 00 00 00  ......
00A30928  4F B9 D6 00 00 00 00 00  O¹Ö.....
00A30930  9B FF 37 2D D5 55 AF AB  ›ÿ7-ÕU¯«
00A30938  1B 4C B4 FA F0 1C AF 96  L´úð¯–
00A30940  CD 1B EE 54 10 00 00 00  ÍîT...
00A30948  0A 00 00 00 F6 25 3E 00  ....ö%>.
00A30950  00 00 00 00 52 9D 9A 51  ....R?šQ
00A30958  6E DB 94 C8 47 5F 17 6E  nÛ”ÈG_n
00A30960  50 0B 4E FA 06 17 4E 81  P NúN?
00A30968  47 61 6D 65 2E 65 78 65  Game.exe
00A30970  20 30 34 2F 30 39 2F 30  04/09/0
00A30978  37 20 32 32 3A 31 35 3A  7 22:15:
00A30980  33 34 20 32 31 32 39 39  34 21299
00A30988  32 30 00 53 6B 61 6C 62  20.Skalb
00A30990  6F 74 00                ot.

[/code]
September 9, 2007, 12:15 PM
Tejjoj
Aight, I sorted the Packet like Andy did. I really don't know why it gives me IP ban

[code]
Client: 9C D6 4B 00
ExeVer: 00 0B 00 01
Checksum: 0E A7 80 B6
Keys: 02 00 00 00
Spawn: 00 00 00 00
Key 1 -
KeyLen: 10 00 00 00
KeyPrd: 06 00 00 00
KeyPub: 4F B9 D6 00
Unknwn: 00 00 00 00
Hash: 9B FF 37 2D
D5 55 AF AB
1B 4C B4 FA
F0 1C AF 96
CD 1B EE 54
Key 2-
KeyLen: 10 00 00 00
KeyPrd: 0A 00 00 00
KeyPub: F6 25 3E 00
Unkwn: 00 00 00 00
Hash: 52 9D 9A 51
6E DB 94 C8
47 5F 17 6E
50 0B 4E FA
06 17 4E 81
ExeInfo: 47 61 6D 65 2E 65 78 65 20 30 34 2F 30 39 2F 30 37 20 32 32 3A 31 35 3A 33 34 20 32 31 32 39 39 32 30
(Game.exe 04/09/07 22:15:34 2129920)
Owner: 53 6B 61 6C 62 6F 74
(Skalbot)
[/code]
September 9, 2007, 4:08 PM
Barabajagal
Could someone else look over his code?
September 9, 2007, 7:56 PM
LordVader
Could try this for a reference if no body else helps ill try to tackle the code or atleast post something that should work as a reference..

http://dmbot.valhallalegends.com/AccountKeepAlive.zip

Is outdated uses old local hashing checkrevision but looking thru that may help you get some of you're problems sorted out.
Even tho outdated, examples like that have helped me out alot in the past.

Ill check back to see progress in a day or two.
September 10, 2007, 5:26 AM
LockesRabb
LordVader, he's attempting to do it via BNLS.

Game.exe? Is your game executable file actually named game.exe? Just wondering.
September 10, 2007, 7:38 AM
LordVader
[quote author=Don Cullen link=topic=17011.msg172532#msg172532 date=1189409922]
LordVader, he's attempting to do it via BNLS.

Game.exe? Is your game executable file actually named game.exe? Just wondering.
[/quote]

I realise that was suggesting that as a reference so he could check his AuthInfo setup//functions with the one DM made, and also so he could see DM's packet Buffer his constant defines probably work fine mostly, but may help if he saw other solutions.

Is not hard to make a connection to bnls get the data where needed and plug it directly into the code in the accountkeepalive sources.
Is a good resource for people working with c++, there is very little linked to in the references for people working in c++.

I believe he's trying to connect using d2xp from the code he posted, if so game.exe should be the correct executable.
in his code he uses:
[code]
BNLS_HashKey(KEY_CLASSIC,BNET.KeyClassic);
BNLS_HashKey(KEY_LOD,BNET.KeyLoD);
[/code]
Im assuming d2dv or d2xp from that and the reference to game.exe

But yah, hopefully the source will be of some help to you Tejjoj and if not and no body else actually dives into you're code I will try to write a d2dv/d2xp bnls console app or something and post that in a day or so.
September 10, 2007, 7:44 AM
Barabajagal
Are you using the same client token throughout the battle.net connection? ClientToken is a static value for each connection (meaning it doesn't change), and if you use different ClientTokens, it won't work. If I remember correctly, it's actually given to you by BNLS in BNLS_CDKEY.
September 10, 2007, 8:04 AM
LockesRabb
Ah, right, forgot Diablo's exe is called Game.exe. Interesting choice of a filename on Blizzard's part.

Edit: Tejjoj, can you paste your BNLS_CDKEY function here?

Also, you only gave us the packet log of what BNLS sends you, we also need the packet log of what you're sending to Battle.net. So please paste the packet log of what you're sending Battle.net right after processing what BNLS sent you.
September 10, 2007, 11:45 AM
Tejjoj
[quote author=Don Cullen link=topic=17011.msg172539#msg172539 date=1189424745]
Ah, right, forgot Diablo's exe is called Game.exe. Interesting choice of a filename on Blizzard's part.

Edit: Tejjoj, can you paste your BNLS_CDKEY function here?

Also, you only gave us the packet log of what BNLS sends you, we also need the packet log of what you're sending to Battle.net. So please paste the packet log of what you're sending Battle.net right after processing what BNLS sent you.
[/quote]

The PacketLog is the one of the Client to Battle.Net it's the 0x51 Packet. The Hash function is included in my post

[code]
VOID BNLS_HashKey(CHAR* CDKey, BYTE KeyHash[9*4])
{
BYTE CDKEY_HASH[100] = {0};
DWORD pSize = 0;
*(DWORD*)&CDKEY_HASH[0] = BNET.ServerToken;
pSize += sizeof(DWORD);
strcpy((char*)CDKEY_HASH+pSize,CDKey);
pSize += strlen(CDKey) + 1;
SendBNLSPacket(CDKEY_HASH,BNLS_CDKEY,pSize);
printf("[BNLS] CDKey Hash sent!\n");

pSize = 0;
CHAR CDKEY_RESPONSE[100];

DWORD dwSize = recv(BNLS.sock,CDKEY_RESPONSE,100,0);
printf("[BNLS] CDKey Response! Packet Size: %d\n",dwSize);
pSize = 0x03; // Cutting away the Header
printf("[BNLS] CDKey Hash Bool %d\n",CDKEY_RESPONSE[pSize]);
pSize += sizeof(BOOL);
printf("[BNLS] CDKey Client Session Key 0x%x\n",*(DWORD*)&CDKEY_RESPONSE[pSize]);
pSize += sizeof(DWORD);

for(UINT i = 0; i < 9*4; i++)
{
*(BYTE*)&KeyHash[i] = CDKEY_RESPONSE[pSize+i];
}
}
[/code]

September 10, 2007, 1:58 PM
Tejjoj
Okay! Here is my PacketLog:

[code]
001FDBA8  FF 51 92 00 1D 75 E5 4A  ÿQ’.uåJ
001FDBB0  00 0B 00 01 5D 3F 5E E2  . .]?^â
001FDBB8  02 00 00 00 00 00 00 00  .......
001FDBC0  10 00 00 00 06 00 00 00  ......
001FDBC8  9B 40 23 00 00 00 00 00  ›@#.....
001FDBD0  13 9E B8 2B 40 6B 4C B9  ž¸+@kL¹
001FDBD8  AF 26 43 E2 2B 6A B2 9B  ¯&Câ+j²›
001FDBE0  EE A8 8B 97 10 00 00 00  —...
001FDBE8  0A 00 00 00 A1 F4 10 00  ....¡ô.
001FDBF0  00 00 00 00 F5 2A 3C C7  ....õ*<Ç
001FDBF8  C1 6F EB B0 A3 4F 02 D4  Áoë°£OÔ
001FDC00  BB 28 55 F1 BB A2 4C 09  »(Uñ»¢L.
001FDC08  67 61 6D 65 2E 65 78 65  game.exe
001FDC10  20 30 34 2F 30 39 2F 30  04/09/0
001FDC18  37 20 32 32 3A 31 35 3A  7 22:15:
001FDC20  33 34 20 32 31 32 39 39  34 21299
001FDC28  32 30 00 68 65 69 6C 69  20.heili
001FDC30  67 65 73 77 61 73 73 65  geswasse
001FDC38  72 00                    r.
[/code]

the one of the Stealthbot

[code]
001FB150  FF 51 92 00 05 99 2D 07  ÿQ’.™-
001FB158  00 0B 00 01 24 D5 DB F2  . .$ÕÛò
001FB160  02 00 00 00 00 00 00 00  .......
001FB168  10 00 00 00 06 00 00 00  ......
001FB170  9B 40 23 00 00 00 00 00  ›@#.....
001FB178  84 1C C0 AD 6C 76 3C 12  „À­lv<
001FB180  71 D2 EE 19 47 00 84 A0  qÒîG.„
001FB188  A8 FD 65 1E 10 00 00 00  ¨ýe...
001FB190  0A 00 00 00 A1 F4 10 00  ....¡ô.
001FB198  00 00 00 00 EE 31 0B 07  ....î1 
001FB1A0  9C 62 F7 E1 AD 52 76 E7  œb÷á­Rvç
001FB1A8  FE 1B 93 DF 75 82 86 C1  þ“ßu‚†Á
001FB1B0  67 61 6D 65 2E 65 78 65  game.exe
001FB1B8  20 30 34 2F 30 39 2F 30  04/09/0
001FB1C0  37 20 32 32 3A 31 35 3A  7 22:15:
001FB1C8  33 34 20 32 31 32 39 39  34 21299
001FB1D0  32 30 00 68 65 69 6C 69  20.heili
001FB1D8  67 65 73 77 61 73 73 65  geswasse
001FB1E0  72 00                    r.
[/code]

And here is my BNLS_CDKEY_EX and BNLS_CDKEY function

[code]
VOID BNLS_HashKey(CHAR* CDKey, BYTE KeyHash[9*4])
{
BYTE CDKEY_HASH[100] = {0};
DWORD pSize = 0;
*(DWORD*)&CDKEY_HASH[0] = BNET.ServerToken;
pSize += sizeof(DWORD);
strcpy((char*)CDKEY_HASH+pSize,CDKey);
pSize += strlen(CDKey) + 1;
SendBNLSPacket(CDKEY_HASH,BNLS_CDKEY,pSize);
printf("[BNLS] CDKey Hash sent!\n");

pSize = 0;
CHAR CDKEY_RESPONSE[100];

DWORD dwSize = recv(BNLS.sock,CDKEY_RESPONSE,100,0);
printf("[BNLS] CDKey Response! Packet Size: %d\n",dwSize);
pSize = 0x03; // Cutting away the Header
printf("[BNLS] CDKey Hash Bool %d\n",CDKEY_RESPONSE[pSize]);
pSize += sizeof(BOOL);
printf("[BNLS] CDKey Client Session Key 0x%x\n",*(DWORD*)&CDKEY_RESPONSE[pSize]);
BNET.ClientToken = *(DWORD*)&CDKEY_RESPONSE[pSize];
pSize += sizeof(DWORD);

for(UINT i = 0; i < 9*4; i++)
{
*(BYTE*)&KeyHash[i] = CDKEY_RESPONSE[pSize+i];
}
}

VOID BNLS_HashKeyEX(CHAR* CKey,DWORD SessionKey,BYTE* KeyHashBuffer)
{
#define CDKEY_SAME_SESSION_KEY          (0x01)
#define CDKEY_GIVEN_SESSION_KEY        (0x02)
#define CDKEY_MULTI_SERVER_SESSION_KEYS (0x04)
#define CDKEY_OLD_STYLE_RESPONSES      (0x08)

BYTE CDKEY_HASH[100] = {0};
DWORD pSize = 0;
*(DWORD*)&CDKEY_HASH[pSize] = 0xDEADC0DE; // Cookie
pSize+= sizeof(DWORD);
*(BYTE*)&CDKEY_HASH[pSize] = 1; // Amount of CDKeys
pSize+= sizeof(BYTE);
*(DWORD*)&CDKEY_HASH[pSize] = CDKEY_GIVEN_SESSION_KEY; // Flag
pSize+= sizeof(DWORD);
*(DWORD*)&CDKEY_HASH[pSize] = BNET.ServerToken; // Server Session Key
pSize+= sizeof(DWORD);
*(DWORD*)&CDKEY_HASH[pSize] = SessionKey; // Client Session Key
pSize+= sizeof(DWORD);
strcpy((CHAR*)CDKEY_HASH+pSize,CKey); // CD-Key
pSize+= strlen(CKey) + 1;

SendBNLSPacket(CDKEY_HASH,BNLS_CDKEY_EX,pSize);

BYTE CDKEY_RESPONSE[1024] = {0};
DWORD dwSize = recv(BNLS.sock,(CHAR*)CDKEY_RESPONSE,sizeof(CDKEY_RESPONSE),0);

pSize = 3; // Cutting away the Header

printf("[BNLS] BNLS_CDKEY_EX Response! Cookie: 0x%x\n",*(DWORD*)&CDKEY_RESPONSE[pSize]);
pSize += sizeof(DWORD);
printf("[BNLS] Requested CDKeys %d\n",*(BYTE*)&CDKEY_RESPONSE[pSize]);
pSize += sizeof(BYTE);
printf("[BNLS] Encrypted CDKeys %d\n",*(BYTE*)&CDKEY_RESPONSE[pSize]);
pSize += sizeof(BYTE);
printf("[BNLS] Bit Mask 0x%x\n",*(DWORD*)&CDKEY_RESPONSE[pSize]);
pSize += sizeof(DWORD);
printf("[BNLS] Client Session Key 0x%x\n",*(DWORD*)&CDKEY_RESPONSE[pSize]);
BNET.ClientToken = *(DWORD*)&CDKEY_RESPONSE[pSize];
pSize += sizeof(DWORD);
memcpy(KeyHashBuffer,CDKEY_RESPONSE+pSize, 9 * sizeof(DWORD));
pSize += sizeof(DWORD) * 9;
}

[/code]

And this is the way i call them

[code]
VOID SID_AUTH_INFO_HANDLER(BYTE* data,DWORD dwSize)
{
printf("[BNET] AUTH_INFO response\n");

CHAR ExeInfo[1024] = {0};
CHAR Mpqname[1024] = {0};

strcpy(Mpqname,(CHAR*)data + (sizeof(DWORD)*3) + sizeof(FILETIME) + 4);

BNET.ServerToken = *(DWORD*)&data[7]; // Extracting the Server Token


BNET.MPQNo = extractMPQNumber((CHAR*)data + (sizeof(DWORD)*3) + sizeof(FILETIME) + 4);
strcpy(BNET.ValueForma,
(CHAR*)data + ( (sizeof(DWORD)*3) + sizeof(FILETIME)
+ strlen((CHAR*)data + (sizeof(DWORD)*3) + sizeof(FILETIME) + 4) + 5));

BNLS_HashKey(CDKEY_CLASSIC,BNET.KeyClassic);
BNLS_HashKeyEX(CDKEY_EXPANSION,BNET.ClientToken,BNET.KeyLoD);

printf("ServerToken: 0x%x\nClientToken: 0x%x\nMPQNumber: %d (%s)\nValueForma: %s\n",
BNET.ServerToken,BNET.ClientToken,BNET.MPQNo,
(CHAR*)data + (sizeof(DWORD)*3) + sizeof(FILETIME) + 4,BNET.ValueForma);

BNLS_CheckRevision();

printf("EXEChecksum: 0x%x\nEXEVersion: 0x%x\nEXEInformations: %s\n",
BNET.EXEChecksum,BNET.EXEVersion,BNET.ExeInformations);

PACKET_GENERATE();
PACKET_ADDDWORD(BNET.ClientToken)
PACKET_ADDDWORD(BNET.EXEVersion)
PACKET_ADDDWORD(BNET.EXEChecksum)
PACKET_ADDDWORD(0x02)
PACKET_ADDDWORD(0x00)
memcpy(PACKET_BUF+PACKET_POS,BNET.KeyClassic,sizeof(DWORD)*9);
PACKET_POS+=sizeof(DWORD)*9;
memcpy(PACKET_BUF+PACKET_POS,BNET.KeyLoD,sizeof(DWORD)*9);
PACKET_POS+=sizeof(DWORD)*9;

PACKET_ADDNULLSTRING(BNET.ExeInformations)
PACKET_ADDNULLSTRING("heiligeswasser");

PACKET_SEND(SID_AUTH_CHECK);
}
[/code]


I really don't know what is wrong

[quote]
[BNLS] Connecting...
[BNLS] Connected!
[BNET] Connecting... to europe.battle.net:6112
[BNLS] BNLS Keep-Alive Thread started!
[BNET] Connected!
[BNLS] Requesting VersionByte ..
[BNLS] VersionByte Response (11)! Version Byte is 0xb
[BNET] SID_AUTH_INFO sent!
Total PacketSize: 112
Packet Size: 8
[BNET] Ping Packet (8)
Packet Size: 8
[BNET] AUTH_INFO response
[BNLS] CDKey Hash sent!
[BNLS] CDKey Response! Packet Size: 47
[BNLS] CDKey Hash Bool 1
[BNLS] CDKey Client Session Key 0x4eea2bd4
[BNLS] BNLS_CDKEY_EX Response! Cookie: 0xdeadc0de
[BNLS] Requested CDKeys 1
[BNLS] Encrypted CDKeys 1
[BNLS] Bit Mask 0x1
[BNLS] Client Session Key 0x4eea2bd4
ServerToken: 0xe9f86800
ClientToken: 0x4eea2bd4
MPQNumber: 0 (ver-IX86-0.mpq)
ValueForma: B=3950895140 C=1114806514 A=3221168465 4 A=A^S B=B-C C=C+A A=A+B
[BNLS] VERSIONCHECK sent!
[BNLS] VERSIONCHECK response!
[BNLS] VERSIONCHECK_RESPONSE was sucessfull(1)
EXEChecksum: 0x6a58340c
EXEVersion: 0x1000b00
EXEInformations: game.exe 04/09/07 22:15:34 2129920
Total PacketSize: 9
Packet Size: 9
Type: 0x20000
[BNET] Connection Closed!
[/quote]

My Program output


[Kp edit: broke long lines.]
September 11, 2007, 6:37 PM

Search