Author | Message | Time |
---|---|---|
Luxer | Could somone point me in the right direction? Completly clueless about packets.... | July 19, 2004, 11:37 PM |
LoRd | [quote author=Luxer link=board=17;threadid=7770;start=0#msg71394 date=1090280229] Could somone point me in the right direction? Completly clueless about packets.... [/quote] Search for a copy of the CleanSlateBot ocx. | July 20, 2004, 12:15 AM |
ChR0NiC | [quote] BNLS Headers BNLS is the Battle.Net Logon Server, and can be used by bot authors to perform the hashing required during a Battle.net logon. It also allows bot authors to obtain useful information such as the current version byte for a game client, and has provisions for BNCS server emulator authors. It has the following headers: (WORD) Packet Length, including this header (BYTE) Packet ID (VOID) Packet Data [/quote] Edit: [quote] String - Null terminated character array DWORD - 32 bit unsigned integer Word - 16 bit unsigned integer Byte - 8 bit unsigned integer [/quote] Edit: BNLS Protcol Spec <~ This wouldn't hurt either. Edit: BNET Docs <~ Has very nice documentation about most of the BNLS packets about three quarters down the page. | July 20, 2004, 12:16 AM |
Quarantine | Im pretty sure Feanor wrote a Tut on Packetlogging try snooping around Clan Exiles Site | July 20, 2004, 5:26 AM |
tA-Kane | [quote author=LoRd[nK] link=board=17;threadid=7770;start=0#msg71399 date=1090282536]Search for a copy of the CleanSlateBot ocx. [/quote]Not helpful when you're using a Mac (eg, RB). :P Luxor, I just sent a similar email to someone along the same lines (perhaps even he is you?); read this: [quote]1) You need to maintain a "lag buffer", whereas even if packets are lagged (that is, received between multiple DataAvailable events), you still receive them in their full entirety. This can be accomplished with something like this: In your BNLSSocket object, create a property: [code]LagBuffer As String[/code] Then, in your DataAvailable event: [code]Me.LagBuffer = Me.LagBuffer + Me.ReadAll[/code] Check to see if the length of the LagBuffer property is greater than or equal to the length of the first packet in the buffer. If so, then process the packet. If not, then return from DataAvailable and wait for more data (wait for another DataAvailable event). After processing the packet, be sure to remove the packet's header and data from the lag buffer, so that you don't process it again. All of the processing could (should) be done in a loop, in case you receive multiple packets in a single DataAvailable event. 2) You'll also need to be able to convert integers to binary strings and vice versa (that is, add a 32-bit number to a string as 4 bytes as well as read 4 bytes into a 32-bit number). Memory Blocks are useful for such. [code]Function IntToStr32(Value As Integer) As String Dim Mem As MemoryBlock Mem = NewMemoryBlock(4) Mem.Long(0) = Value Return Mem.StringValue(0,4) End Function Function StrToInt32(Value As String) As Integer Dim Mem As MemoryBlock Mem = NewMemoryBlock(4) Mem.StringValue(0,4) = MidB(Value,1,4) Return Mem.Long(0) End Function Function IntToStr16(Value As Integer) As String Dim Mem As MemoryBlock Mem = NewMemoryBlock(2) Mem.Short(0) = Value Return Mem.StringValue(0,2) End Function Function StrToInt16(Value As String) As Integer Dim Mem As MemoryBlock Mem = NewMemoryBlock(2) Mem.StringValue(0,2) = MidB(Value,1,2) Return Mem.Shortg(0) End Function Function SwapEndian(Value As Integer) As Integer Dim A, B As MemoryBlock A = NewMemoryBlock(4) B = NewMemoryBlock(4) A.Long(0) = Value B.Byte(0) = A.Byte(3) B.Byte(1) = A.Byte(2) B.Byte(2) = A.Byte(1) B.Byte(3) = A.Byte(0) Return B.Long(0) End Function[/code] Note that those simple functions are not enough; you will need to be able to convert integers between little endian and big endian format, as well as know when endian conversion is necessary. 3) Getting packet datas and IDs is simple enough..., here's some code taken (almost) straight from my BNLSSocket object, with a ton of comments added: [code]Sub BNLSSocket.DataAvailable() Dim PacketID, PacketLength, BufferLength As Integer Dim Data As String Me.LagBuffer = Me.LagBuffer + Me.ReadAll Me.BufferLength = LenB(Me.LagBuffer) Do If BufferLength < 3 Then 'Buffer length is less than even a simple header 'either no packet available, or it's an incomplete packet Return End If ID = AscB(MidB(Me.LagBuffer,3,1)) PacketLength = StrToInt16(MidB(Me.LagBuffer,1,2)) #if TargetMacOS 'Endian conversion is going to be needed for DataLength! PacketLength = SwapEndian(PacketLength) #endif If PacketLength < 3 Then Beep MsgBox "Sanity failure! Total packet length is less than the length of the header!" Else If BufferLength >= DataLength Then 'Lag buffer is long enough to contain the packet Data = MidB(Me.LagBuffer, 4, PacketLength-4) 'why DataLength-4, you ask? Well, Data variable should contain only 'the packet data, not packet header; so need to remove length of 'header from total packet length 'Now, remove the packet from the lag buffer Me.LagBuffer = MidB(Me.LagBuffer, PacketLength + 1) 'Now, process the packet Me.PacketReceived(ID, Data) Else'If BufferLength < DataLength Then 'Lag buffer is not long enough to contain the packet; 'Must wait for next DataAvailable event. Return End If End If 'Make sure BufferLength is still accurate, for next iteration of the loop! BufferLength = LenB(Me.LagBuffer) Loop Exception Error Beep MsgBox "Error!" End Sub[/code] Here's my definition of PacketReceived: [code]Sub BNLSSocket.PacketReceived(ID As Integer, Data As String) 'hopefully you can fill this in, eh? End Sub[/code] All of that should be plenty enough to get you started on BNLS. -- Thanks, Keith Bennett, tA-Kane Author of KaneBot Battle.net binary bot for Macintosh. http://linkware.clan-mac.com/kanebot > From: MacSc <email removed for this post> > Date: Mon, 19 Jul 2004 17:34:53 -0600 > To: Keith Bennett <kane@clan-mac.com> > Subject: Connecting with BNLS using RB > > Hey Keith, > I was wondering if you could give me some tips about BNLS connection. I > am completely clueless about these packets. Could you help? > > */\*\/*/\*\/*/\*\/*/\*\/*/\*\/*/\*\/*/\*\/*/\*\/*/\*\/*/\*\/* > Thanks, > > MacSc > email removed for this post [/quote] So uhh... yeah. Have fun with that. | July 20, 2004, 6:54 AM |
Luxer | Yep. That was me. Its Broken SHA-1, right? (If I ever want to to do local hashing) | July 22, 2004, 5:17 PM |
tA-Kane | [quote author=Luxer link=board=17;threadid=7770;start=0#msg71870 date=1090516672]Yep. That was me.[/quote]Neato.[quote author=Luxer link=board=17;threadid=7770;start=0#msg71870 date=1090516672]Its Broken SHA-1, right? (If I ever want to to do ocal hashing)[/quote]Yes, but I haven't written it for REALbasic, nor do I know anyone that has. Feel free to try if you want, there's plenty of source code available, and there's one that I wrote for C and use here: http://www.cubedivision.org/phpBB2/viewtopic.php?t=72 BNCSHashData() would be what you're looking for. | July 22, 2004, 5:27 PM |
Luxer | Thanks | July 22, 2004, 5:30 PM |
eBeL | [quote author=tA-Kane link=board=17;threadid=7770;start=0#msg71461 date=1090306499] [quote author=LoRd[nK] link=board=17;threadid=7770;start=0#msg71399 date=1090282536]Search for a copy of the CleanSlateBot ocx. [/quote]Not helpful when you're using a Mac (eg, RB). :P Luxor, I just sent a similar email to someone along the same lines (perhaps even he is you?); read this: {CLIPPED EMAIL}[/quote] Keith, That makes absolutly no sense. | August 7, 2004, 9:28 PM |
tA-Kane | It makes perfect sense to me. What part don't you understand? :-\ | August 9, 2004, 5:48 PM |
shadypalm88 | [quote author=eBeL link=board=17;threadid=7770;start=0#msg74535 date=1091914080]Keith, That makes absolutly no sense.[/quote] [quote author=LoRd[nK] link=board=17;threadid=7770;start=0#msg71399 date=1090282536]Search for a copy of the CleanSlateBot ocx.[/quote] CleanSlateBot.ocx is a Visual Basic control (Windows). [quote author=tA-Kane link=board=17;threadid=7770;start=0#msg71461 date=1090306499]Not helpful when you're using a Mac [/quote] Therefore, it will not work so well on Macintosh computers. [quote author=tA-Kane link=board=17;threadid=7770;start=0#msg71461 date=1090306499](eg, RB). :P[/quote]RB = RealBasic = a language/IDE similar to Visual Basic that can be used to write programs for Windows, Mac, and Linux computers. (Made sense to me. :P) | August 10, 2004, 3:03 AM |
eBeL | The entire email! Does anyone have a sample -> REALBASIC <- bot I can experiment with? I learn better and faster when I can actually see what is doing what :-\ | August 10, 2004, 11:50 PM |
Myndfyr | [quote author=eBeL link=board=17;threadid=7770;start=0#msg74961 date=1092181859] The entire email! Does anyone have a sample -> REALBASIC <- bot I can experiment with? I learn better and faster when I can actually see what is doing what :-\ [/quote] Chr0nic made a good point in the other post.... Here are my two cents about using source code. Don't lie. If you're using source code, use it and modify it as needed. Give credit to the person who wrote the code, and also ask permission to use it first. The point of programming is seeing a problem and and answering or fixing it. Your problem: you want a binary Battle.net bot. How do you solve it? By programming. If you don't want to learn how to solve the problem, I'm sure Kane's bot is nice :) | August 11, 2004, 12:31 AM |
eBeL | I would prefer to use someone elses an build off of that until I understand how to do it on my own. And I also understand what it feels like to have a project idea or application stolen from you. | August 11, 2004, 1:07 AM |
tA-Kane | Janky has abandoned his JXBot. His source code is (and has been for the last two years) freely available. I have a quick download link on my bot's website. Even though I'm told that the source code for JXBot doesn't even compile anymore with recent compilers, it wouldn't be hard to make it do so. All it would take is a minimal of effort to remove and/or fix (change?) linked images, language updates, and etc. Sure, JXBot isn't binary. I'd have to give you a point if you said that. But that doesn't mean that the code base isn't there. It supports a colored chat field (though you'd have to add your own 'Battle.net-style' color parser). Something it has that my KaneBot doesn't is that it has proxy support (though I don't know to what extent). And hey, here's another one-up on my bot: you can write your own commands in JXBot. I'm sure just about everyone would agree JXBot has a better interface than mine ;) Sure, the code might not be able to compile. But if you could get it to compile, there's many people out there who liked JXBot more than my bot. Get JXBot to compile, and release it as-is for Carbon (for Mac OS X), and you'd get an instant user base. Then it's just a matter of learning JXBot's code and redoing the connection code to support a binary connection. I could do all of this in two weeks. If I didn't have a job, I could do it in two days. But you see, I'm not interesting in bringing JXBot back. I don't like JXBot, nor do I need it. Why would I work on something which I don't want or need, and won't benefit me in some way? | August 11, 2004, 5:04 PM |
eBeL | Last I checked JXBot doesnt join private channels :| | August 11, 2004, 8:27 PM |
eBeL | [quote author=eBeL link=board=17;threadid=7770;start=15#msg75080 date=1092256060] Last I checked JXBot doesnt join private channels :| [/quote] I compiled it fine after doing TONS of changes... but it doesnt connect! | August 11, 2004, 8:54 PM |
Myndfyr | [quote author=eBeL link=board=17;threadid=7770;start=15#msg75084 date=1092257641] I compiled it fine after doing TONS of changes... but it doesnt connect! [/quote] [quote author=tA-Kane link=board=17;threadid=7770;start=0#msg75039 date=1092243891] Then it's just a matter of learning JXBot's code and redoing the connection code to support a binary connection. [/quote] Also, please do not post twice in a row. If you are the last person to have posted, please click the "Modify" link of your post, unless the content matter has changed significantly enough to warrant everyone reading it again. | August 11, 2004, 9:01 PM |
eBeL | Oh sry I normally look for "Edit" The thing is, I DO NOT KNOW BINARY :( | August 12, 2004, 12:52 AM |
Myndfyr | [quote author=eBeL link=board=17;threadid=7770;start=15#msg75108 date=1092271941] Oh sry I normally look for "Edit" The thing is, I DO NOT KNOW BINARY :( [/quote] Quit whining and learn it then. I didn't know how to make a binary connection to Battle.net before about a year ago. If you demonstrate that you have motivation to work here, people will help you. And now look at me! 011000110101101000110101001101011010111001011001110101001101110 001110011010101100011010000101000101010001111001010101000111100 0101010010111001010001101101010000111110101001011101010010101110101010101 [edit] I put in line breaks. [/edit] And that's just a small portion of what I know! | August 12, 2004, 12:55 AM |
Eli_1 | 01100011 01011010 00110101 00110101 10101110 01011001 11010100 11011100 01110011 01010110 00110100 00101000 10101000 11110010 10101000 11110001 01010010 11100101 00011011 01010000 11111010 10010111 01010010 10111010 1010101 ----> cZ55®YÔÜsV4(¨ò¨ñRåPú—Rºª You haven't learned anything! | August 12, 2004, 1:49 AM |
Myndfyr | LMAO! omg Eli! I was totally just typing random 1's and 0's, and after you posted what you posted -- was that what you had on the other thread -- we got the first 24 identically?!? Psh that's not what you posted: [quote author=Eli_1 link=board=17;threadid=8064;start=15#msg75099 date=1092265758] 00111110 01100101 01101011 01101111 01101010 00101111 00111100 00100000 01010000 00111010 00100000 00100001 01111001 01110010 01100001 01101110 01101001 01100010 00100000 01110111 01101111 01101110 01101011 00100000 01001001 [/quote] | August 12, 2004, 1:59 AM |
Eli_1 | No, mine actually means somthing. I just spaced yours like mine so it lined up, oh so nicely. :) | August 12, 2004, 2:07 AM |
Myndfyr | [quote author=Eli_1 link=board=17;threadid=7770;start=15#msg75129 date=1092276458] No, mine actually means somthing. I just spaced yours like mine so it lined up, oh so nicely. :) [/quote] Oh I see what you're saying now. Mine is.... uh.... in... North... Korean..... They are just using the wrong encoding. Yeah, that's it. | August 12, 2004, 2:08 AM |
eBeL | [quote author=MyndFyre link=board=17;threadid=7770;start=15#msg75109 date=1092272152] [quote author=eBeL link=board=17;threadid=7770;start=15#msg75108 date=1092271941] Oh sry I normally look for "Edit" The thing is, I DO NOT KNOW BINARY :( [/quote] Quit whining and learn it then. I didn't know how to make a binary connection to Battle.net before about a year ago. If you demonstrate that you have motivation to work here, people will help you. And now look at me! 011000110101101000110101001101011010111001011001110101001101110 001110011010101100011010000101000101010001111001010101000111100 0101010010111001010001101101010000111110101001011101010010101110101010101 [edit] I put in line breaks. [/edit] And that's just a small portion of what I know! [/quote] How or where can I do that? | August 12, 2004, 3:11 PM |
dRAgoN | [quote author=eBeL link=board=17;threadid=7770;start=15#msg75209 date=1092323469] [quote author=MyndFyre link=board=17;threadid=7770;start=15#msg75109 date=1092272152] [quote author=eBeL link=board=17;threadid=7770;start=15#msg75108 date=1092271941] Oh sry I normally look for "Edit" The thing is, I DO NOT KNOW BINARY :( [/quote] Quit whining and learn it then. I didn't know how to make a binary connection to Battle.net before about a year ago. If you demonstrate that you have motivation to work here, people will help you. And now look at me! 011000110101101000110101001101011010111001011001110101001101110 001110011010101100011010000101000101010001111001010101000111100 0101010010111001010001101101010000111110101001011101010010101110101010101 [edit] I put in line breaks. [/edit] And that's just a small portion of what I know! [/quote] How or where can I do that? [/quote] Grade 9 'general or advanced' intro to computers class. | August 12, 2004, 3:43 PM |
tA-Kane | [quote author=dRAgoN link=board=17;threadid=7770;start=15#msg75212 date=1092325382] [quote author=eBeL link=board=17;threadid=7770;start=15#msg75209 date=1092323469]How or where can I do that?[/quote]Grade 9 'general or advanced' intro to computers class.[/quote]I never went to 8th grade. I also have not been to 9th grade either. eBeL, if you've seriously been able to get JXBot to compile after a number of fixes, then I congradulate you. You've now been further than about 20 other people I've talked to over emails. Take some time and learn JXBot's code. REALbasic has a built-in debugger. Use that. Figure out why JXBot isn't connecting. Is it actually connecting, but parsing wrong? Are you telling it to connect, but it has the wrong address information input into the socket? All of these could be possible, it's your problem to find a solution. If it were me, I'd set a breakpoint on the menu handler for connect (if I remember correctly, JXBot would connect via a menu). Then, I'd always do command-[ (step-into) to follow along the code as it goes, and find where it's going awry. Also, even though JXBot is a CHAT bot (thusly, it cannot go into private channels, as you've stated), it's still a good code base. Chip away the old and bring about the new, and you will have a ready-made bot with ready users. Just don't be silly enough to change the name ;) I beleive you and Luxer were working on LuxerBot's auto-update feature together, were you not? If so, you could both look at this JXBot source code and try to devise a solution. Two heads are usually better than one. If you can get JXBot to connect to the CHAT gateway, talk, display whispers and joins and leaves and all that, and have bot actions, I might help you with getting it working on a binary connection. Take the initiative to show you've got the intelligence. | August 12, 2004, 4:11 PM |
eBeL | Alright, well I am off to get JXBot to connect :P I think it may have to do with the IP for the Bnet servers. EDIT: I changes the server IPS and connect but this is what I get: [code]<••©2000 Kevin Wood••> <••All rights reserved••> Connected! Logging in... Connectionfrom[**********] Enteryouraccountnameandpassword. Use'anonymous'ifyouonlywanttoissuequeries. Username: [/code] | August 12, 2004, 4:38 PM |
Myndfyr | [quote author=eBeL link=board=17;threadid=7770;start=15#msg75219 date=1092328739] Alright, well I am off to get JXBot to connect :P I think it may have to do with the IP for the Bnet servers. EDIT: I changes the server IPS and connect but this is what I get: [code]<••©2000 Kevin Wood••> <••All rights reserved••> Connected! Logging in... Connectionfrom[**********] Enteryouraccountnameandpassword. Use'anonymous'ifyouonlywanttoissuequeries. Username: [/code] [/quote] As Kane has said no less than twice.... JXBot is a CHAT bot. That means it uses the CHAT protocol, not binary protocol. The CHAT protocol is essentially a telnet connection over port 6112. Anyway, you'll enter your name and password there manually and be able to log in and chat in *public* channels. What Kane also suggested you do after that is to look into converting into a binary connection. There are ooodles and ooodles of information on binary connections in the vL forums. Check out the forum above this one (Battle.net Bot Development Reference I believe it is called), and look for information on getting started. Better yet, search! | August 12, 2004, 6:30 PM |
eBeL | It connects but doesnt log in, then loses the connection, I am going to look at the TCPsocket, it was usng a regular socket before, and get it to log in like with my chat bot I made before. (It is just a simple client with no commands and a very bad interface) EDIT: I got it to connect! Here is a screenshot, how can I fix the editfield? (the main chat box that receives people actions) http://www.theipn.com/JX-OSX.jpg | August 12, 2004, 7:21 PM |