• Welcome to Valhalla Legends Archive.
 

Fast question about a packet

Started by option, June 19, 2008, 03:17 PM

Previous topic - Next topic

option

Yeah I got that, I was strictly referring to strings you insert as DWORDs. Thanks for the clarification though
option's BNET Development Blog
Current project: Fully-modular 100% C++ SCBW ChatBot
Current Task: Write the Packet Debuffer
New to BNET development like myself? Read and learn.
http://bnetdev.tech-vault.net/

brew

No, not at all. Did you notice how I used single quotes? I put in a DWORD, not a string.
For example...
' ' is the same as putting in 0x20
'0' is the same as putting in 0x30
'!' is the same as putting in 0x21
'IX86' is the same as putting in 0x49583836.
Do you see?
So when you do something like... i = strchr(asdf, '0');, you're passing 0x30 as the second parameter. Notice how it asks for an int, not a string :P
Same thing with assigning a value to a byte...
Say you want to cut off the \n from a string after you called fgets().
I would do something like so:

asdf[strlen(asdf) - 1] = 0;

However, that's just my coding style. Others might have made the 0 instead '\0'. That doesn't matter, since they're the same.


Also, your myPacket.insertDWORD("whateverNTstringyouneedtosend"); wouldn't work at all. I assume insertDWORD takes an unsigned long (hence insertdword), not a string pointer. Putting that code in would result in an error. For inserting NT strings, you should check out mypacket.insertNTString.

EDIT* Whoops, didnt see mynd's post.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

option

Alright, so just for my reference, this is what I just did - just to see if I was on the same page as you guys.

putting 'IX86' into an unsigned long int, is the same as putting in 0x49583836, which I understand.

#include <iostream>

const unsigned long int IX86 = 'IX86';

using namespace std;

int main () {
cout << IX86 << endl;

return 0;
}


My program returns 1230518326.

That isn't IX86 the string in ASCII, HEX, or octal. What is it?
option's BNET Development Blog
Current project: Fully-modular 100% C++ SCBW ChatBot
Current Task: Write the Packet Debuffer
New to BNET development like myself? Read and learn.
http://bnetdev.tech-vault.net/

Barabajagal

Convert 1230518326 to hexadecimal and you get 0x49583836

FrostWraith

If you used a little C, (I dont know much about iostream), you could output it like this:
#include <stdio.h>

const unsigned long int IX86 = 'IX86';


int main (void)
{
printf("%X\n", IX86);

return 0;
}

option

Quote from: Andy on June 20, 2008, 02:37 PM
Convert 1230518326 to hexadecimal and you get 0x49583836

Do I need to do that before I send the packet?
option's BNET Development Blog
Current project: Fully-modular 100% C++ SCBW ChatBot
Current Task: Write the Packet Debuffer
New to BNET development like myself? Read and learn.
http://bnetdev.tech-vault.net/

Hdx

Quote from: option on June 20, 2008, 03:06 PM
Quote from: Andy on June 20, 2008, 02:37 PM
Convert 1230518326 to hexadecimal and you get 0x49583836

Do I need to do that before I send the packet?
he was just stating a fact.
90% of the time when you're talking about data you put it in hex, unless its <100~
What language you working in?
if its any C style language you can simply do 'IX86' wherever you would out it's int value. But if its in other languges you have to convert it: 0x49583836

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

option

Damn andy, you weren't kidding:



Took forever haha

Yeah Hdx I am working in VC++, so the point is, I could just put IX86 into a DWORD, as is, without reversing it, and then send the packet?
option's BNET Development Blog
Current project: Fully-modular 100% C++ SCBW ChatBot
Current Task: Write the Packet Debuffer
New to BNET development like myself? Read and learn.
http://bnetdev.tech-vault.net/

Barabajagal

The values 'IX86', 1230518326, and 0x49583836 are all equal. They're identical. There is no distinction between them.

option

Oh man that's sweet to know.

Alright, now I need a C++ packet buffer so I can pick apart and learn how it works, can't create one myself at the moment because of lack of concept knowledge, all tutorials I've found through search are down (domains), and there seems to be like 4354354 C# ones, but no C++ ones.

:(

PS even though  these questions are rather newb, at least I'm giving you something to do :P
option's BNET Development Blog
Current project: Fully-modular 100% C++ SCBW ChatBot
Current Task: Write the Packet Debuffer
New to BNET development like myself? Read and learn.
http://bnetdev.tech-vault.net/

Spht

Quote from: option on June 20, 2008, 03:37 PM
Damn andy, you weren't kidding:

Wow, what is this the 1800's?  most operating systems have a built-in calculator

option

hahah yeahhh well I just learned a lot about bytes, words, dwords, binary, hex, and just wanted to make sure I could actually do the conversion, so instead of just calculating it I tested my knowledge at the same time haha
option's BNET Development Blog
Current project: Fully-modular 100% C++ SCBW ChatBot
Current Task: Write the Packet Debuffer
New to BNET development like myself? Read and learn.
http://bnetdev.tech-vault.net/

Yegg

Quote from: option on June 20, 2008, 04:33 PM
hahah yeahhh well I just learned a lot about bytes, words, dwords, binary, hex, and just wanted to make sure I could actually do the conversion, so instead of just calculating it I tested my knowledge at the same time haha

At least it's written proof you're serious about learning.

Sorc.Polgara

I see summer break has started, and so you have free time now.  I wondered what happen.  You kind of disappeared, I thought maybe BotDev sacred you away, heh.  Btw, the link in your sig is broken.

option

It will most definitely be updated soon, it's at another host at the time being.

And yes I am back, school takes up a good amount of time, but i finished a few more programming courses and am armed with even more knowledge now so I am looking forward to getting back in the swing of things here!
option's BNET Development Blog
Current project: Fully-modular 100% C++ SCBW ChatBot
Current Task: Write the Packet Debuffer
New to BNET development like myself? Read and learn.
http://bnetdev.tech-vault.net/

|