• Welcome to Valhalla Legends Archive.
 

Quick Question: CDKeys with letters in them

Started by Don Cullen, February 18, 2007, 09:38 PM

Previous topic - Next topic
|

Don Cullen

Nah, no need. I just found the reason why I kept getting the ver-ix86-0.mpq with empty string; it was because my verbyte that I was passing to bnet was set to 0. When I fixed the verbyte error, bnet stopped giving me ver-ix86-0.mpq with empty packets and everything was normal after that. So the fault was mine.

Now to try to figure out this damnable filetime thing...
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

Barabajagal

Try loading it as two DWord (Long) values instead. the first dword is the Low filetime, the second is High.


Case cSID_AUTH_INFO&   '0x50
LogonType = PktDeBuf.rDWORD
ServerToken = PktDeBuf.rDWORD   'AKA Session Key
UDPValue = PktDeBuf.rDWORD
MPQFTLow = PktDeBuf.rDWORD
MPQFTHigh = PktDeBuf.rDWORD
Ix86verfilename = PktDeBuf.rNTString
ChecksumFormula = PktDeBuf.rNTString
Call BNLS_CDKEY(ServerToken)



Private Sub BNLS_VERSIONCHECKEX2()  '0x1A
    Dim tmp As String
    With PacketBuf
        .InsertDWORD ProductID
        .InsertDWORD &H0
        .InsertDWORD Cookie
        .InsertDWORD MPQFTLow
        .InsertDWORD MPQFTHigh
        .InsertNTString Ix86verfilename
        .InsertNTString ChecksumFormula
        tmp = .RetBNLSPkt(&H1)
        .SendBNLSPacket sckBNLS, &H1A   'Send 0x1A packet
    End With
    RaiseEvent DebugOutput("0x1A BNLS_VERSIONCHECKEX2 packet sent.")
    RaiseEvent DebugOutput("Dumping sent packet...")
    DumpPacket (tmp)
    RaiseEvent DebugOutput("End of packet dump.")
End Sub


Something along those lines.

Don Cullen

That solved the problem. Thanks RealityRipple.

Ringo, just wondering -- do you have plans on adding support for 0x0B on your server?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

Ringo

Quote from: Kyro on February 21, 2007, 01:21 PM
That solved the problem. Thanks RealityRipple.

Ringo, just wondering -- do you have plans on adding support for 0x0B on your server?
Can do, I just need to know one thing from somone whos used 0x0B before, Can 0x0B single hash? Or is it just double hashing?

Hdx

It can do both,
http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=171
Depending on what the user specify.
And Ringo get on MSN some time ><
~Hdx

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

Ringo

Quote from: Kyro on February 21, 2007, 01:21 PM
Ringo, just wondering -- do you have plans on adding support for 0x0B on your server?
Done, Just needs testing now :)

Quote from: Hdx on February 21, 2007, 01:39 PM
It can do both,
http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=171
Depending on what the user specify.
And Ringo get on MSN some time ><
~Hdx
Great, thanks. Im guessing if the 2nd bit of the flag is not set, then it should be single hashed?
btw, I cant logon MSN, I always get "service unavalible" because I cant remember my password/and/or becuase it was made by microsoft :P
I think I have an aim account, but I will need to try remember it. :(

Don Cullen

Quote from: Ringo on February 21, 2007, 02:10 PM
Quote from: Kyro on February 21, 2007, 01:21 PM
Ringo, just wondering -- do you have plans on adding support for 0x0B on your server?
Done, Just needs testing now :)

