• Welcome to Valhalla Legends Archive.
 

[C++] DarkMinions dyn buffer

Started by Okee, June 27, 2005, 09:00 PM

Previous topic - Next topic

Okee

I've been looking at DM's DynBuffer class for awhile, and decided to try to implement it in with my bot. This is C++, btw. I copied over the header and footer files, etc, and tried testing it by building a sample 0x50 packet. When I send it to bnet, it appears the buffer isn't holding the correct data. Here's my function:


dBuf.add((int)0);
dBuf.add((int)'IX86');
dBuf.add((int)szLocalAccountInfo.szGameAbbr);
dBuf.add((int)szLocalAccountInfo.lVerByte);
dBuf.add((int)0);
dBuf.add((int)0);
dBuf.add((int)480);
dBuf.add((int)1033);
dBuf.add((int)1033);
dBuf.add("USA");
dBuf.add("United States");
SendBNCSPacket(sckBNCS, SID_AUTH_INFO);


szGameAbbr holds the games abbreviation, in this case 'RATS', and the lVerByte holds the version byte. Now, when I packet log this packet this is how it appears...

Quote
2  Hide  Hide  58  Send 
0000  FF 50 3A 00 00 00 00 00 36 38 58 49 80 0E 44 00    .P:.....68XI..D.
0010  CB 00 00 00 00 00 00 00 00 00 00 00 E0 01 00 00    ................
0020  09 04 00 00 09 04 00 00 55 53 41 00 55 6E 69 74    ........USA.Unit
0030  65 64 20 53 74 61 74 65 73 00                      ed States.

Now, it's easy to see that it's not putting 'RATS' in there. It's putting.. a D? heh. Anyone know why?

Kp

Quote from: Okee on June 27, 2005, 09:00 PMNow, it's easy to see that it's not putting 'RATS' in there. It's putting.. a D? heh. Anyone know why?

Yes.  You told it to put in szGameAbbr, and it did.  Hint: think about the type of szGameAbbr.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

K

Well, guessing from your variable names, "szGameAbbr" is a char*. You're inserting the address of the string as an int instead of inserting the characters.

Edit -- quick response, Kp

DarkMinion

#3
And for god's sake, at least form the packet properly.....sending constants is always a bad idea.

You're sending a constant time zone, a null IP, etc....form the packet properly.  You never know when they'll start ipbanning for not doing it...


dBuf.add((int)0); //protocol
dBuf.add((int)'IX86'); //platform
dBuf.add(dwGame); //game
dBuf.add((int)uVersion); //game version byte
dBuf.add((int)0);
struct sockaddr_in sLocalAddr;
int iLocalLen = sizeof(sLocalAddr);
getsockname(sBNET, (struct sockaddr *)&sLocalAddr, &iLocalLen);
dBuf.add((int)sLocalAddr.sin_addr.s_addr); //dword ip
TIME_ZONE_INFORMATION Tzi;
unsigned long dwResult = GetTimeZoneInformation(&Tzi);
dBuf.add(Tzi.Bias + (dwResult == TIME_ZONE_ID_DAYLIGHT ? Tzi.DaylightBias : 0)); //time zone
dBuf.add((int)GetUserDefaultLCID()); //language
dBuf.add((int)GetUserDefaultLangID());
char szBuffer[0x41];
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, szBuffer, 0x40);
dBuf.add(szBuffer);
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGCOUNTRY, szBuffer, 0x40);
dBuf.add(szBuffer);
SendPacket(SID_AUTH_INFO);