News:

Holy shit, it's 2018 2019 2020 2021 2022 2023 2024, and the US isn't a fascist country! What a time to be alive.

Main Menu

[java] Sample w2bn login sequence

Started by chuck, September 17, 2006, 07:44:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

chuck

Does anyone know a way to get a profile correctly? I tryed:

            BNetBuffer buf = new BNetBuffer((byte) 0x26);
           
            buf.addDWord(1);
            buf.addDWord(4);
           
            buf.addNTString(account);
           
            buf.addNTString("profile\\sex");
            buf.addNTString("profile\\age");
            buf.addNTString("profile\\location");
            buf.addNTString("profile\\description");
           
            sendNow(buf);


Which my packet sniffer shows as:
T 192.168.2.135:49708 -> 63.240.202.129:6112 [AP]
  .&P.........FoeBot.profile\sex.profile\age.profile\location.profile\descriptio
  n.     

And my code to receive the packet look like:

case 0x26:
data.removeDWord(); // Num. accounts
int numKeys = data.removeDWord(); // Num. of keys
data.removeDWord(); // Request ID
                               
                               
String[] keys = new String[numKeys];
for (int z=0; z < numKeys; z++) {
keys[z] = data.removeNTString();
print(keys[z]);
}

Which always prints nothing. The packet bnet sends me back looks like:

T 63.240.202.129:6112 -> 192.168.2.135:49708 [AP]
  .&..........FoeB....                                                                                                           

I just cannot figure out how to send a String[] through a socket properly. Can anyone help me w/ this? Without flaming me?
Chucks Blog
JavaOp2 Plugins

Quote
Error, keyboard not connected. Press F1 to continue.

chuck

#31
NVM, found this document: http://www.valhallalegends.com/docs/ProfileRequest.htm

The code for other people (Sending profile request is the only one i changed for it to work)

    public void sendProfileRequest(String account) {
        try {
            BNetBuffer buf = new BNetBuffer((byte) 0x26);
           
            buf.addDWord(1);
            buf.addDWord(4);
           
            buf.addDWord(156); // some random number :)
           
            buf.addNTString(account);
           
            buf.addNTString("profile\\sex");
            buf.addNTString("profile\\age");
            buf.addNTString("profile\\location");
            buf.addNTString("profile\\description");
           
            sendNow(buf);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }


EDIT:
SS
Chucks Blog
JavaOp2 Plugins

Quote
Error, keyboard not connected. Press F1 to continue.

Chavo

Do you understand the difference between your code and the working code?

Shear luck is the only reason you were even getting a response with your code instead of being timebanned :)

chuck

#33
Quote from: unTactical on September 21, 2006, 06:54:07 PM
Do you understand the difference between your code and the working code?

Shear luck is the only reason you were even getting a response with your code instead of being timebanned :)
I understand the difference.

I was timebanned over 10 times while trying to get that to work
Chucks Blog
JavaOp2 Plugins

Quote
Error, keyboard not connected. Press F1 to continue.

iago

Incidentally, the following keys all work (insomuch that you don't get banned for requesting them):
profile\sex
profile\age
profile\location
profile\description
system\account created
system\last logon
system\last logoff
system\time logged

Joe

Leave it to Ron to come up with sex first in the list of all those. ^_^.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


iago

Yeah, who'd think I'd do it in the same order the Blizzard did, and who'd think that they'd do it in the order of the fields in the profile?

Sidoh

Quote from: Joex86] link=topic=7385.msg92764#msg92764 date=1159237614]
Leave it to Ron to come up with sex first in the list of all those. ^_^.

::)

MyndFyre

Quote from: iago on September 26, 2006, 12:11:55 PM
Yeah, who'd think I'd do it in the same order the Blizzard did, and who'd think that they'd do it in the order of the fields in the profile?
Likely excuse.
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

Joe

Quote from: Joex86] link=topic=7385.msg92764#msg92764 date=1159237614]
Leave it to Blizzard to come up with sex first in the list of all those. ^_^.

Fixed.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.