Author Topic: Logging to BNet in c/c++  (Read 13220 times)

0 Members and 1 Guest are viewing this topic.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Logging to BNet in c/c++
« Reply #15 on: April 21, 2007, 02:33:55 pm »

Offline KrzaQ

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Logging to BNet in c/c++
« Reply #16 on: April 21, 2007, 02:41:44 pm »
http://en.wikipedia.org/wiki/Endianness
I have already checked Wiki, but I don't know how will it change file

 - I don't know the "element size")


I guess the question about A B and C order in 0x50 packet is more significant :/


BREAKING NEWS!
I got Check revision to work properly, probably when i make source more clear I'll post it here.
« Last Edit: April 21, 2007, 03:40:34 pm by KrzaQ »

Offline Hdx

  • The Hdx!
  • Full Member
  • ***
  • Posts: 311
  • <3 Java/Cpp/VB/QB
    • View Profile
Re: Logging to BNet in c/c++
« Reply #17 on: April 21, 2007, 11:14:11 pm »
Just read the file fount to end IIRC.
As for The order of A/B/C
Doesn't matter. Just do it in the order they send you.
Code: [Select]
        for(int x = 0; x<3; x++){
          String seed = tok.nextToken();
          if(seed.toLowerCase().startsWith("a=") == true) a = Long.parseLong(seed.substring(2));
          if(seed.toLowerCase().startsWith("b=") == true) b = Long.parseLong(seed.substring(2));
          if(seed.toLowerCase().startsWith("c=") == true) c = Long.parseLong(seed.substring(2));
        }
Just do something like that.
~Hdx
« Last Edit: April 21, 2007, 11:31:41 pm by HdxBmx27 »
http://img140.exs.cx/img140/6720/hdxnew6lb.gif
09/08/05 - Clan SBs @ USEast
 [19:59:04.000] <DeadHelp> We don't like customers.
 [19:59:05.922] <DeadHelp> They're assholes
 [19:59:08.094] <DeadHelp> And they're never right.

Offline KrzaQ

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Logging to BNet in c/c++
« Reply #18 on: April 22, 2007, 12:30:02 pm »
Just read the file fount to end IIRC.
As for The order of A/B/C
Doesn't matter. Just do it in the order they send you.
Code: [Select]
        for(int x = 0; x<3; x++){
          String seed = tok.nextToken();
          if(seed.toLowerCase().startsWith("a=") == true) a = Long.parseLong(seed.substring(2));
          if(seed.toLowerCase().startsWith("b=") == true) b = Long.parseLong(seed.substring(2));
          if(seed.toLowerCase().startsWith("c=") == true) c = Long.parseLong(seed.substring(2));
        }
Just do something like that.
~Hdx

Thank you, I have already managed to get check revision to work.

What I need now is to understand cdkey encoding, I hope this is right source to start.

Offline Hdx

  • The Hdx!
  • Full Member
  • ***
  • Posts: 311
  • <3 Java/Cpp/VB/QB
    • View Profile
Re: Logging to BNet in c/c++
« Reply #19 on: April 22, 2007, 12:42:08 pm »
http://jbls.org/Downloads/JBLS.jar
Open that up, it has all the spiffy functions that you need.
For something like thats your only choices are to look at other's sources or reverse it yourself :P
~Hdx
http://img140.exs.cx/img140/6720/hdxnew6lb.gif
09/08/05 - Clan SBs @ USEast
 [19:59:04.000] <DeadHelp> We don't like customers.
 [19:59:05.922] <DeadHelp> They're assholes
 [19:59:08.094] <DeadHelp> And they're never right.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Logging to BNet in c/c++
« Reply #20 on: April 22, 2007, 12:55:47 pm »
What I need now is to understand cdkey encoding, I hope this is right source to start.
It's typically called "Decoding" for some reason. And that's one for Starcraft, but if you want to do D2 look for one called AlphaKeyDecode or something similar.


Offline KrzaQ

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Logging to BNet in c/c++
« Reply #21 on: April 22, 2007, 02:08:35 pm »
I meant AlphaKeyDecode, just pasted link from wrong tab in browser.

I guess I should hash each key with algorithm used there, but again I can't understand whats returned. hash() doesn't get any variables, and returns none.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Logging to BNet in c/c++
« Reply #22 on: April 22, 2007, 02:14:50 pm »
It uses and sets class variables. Just look at what it uses, everything should be fairly common sense. For example, "cdkey" is the cdkey.

Offline KrzaQ

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Logging to BNet in c/c++
« Reply #23 on: April 23, 2007, 08:24:13 am »
Funny example ;)

I guess it should return keyarray, so I tried to port it to c and make it return keyarray.

For now I would need some confirmation again.
For cdkey 8VP8H276GG6ZNTTJ keyarray i receive is 06419C125496D5A0
Is it proper?

PS: the cdkey is banned.

Edit:
I guess its proper, since all decoded cdkeys start with 06 for me.

Edit 2:
Code: [Select]
    public int[] getKeyHash(int clientToken, int serverToken)

    {

       

        Buffer hashData = new Buffer();

       

        hashData.addDWord(clientToken);

        hashData.addDWord(serverToken);

        hashData.addDWord(getProduct());

        hashData.addDWord(getVal1());

        hashData.addDWord(0);

        hashData.addDWord(getVal2());

       

        return BrokenSHA1.calcHashBuffer(hashData.getBuffer());

    }

This function sends 6 DWords to calcHashBuffer, but it only needs 5. Or am I wrong?
« Last Edit: April 23, 2007, 04:55:00 pm by KrzaQ »