Quote from: Hdx on February 21, 2007, 01:39 PM
It can do both,
http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=171
Depending on what the user specify.
And Ringo get on MSN some time ><
~Hdx
Great, thanks. Im guessing if the 2nd bit of the flag is not set, then it should be single hashed?
btw, I cant logon MSN, I always get "service unavalible" because I cant remember my password/and/or becuase it was made by microsoft :P
I think I have an aim account, but I will need to try remember it. :(


1. 0x0B doesn't work. It disconnects me. I just tested it.
2. If the flag isn't set (0), or if it's set to 1, then yes, single hash. But if it's set to 2, double hash. If it's set to 4, cookie hash.
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

Ringo

Quote from: Kyro on February 21, 2007, 02:33 PM
1. 0x0B doesn't work. It disconnects me. I just tested it.
2. If the flag isn't set (0), or if it's set to 1, then yes, single hash. But if it's set to 2, double hash. If it's set to 4, cookie hash.
Ah, try again a few times and I will fix it :P
It said there was not enough bytes for the client and server token.
Btw, I was under the impression 0x04 ment a cookie was at the end of the message, and not any form of hashing?

Joe[x86]

Quote from: brew on February 20, 2007, 08:24 PM
Kyro are you sure that's the right packet....? If it is then your send0x1a sub is severly screwed up.

Why is sending 0x1A diserving of it's own subroutine? Here's how I handle BNLS CheckRevision requests. Sort of bad coding -- needs some work, but regardless.

    public CheckRevisionResults getVersionCheck(String filename, byte[] formula, long filetime) throws IOException, InvalidVersion
    {
        Socket s = getConnection();
        InputStream in = s.getInputStream();
        OutputStream out = s.getOutputStream();
       
        int verhash, checksum;
        Buffer statstring = new Buffer();


    if(game.equals("STAR") || game.equals("SEXP")) // Use BNLS 0x09
    {
    BNLSPacket pkt = new BNLSPacket(BNLS_VERSIONCHECK);
pkt.addDWord(getBnlsProductId(game));
pkt.addDWord(extractMpqNumber(filename));
pkt.addBytes(formula);
out.write(pkt.getBytes());
out.flush();

BNLSPacket inPkt = getNextPacket(in);
    if(inPkt.removeDWord() == 0)
    {
    throw new InvalidVersion("BNLS returned failure in 0x09.");
    }
    verhash = inPkt.removeDWord();
    checksum = inPkt.removeDWord();

    byte b = 1;
    while(b != 0)
    {
    b = inPkt.removeByte();
    statstring.addByte(b);
    }
    }
    else // Use BNLS 0x1A
    {
    BNLSPacket pkt = new BNLSPacket(BNLS_VERSIONCHECKEX2);
    pkt.addDWord(getBnlsProductId(game)); // (DWORD) Product ID
    pkt.addDWord(0); // (DWORD) Flags**
    pkt.addDWord(0); // (DWORD) Cookie
    pkt.addLong(filetime); // (ULONGLONG) Timestamp for version check archive
    pkt.addNTString(filename); // (STRING) Version check archive filename.
    pkt.addBytes(formula); // (STRING) Checksum formula.
    out.write(pkt.getBytes());
    out.flush();
   
    BNLSPacket inPkt = getNextPacket(in);
    if(inPkt.removeDWord() == 0)
    {
    throw new InvalidVersion("BNLS returned failure in 0x1A.");
    }
    verhash = inPkt.removeDWord();
    checksum = inPkt.removeDWord();
   
    byte b = 1;
    while(b != 0)
    {
    b = inPkt.removeByte();
    statstring.addByte(b);
    }
    }

return new CheckRevisionResults(verhash, checksum, statstring.getBytes());   
    }

Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Don Cullen

@ Ringo; Cookies are required only if the flag was set to 4. If flag wasn't set to 4, then the cookie DWORD would be empty. Also, I just had my program connect two more times. Still failed.

@Joe - I put it in its own subrountine because it makes it easier for me to make sense of my own code. Each person has their own coding style. My mental processes makes it extremely difficult for me to read (ADHD), so as a result I have to carefully organize everything even if it's a pain in the butt -- otherwise I lose focus. It's a most annoying handicap. Especially when it comes to learning how to code or read packets, etc, etc. :p
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

Ringo

Quote from: Kyro on February 21, 2007, 02:55 PM
@ Ringo; Cookies are required only if the flag was set to 4. If flag wasn't set to 4, then the cookie DWORD would be empty. Also, I just had my program connect two more times. Still failed.
Ah, thats what I thought.
I picked up what was wrong, i was miscounting a byte, try now :P

Hdx


size = in->(int)get;
type = in->(int)get;
data[] = H(in->(byte[])get(size));
if(type & 0x02) == 0x02 {
  tmp->add(in->(byte[])get(8));
  tmp->add(data);
  data = H(tmp->(byte[])get(28));
}
out->add(data);
if(type & 0x04) == 0x04 out->add(in->(int)get);

Something like that.
~Hdx


BAH DANG YOU all for posting while I was typing 3 times!I'll post this anyways cuz I like the asic sceam and its not how its done in JBLS so I will change it when i get home. (After making sure its efficient);
~Hdx

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

Ringo

#72
Quote from: Hdx on February 21, 2007, 03:03 PM

size = in->(int)get;
type = in->(int)get;
data[] = H(in->(byte[])get(size));
if(type & 0x02) == 0x02 {
  tmp->add(in->(byte[])get(8));
  tmp->add(data);
  data = H(tmp->(byte[])get(28));
}
out->add(data);
if(type & 0x04) == 0x04 out->add(in->(int)get);

Something like that.
~Hdx


BAH DANG YOU all for posting while I was typing 3 times!I'll post this anyways cuz I like the asic sceam and its not how its done in JBLS so I will change it when i get home. (After making sure its efficient);
~Hdx
ta, all done, I was just unsure what determined the single hashing :)
Im just waiting for Kyro to verify if it works or not, then im off out.

Don Cullen

#73
Ringo -- Good news. 0x0B works like a charm. I just logged into BNET without a problem. Thanks. :)

BTW have you considered hosting BNLS permanently since Skywing's BNLS doesn't exactly have an excellent record of uptime? Or at the very least, let Hdx host it?

To make it easier for people to remember, and as my thanks for your being willing to host BNLS, even if you intend to keep it temporarily, I've set up the following address:

bnls.dementedminds.net

To redirect to your bnls server. The redirection is permanent. Thanks. :)
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

MysT_DooM



vb6, something about that combination of numbers and letters is sexy

|