• Welcome to Valhalla Legends Archive.
 

Packet Tutorials

Started by Lenny, July 23, 2003, 11:20 PM

Previous topic - Next topic

Camel

You're missing a few flags, CrAz3D

   'Flags (in order of appearance)
   '0x1 - Blizzard rep
   '0x8 - Bnet rep
   '0x2 - Channel op
   '0x4 - Speaker
   '0x40 - Blizzard guest
   '0x20 - Squelched
   '0x400 - PGL official
   '0x200 - PGL player

   '0x10 - No UDP support (plug replaces lag)

Lenny

Can someone teach me how to utilize the Packet Buffer?  THe one created by Darkminion specifially :-\
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

CrAz3D

My oops, thnx Camel.
Quote
Can someone teach me how to utilize the Packet Buffer?  THe one created by Darkminion specifially  
Like PacketBuffer.sendPacket?
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Dark-Feanor

I will post my tutorial thing up here. It is still incomplete, but it gets the job done.
QuoteInformation on reading packetlog information (hex) and using DarkMinion's PacketBuffer Class.
-Writen by Feanor[xL] aka DaRk-FeAnOr

Most of battle.net connection is run on TCP packets. A good packet
logger to use is WPE packet logger or Ufasoft's packet logger
(found at www.ufasoft.com). When you packet log a program, you will get
a whole lot of hex, that for new programmers is difficult to
understand.

Your first question is probably: Why is packet logging important?

The answer to this is, that in order to write about anything that has to do with battle.net,
you must packetlog it and emulate the packets that your computer sends to battle.net and
recieves from them. For example, we will anaylze Packet 0x1C. You must send this packet to
battle.net in order to create a game.


Here is an example of packet: 0x1C (which is used to create games)
- Packet log taken from Barumonk[xL]'s Melee winbot.

0000  FF 1C 5B 00 00 00 00 00 00 00 00 00 02 00 01 00    ..[.............
0010  1F 00 00 00 00 00 00 00 53 6F 6D 65 47 61 6D 65    ........SomeGame
0020  4E 61 6D 65 00 00 2C 34 34 2C 31 34 2C 36 2C 32    Name..,44,14,6,2
0030  2C 32 2C 31 2C 36 38 36 34 34 37 30 33 2C 34 2C    ,2,1,68644703,4,
0040  2C 6E 65 74 77 6F 72 6B 7A 0D 54 68 65 20 4C 6F    ,networkz.The Lo
0050  73 74 20 54 65 6D 70 6C 65 0D 00 FF 10 04 00       st Temple......

The first collum of information with (0000, 0010, 0020 etc.) should be ignored.
The hex begins with the packet FF. Most battle.net packets begin with FF and the Pbuffer class
writen by DarkMinion, takes this into account when sending packets. The next packet after FF is
the name of the packet that you are sending. The Visual Basic for this packet would look like:

With PacketBuf
   .InsertDWORD &H0
   .InsertDWORD &H0
   .InsertWORD &H2
   .InsertWORD &H1
   .InsertDWORD &H1
   .InsertDWORD &H0
   .InsertNTString gamename
   .InsertNTString gamename
   .InsertNonNTString gameinfo
   .sendPacket &H1C
End With

Now compare this to the hex you see above. Lets brake the hex down:

FF 1C (header of hex)
5B 00 (ignore)
00 00 00 00 (first DWord)     .InsertDWORD &H0
00 00 00 00 (Second DWord)    .InsertDWORD &H0
02 00 (first Word)            .InsertWORD &H1
01 00 (second word)           .InsertWORD &H1
1F 00 00 00 (third DWord)   .InsertDWORD &H1F
00 00 00 00 (forth DWord)     .insertDWord &H0

The rest of the information is the gamename and gameinfo writen into the hex.
FF 10 04 00 (start of next packet)-
sometimes you get two packets being sent in the same packet log.

You might be asking yourself what a DWOrd and word is. Here is how it works

DWord is the inserted byte, followed by three 0s.
Example:
.InsertDWORD &H1

in the hex it translates to
01 00 00 00

Word inserts the byte, followed by one 0.
Example:
.insertWord &H1
01 00

Some other functions are:
.insertbyte &H1
Which inserts the selected byte followed by no 0s
.insertbytes "01 00 00 00"
which inserts a bitch load of bytes at the same time
Insertbytes is good to use if you are too lazy to put everything into DWords and words.

Also, for inserting strings to hex you can use
.insertNTstring "hey"
and
.insertnonNTstring "hey"
I am pretty sure that the difference is that a NTstring is followed by a 0x00 (null) packet and an NONnTstring is not.


That is about it. The best way to learn is by trial and error, but I hope this helped. [/quote
- Feanor[xL]
clan exile
Firebot
iago: "caps lock is like cruise control for cool"

Mesiah / haiseM

Not bad, but i think your using your terms wrong in a few places, might wanna overlook it.
]HighBrow Innovations
Coming soon...

AIM Online Status: 

Lenny

Quote from: CrAz3D on July 27, 2003, 08:59 AM
My oops, thnx Camel.
Quote
Can someone teach me how to utilize the Packet Buffer?  THe one created by Darkminion specifially  
Like PacketBuffer.sendPacket?

Yes...
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Dark-Feanor

I just posted that two up.
- Feanor[xL]
clan exile
Firebot
iago: "caps lock is like cruise control for cool"

Lenny

Quote from: DaRk-FeAnOr on July 29, 2003, 09:49 AM
I just posted that two up.

It's helped me understand packet tutorials but I'm still not quite sure how to create packets
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Mesiah / haiseM

its all in your structure, in binary protocol, there are bytes (00), words (00 00), dwords (00 00 00 00), qwords (00 00 00 00 00 00 00 00), strings (hi my name is bob), and null terminated strings (hi my name is bob, followed by a null byte {00}), you will need to format your data for each term that is required.

here are the examples once again to see more clearly:

byte - 00
word - 00 00
dword - 00 00 00 00
qword - 00 00 00 00 00 00 00 00
string - hi my name is bob
null terminated string - hi my name is bob + 00

using darkminions packet buffer will allow you to stack these in order to form your packet, then you just need to slap the header on it, and send it...
]HighBrow Innovations
Coming soon...

AIM Online Status: 

Lenny

Do I always need to send the null string?  And how do I process recieved packets?
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Dark-Feanor

It automatically does the null bytes for you, based on the type of byte you added (Dword, Word, Byte, ect.)
- Feanor[xL]
clan exile
Firebot
iago: "caps lock is like cruise control for cool"

Lenny

How Do I process recieved packets from battle.net?
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

CrAz3D

rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Lenny

The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Eibro

I fail to understand what a "Packet Tutorial" would entail. It seems to me what ye lassies really need is a basic understanding of computer organization/architecture.
Eibro of Yeti Lovers.

|