Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: shout on June 19, 2004, 11:11 PM

Title: How to connect bot to bnet.
Post by: shout on June 19, 2004, 11:11 PM
I have started to teach myself how to program, and I would like to create a bnet client, but truth is, im a programming noob. Could someone tell me how to connect?
Title: Re:How to connect bot to bnet.
Post by: dodge on June 19, 2004, 11:13 PM
depends on how much VB you know, if not a lot then go here http://www.valhallalegends.com/cuphead/ocx_me.txt theres a tutorial

but, one thing has changed, the accept is: 579728

you'll know what i mean when you read more into the tutorial.
Title: Re:How to connect bot to bnet.
Post by: shout on June 19, 2004, 11:16 PM
Im not using vb, Im using C#.Net, and Ive tried using VB and the OCX to make a bot but found it far too EZ. I kind of want a challenge.
Title: Re:How to connect bot to bnet.
Post by: dodge on June 19, 2004, 11:20 PM
alright then i cant help you. or if you want a challenge use VB and use winsocks to connect. then teach me! lol
Title: Re:How to connect bot to bnet.
Post by: Blaze on June 20, 2004, 02:18 PM
You can get a cleanslatebot to connect to botnet?
Title: Re:How to connect bot to bnet.
Post by: UserLoser. on June 20, 2004, 02:56 PM
Quote from: Kk)Blaze(kK on June 20, 2004, 02:18 PM
You can get a cleanslatebot to connect to botnet?

Nobody mentioned BotNet...
Title: Re:How to connect bot to bnet.
Post by: shout on June 20, 2004, 03:36 PM
I got a bot to connect to battle.net with the OCX, and I had it in the channel, but it took me like 10 minutes to make and that is kind of the noobs way out...

Here is what I know: When I connect, I have to send something like "Chr(1)", but I have no idea what that is. Then I send 0x50, and battle.net send 0x50 and 0x25 back. (I think).

Please help a failing noob!
Title: Re:How to connect bot to bnet.
Post by: CrAz3D on June 20, 2004, 03:44 PM
I remember seeing that Myndfyre has posted quite a bit abuot C# Battle.Net prograqmming.  It has been rather recently also, try just scanning the topic names in this forum for aobut 4-5 pages.
Title: Re:How to connect bot to bnet.
Post by: Eli_1 on June 20, 2004, 07:39 PM
Quote from: shout on June 20, 2004, 03:36 PM
I got a bot to connect to battle.net with the OCX, and I had it in the channel, but it took me like 10 minutes to make and that is kind of the noobs way out...

If you want to make it a little more challenging, try doing it using the API calls instead of the OCX (there's a post about this in the Visual Basic forum, only 4-5 topics down).

Quote
Here is what I know: When I connect, I have to send something like "Chr(1)", but I have no idea what that is.

Chr(1) is the "character" equivalent of 1. Exactly the same as the character equivalent of 61 is "a" ( Chr(61) ).

Quote
Then I send 0x50, and battle.net send 0x50 and 0x25 back. (I think).

Yes, I think that's right too. But note, you don't literally send "0x50." 0x50 is an identifier of a packet. To figure out what that packet (0x50) contains, you could packet log a client sending it, and figure it out from there, or go on bnetdocs and look it up there. (//bnetdocs.valhallalegends.com)
Title: Re:How to connect bot to bnet.
Post by: StepAside on June 20, 2004, 08:38 PM
Packet log.
Title: Re:How to connect bot to bnet.
Post by: shout on June 20, 2004, 09:19 PM
Now how would I packet log, assuming that packet log is a verb phrase.
Title: Re:How to connect bot to bnet.
Post by: GoSuGaMING on June 20, 2004, 09:21 PM
Quote from: shout on June 20, 2004, 09:19 PM
Now how would I packet log, assuming that packet log is a verb phrase.

download WPE Pro?

1  Hide  Hide  67  Send  
0000  01 FF 50 3A 00 00 00 00 00 36 38 58 49 50 58 45    ..P:.....68XIPXE
0010  53 C9 00 00 00 00 00 00 00 00 00 00 00 00 00 00    S...............
0020  00 00 00 00 00 00 00 00 00 55 53 41 00 55 6E 69    .........USA.Uni
0030  74 65 64 20 53 74 61 74 65 73 00 FF 25 08 00 00    ted States..%...
0040  00 00 00                                           ...

there is 0x50 which is the first packet you send to battle.net
Title: Re:How to connect bot to bnet.
Post by: shout on June 20, 2004, 09:24 PM
Can I get link?
Title: Re:How to connect bot to bnet.
Post by: GoSuGaMING on June 20, 2004, 09:29 PM
Quote from: shout on June 20, 2004, 09:24 PM
Can I get link?

www.gosugaming.net/WPEPro.zip
Title: Re:How to connect bot to bnet.
Post by: shadypalm88 on June 20, 2004, 11:27 PM
Well, if you don't want to packetlog, there's always BnetDocs (http://bnetdocs.valhallalegends.com/).  It contains much information on the messages sent back and forth between you and Battle.Net, how they're formatted, and the correct orders to do so.  If you understand network programming, or can teach yourself, you'll want to check this out.
Title: Re:How to connect bot to bnet.
Post by: GoSuGaMING on June 20, 2004, 11:44 PM
Quote from: shadypalm88 on June 20, 2004, 11:27 PM
Well, if you don't want to packetlog, there's always BnetDocs (http://bnetdocs.valhallalegends.com/).  It contains much information on the messages sent back and forth between you and Battle.Net, how they're formatted, and the correct orders to do so.  If you understand network programming, or can teach yourself, you'll want to check this out.

BnetDocs doenst give you the code... you would have to packetlog ... all it does is give u the structor of the packet
Title: Re:How to connect bot to bnet.
Post by: Spht on June 20, 2004, 11:49 PM
Quote from: GoSuGaMING on June 20, 2004, 11:44 PM
Quote from: shadypalm88 on June 20, 2004, 11:27 PM
Well, if you don't want to packetlog, there's always BnetDocs (http://bnetdocs.valhallalegends.com/).  It contains much information on the messages sent back and forth between you and Battle.Net, how they're formatted, and the correct orders to do so.  If you understand network programming, or can teach yourself, you'll want to check this out.

BnetDocs doenst give you the code... you would have to packetlog ... all it does is give u the structor of the packet

BnetDocs is so you DON'T have to packet log / disassemble to figure out the structure of messages.  It'd be a pain to provide generalized code for every language on how to deal with them.
Title: Re:How to connect bot to bnet.
Post by: shout on June 21, 2004, 11:04 AM
I understand the packet stuff...

I would kind of like to know how I would decode the CD-Key and use local hashes.

I realize that BNLS is a service that I can use, but I would rather learn how to hash locally.
Title: Re:How to connect bot to bnet.
Post by: shadypalm88 on June 21, 2004, 11:44 AM
Quote from: shout on June 21, 2004, 11:04 AM
I understand the packet stuff...

I would kind of like to know how I would decode the CD-Key and use local hashes.

I realize that BNLS is a service that I can use, but I would rather learn how to hash locally.
If you want to just use hashing locally, you could just pick up a copy of BnetAuth.dll (available here (http://www.ionws.net/BnetAuth.zip)) and link against that, or if you want to learn how, the C++ source for that is available online (one place being here (http://www.ionws.net/BnetAuthsrc.zip)).  Both links go to my site.

Optionally, maybe you could find the source to a bot that does it.  If you're looking for C-like code, maybe try zDS (one source here (http://newds.zefga.net/Files/zDSBot3Beta/zDSBot3-2109-src.tgz), also if you can use CVS there's information on the home page (http://newds.zefga.net/)).

(If you know VB, there's definitely no shortage of VB bots floating around...)
Title: Re:How to connect bot to bnet.
Post by: shout on June 21, 2004, 01:30 PM
How would I link BnetAuth.dll to a project in C#.net?
Title: Re:How to connect bot to bnet.
Post by: MyndFyre on June 21, 2004, 01:44 PM
You have to use P/Invoke calls.  Example:

One of the calls in BnetAuth.h is:


__declspec(dllexport)
BOOL _stdcall CheckVersion(LPCTSTR lpszFileName1, LPCTSTR lpszFileName2,
  LPCTSTR lpszFileName3, LPCTSTR lpszValueString,
  DWORD * lpdwVersion, DWORD * lpdwChecksum,
  LPSTR lpExeInfoString, LPCTSTR lpszMpqFileName);


Within a class, you specify:


[DllImport("BnetAuth.dll")]
public static extern bool CheckVersion(
 [MarshalAs(UnmanagedType.LPTStr)] string lpszFileName1,
 [MarshalAs(UnmanagedType.LPTStr)] string lpszFileName2,
 [MarshalAs(UnmanagedType.LPTStr)] string lpszFileName3,
 [MarshalAs(UnmanagedType.LPTStr)] string lpszValueString,
 out uint lpdwVersion, out uint lpdwChecksum,
 [MarshalAs(UnmanagedType.LPStr)] string lpExeInfoString,
 [MarshalAs(UnmanagedType.LPTStr)] string lpszMpqFileName);


All of the MarshalAs attribute declarations are not NECESSARY, but they are good in ensuring that code works across platforms.

Note that this only works for functions marked in the header as either "__declspec(dllexport)" or 'extern "C"'.
Title: Re:How to connect bot to bnet.
Post by: shout on June 21, 2004, 02:53 PM
I feel like the stupidist person in the world... but...

How exactly to I use DllImport? When I do it get a 'type or namespace not found' compiler error...
Title: Re:How to connect bot to bnet.
Post by: Sorc_Polgara on June 21, 2004, 03:02 PM
Where can I get this BnetAuth.dll?
Title: Re:How to connect bot to bnet.
Post by: Eli_1 on June 21, 2004, 03:04 PM
Quote from: Sorc_Polgara on June 21, 2004, 03:02 PM
Where can I get this BnetAuth.dll?

Do you ever even read people's posts? Someone already posted a link to it.
Title: Re:How to connect bot to bnet.
Post by: MyndFyre on June 21, 2004, 03:21 PM
Quote from: shout on June 21, 2004, 02:53 PM
I feel like the stupidist person in the world... but...

How exactly to I use DllImport? When I do it get a 'type or namespace not found' compiler error...

OK, part of the requirements of getting help (at least for me) is that you also have to be able to help yourself.  Look up the class DllImportAttribute in the .NET Framework SDK help documentation included with Visual Studio .NET or the .NET Platform SDK.

As it is, I believe it's in the System.Runtime.InteropServices namespace.  It should be included implicitly in any project referencing mscorlib.dll (implicitly included unless you explicitly deactivated it through project settings).
Title: Re:How to connect bot to bnet.
Post by: shout on June 21, 2004, 03:38 PM
Ah... The index had it under System.InteropServices... without runtime...

I get no errors now.