• Welcome to Valhalla Legends Archive.
 

[C++] Gigantic Loops

Started by Joe[x86], October 16, 2005, 01:11 AM

Previous topic - Next topic

Arta

If you have some code for decoding cd keys, then you can figure it out. The constituent parts of the keys are what gets sent to Battle.net (in one form or another).

Joe[x86]

#16
Something I was trying to do was decode the CD Key and extract the productID and compare it to StarCraft's ID.

According to a post I saw, this is 0x01, and according to tmp's slackchat source code, this is 0x53544152. I guess I'll use tmp's, because I found it in a working bot.

A problem though, sckmg is in C++ which I'm still very inexperienced in, and slackchat is in C. As much as I hate leeching, can anyone point me to some code to extract the key's productID?

EDIT -
Almost forgot. I'm now using finishKey() on every ten keys, instead of verifyKey() on every one. Poke

EDIT -
I read Kp's post again. I guess by magic he means public value, and secret is private value, right? Basically what I was going to do was loop through the 999,999,999,999 keys (each one valid by installer), and check if its productID is correct. Is there any relationship between the magic and secret?
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

MyndFyre

Why don't you use BNCSUtil?  It's open-source, and you can do CD key verification via C functions as well as a C++ class (IIRC).  Just import the appropriate headers and link to the BNCSUtil library.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Kp

Quote from: Joe on October 17, 2005, 06:50 PMI read Kp's post again. I guess by magic he means public value, and secret is private value, right? Basically what I was going to do was loop through the 999,999,999,999 keys (each one valid by installer), and check if its productID is correct. Is there any relationship between the magic and secret?

It is widely believed that there is, but if anybody outside Blizzard knows how to compute secret from magic, they're not talking.  It stands to reason that there must be though, since otherwise the server would need to have a lookup table to map every issued magic to a secret.  Of course, the conversion function is probably some really nasty hash function with a nonlinear correlation of input to output.  Otherwise anybody with enough keys could figure it out just by looking for patterns.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Arta

Tip: CD key product codes are not the same as product IDs.

Joe[x86]

#20
@Arta, whats the CDKey product code for StarCraft? 0x01?

@MyndFyre, I looked at BNCSUtil for something (cant remember what), and the entire thing was over my head. I might look into it again, but the very idea of using it gives me a headache. I know next to no C++. I'm pretty amazed I've gotten this far.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Arta

I can't remember - decode an SC key and have a look! :)

mynameistmp

Joe, when I was writing slackchat I used the linux bash shell to help me out with sorting through some of bncsutil's source code. I made a script like so:


#!/bin/sh

for file in *
do
        grep -Hn $1 $file
done
exit 0


Stick that in the source directory, throw the string you're looking for as an arg, and it'll tell you which file/line:

Quote
sh-3.00$ ./locate calcHash
bsha1.cpp:52:MEXP(void) calcHashBuf(const char* input, unsigned int length, char* result) {
bsha1.h:34: * calcHashBuf
bsha1.h:43:MEXP(void) calcHashBuf(const char* data, unsigned int length, char* hash);

I know it's a little bit off topic but it may help you in searching for what you're looking for ;P
"This idea is so odd, it is hard to know where to begin in challenging it." - Martin Barker, British scholar

dxoigmn

Quote from: mynameistmp on October 25, 2005, 02:18 AM
Joe, when I was writing slackchat I used the linux bash shell to help me out with sorting through some of bncsutil's source code. I made a script like so:


#!/bin/sh

for file in *
do
        grep -Hn $1 $file
done
exit 0


Stick that in the source directory, throw the string you're looking for as an arg, and it'll tell you which file/line:

Quote
sh-3.00$ ./locate calcHash
bsha1.cpp:52:MEXP(void) calcHashBuf(const char* input, unsigned int length, char* result) {
bsha1.h:34: * calcHashBuf
bsha1.h:43:MEXP(void) calcHashBuf(const char* data, unsigned int length, char* hash);

I know it's a little bit off topic but it may help you in searching for what you're looking for ;P

why not just grep -Hn calcHash *?


[dxoigmn@tahoe:bncsutil]# grep -Hn calcHash *
bsha1.cpp:73:MEXP(void) calcHashBuf(const char* input, unsigned int length, char* result) {
bsha1.cpp:142:MEXP(void) calcHashBuf(const char* input, unsigned int length, char* result) {
bsha1.h:34: * calcHashBuf
bsha1.h:43:MEXP(void) calcHashBuf(const char* data, unsigned int length, char* hash);
cdkeydecoder.cpp:220:            calcHashBuf((char*) &kh, 24, keyHash);
oldauth.cpp:41:    calcHashBuf(password, std::strlen(password), intermediate + 8);
oldauth.cpp:45:    calcHashBuf(intermediate, 28, outBuffer);
oldauth.cpp:54:    calcHashBuf(password, std::strlen(password), outBuffer);

mynameistmp

#24
It's just an example for him. That method is great for this particular example but it loses functionality as his requests become more complicated. I didn't particularly feel like typing grep -Hn everytime.
"This idea is so odd, it is hard to know where to begin in challenging it." - Martin Barker, British scholar

Kp

alias hgrep 'grep -H -n \!*'

# Bonus:
alias ehgrep 'grep -E -H -n \!*'
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Joe[x86]

Heh, Kp renamed his topic title. =).

From C++ looping to Shell Scripting 101, all in less than two full pages. =)
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.