Author | Message | Time |
---|---|---|
spear | Hey. Im trying to parse 0X7F (Clan member update), and I am almost totally lost. So far, all I have been able to get out of it is this: (My packet dump:) [code] Unidentified Packet: 0x7F Recieved On: 4/3/2005 At: 1:55:23 PM 0000: FF 7F 0D 00 41 72 6D 79 7A 00 03 01 00 ÿ..Spear..... [/code] [code] Asc(Mid(Data, 10 + Len(Trim(Split(Mid(Data, 10), Chr(0))(0))) + 1, 1)) [/code] This returns 0 or 1, depending if the user is going offline or comming offline. That's all fine and dandy, but I am struggling to get the username and the rank, in the same way I got the the online/offline status, so I can use it appropriatley in my Clan list. If somebody could show me how to get these, (username/rank), it would help me tons. Any help would be greatly appreciated. | April 3, 2005, 7:06 PM |
UserLoser. | I know you're new and all, and we should be nice to new people.. but if you wrote the rest of the bot you should be able to pick apart the packet into a string and three bytes | April 3, 2005, 7:23 PM |
BaDDBLooD | [quote author=UserLoser link=topic=11177.msg107181#msg107181 date=1112556228] I know you're new and all, and we should be nice to new people.. but if you wrote the rest of the bot you should be able to pick apart the packet into a string and three bytes [/quote] It is possible he is using a Open Source Project as a starting point, or.... something else. | April 3, 2005, 7:57 PM |
Soul Taker | Then he should be researching this kind of stuff. | April 3, 2005, 11:44 PM |
BaDDBLooD | [quote author=Soul Taker link=topic=11177.msg107212#msg107212 date=1112571893] Then he should be researching this kind of stuff. [/quote] Yeah.. ok, you got me on that one. | April 4, 2005, 12:44 AM |
spear | Could anybody reccomend some sites where I could reasearch this? | April 4, 2005, 3:35 AM |
spear | That doesnt help me find the stuff withing the packet and 'extract it', all that does is tell me that it's there. Well no duh... | April 4, 2005, 7:13 PM |
KkBlazekK | Learn VB? | April 4, 2005, 7:23 PM |
Quarantine | http://bnetdocs.valhallalegends.com/content.php?Section=d&id=8 | April 4, 2005, 7:33 PM |
spear | [quote author=Blaze link=topic=11177.msg107318#msg107318 date=1112642611] Learn VB? [/quote] Right, that was a pretty stupid reply. I'm asking for websites where I can learn about this stuff, so yeah... | April 4, 2005, 8:13 PM |
KkBlazekK | If you know the language, taking a string here, and a string there shouldn't be to difficult. | April 4, 2005, 8:15 PM |
HdxBmx27 | [code]0000: FF 7F 0D 00 41 72 6D 79 7A 00 03 01 00 ÿ...Spear...[/code] [quote](STRING) Username (BYTE) Rank (BOOLEAN) Online (8-bit) (BYTE) Unknown[/quote] Hurm, lets work through this: [code]FF 7F 0D 00 ÿ...[/code] The header, Dont need this, toss it. So the next thing to come would be a String.... [code]41 72 6D 79 7A 00 Spear.[/code] Strings for *most* Binary servers are Null terminated, so the string ends at Chr$(&H0), So you trim it off resulting in: Spear Next to come is a Byte, for the rank. [code]03 .[/code] Byte = 1 byte.. the smallest thing above a bit... This byte is used to determin the rank, so compare it to this list:[quote]0x00: Initiate that has been in the clan for less than one week 0x01: Initiate that has been in the clan for over one week 0x02: Member 0x03: Officer 0x04: Leader[/quote] and you get the person is an Officer. Now next to come is a Boolean(8-bit). [code]01 .[/code]a boolean (8-bit) is just a byte, that only has two possible values, 0 and 1. 1 byte = 8 bits, Just fyi. The value ofp this one is 1, so he is online. Next is the unknow, dont need it so jsut get rid of it. It's not that hard, just work form the biginning of the packet, and remove what you have parsed. Untill you eaither get good, or make a Packet-DeBuffer object, you'll use a lot of Data = Mid(Data, #)'s I HIGHLY suggest you do some other work with binary values, before you get into a Bnet bot. ~-~(HDX)~-~ | April 4, 2005, 11:12 PM |
Myndfyr | [quote author=HdxBmx27 link=topic=11177.msg107351#msg107351 date=1112656327] Strings for *most* Binary servers are Null terminated [/quote] I am not meaning to pick on you, but this particular statement is erroneous. Strings for all of Battle.net's binary protocol are null-terminated. However, it is often an inefficient way to store strings in terms of speed for reading. The C language encodes strings with a null terminator, allowing for variable-length strings of as much length as memory allows. Other languages -- Pascal comes to mind -- prefix the string with a byte indicating its length. So for instance, the string "Spear" would be encoded: [code]05 53 70 65 61 72[/code] Strings encoded this way are called "Pascal strings." Other languages use a similar method of encoding strings, but instead of using a single byte to encode the length -- which limits the length of the string to 255 -- they use two bytes. These strings are called "Wide Pascal" strings and can store up to 65,535 characters. So just as a heads-up -- don't assume that all strings in all binary formats are null-terminated. I know since .NET strings are interned, there is a performance hit associated with making strings by reading them a character at a time, and so .NET strings are stored as Wide Pascal when using the Framework's binary reader/writer classes. | April 4, 2005, 11:30 PM |
HdxBmx27 | Well, Thanks for that information, But I was pertaing to the Chr$(&HA) terminated strings used in Some parts of D2GS, and D2 Realm. But thats for telling me things I don't know, I'll try and remeber it. Anything else you fnd even slightly errorus? (besides grammar and spelling) ~-~(HDX)~-~ | April 4, 2005, 11:38 PM |
Kp | Byte is not the next biggest thing after bit. A nibble (4 bits) comes between them. | April 5, 2005, 2:37 AM |
UserLoser. | [quote author=HdxBmx27 link=topic=11177.msg107351#msg107351 date=1112656327] [code]0000: FF 7F 0D 00 41 72 6D 79 7A 00 03 01 00 ÿ...Spear...[/code] [quote](STRING) Username (BYTE) Rank (BOOLEAN) Online (8-bit) (BYTE) Unknown[/quote] Hurm, lets work through this: [code]FF 7F 0D 00 ÿ...[/code] The header, Dont need this, toss it. So the next thing to come would be a String.... [code]41 72 6D 79 7A 00 Spear.[/code] Strings for *most* Binary servers are Null terminated, so the string ends at Chr$(&H0), So you trim it off resulting in: Spear Next to come is a Byte, for the rank. [code]03 .[/code] Byte = 1 byte.. the smallest thing above a bit... This byte is used to determin the rank, so compare it to this list:[quote]0x00: Initiate that has been in the clan for less than one week 0x01: Initiate that has been in the clan for over one week 0x02: Member 0x03: Officer 0x04: Leader[/quote] and you get the person is an Officer. Now next to come is a Boolean(8-bit). [code]01 .[/code]a boolean (8-bit) is just a byte, that only has two possible values, 0 and 1. 1 byte = 8 bits, Just fyi. The value ofp this one is 1, so he is online. Next is the unknow, dont need it so jsut get rid of it. It's not that hard, just work form the biginning of the packet, and remove what you have parsed. Untill you eaither get good, or make a Packet-DeBuffer object, you'll use a lot of Data = Mid(Data, #)'s I HIGHLY suggest you do some other work with binary values, before you get into a Bnet bot. ~-~(HDX)~-~ [/quote] Actually, a boolean in VB is two bytes | April 5, 2005, 2:38 AM |