• Welcome to Valhalla Legends Archive.
 

Generate List of Cd Keys

Started by UnderCover, August 24, 2003, 07:46 AM

Previous topic - Next topic

UnderCover

I used PHP to generate cd keys for bots on my website and I was wondering if anoyne knew how to add the "-" to the cd key so i don;t have to do it manually?   Anyone know how?

Soul Taker

CD-keys don't actually have the "-" in them, and how do you generate keys for bots?  Must be on a server like BnetD I guess?

UnderCover

Well I use a random number to generate starcraft cd keys.  Im trying to figure out how to make it test my cd keys online.  Like test them through maybe sockets?  Does anyone know if that would work?

tA-Kane

#3
I don't know PHP, but here would be valid VB code. I hope you're good at porting VB to PHP.

I don't have my CD keys in front of me, so I'll write this function according to my memory; hopefully it's correct.
Function CreateDisplayKey(KeyStr As String) As String
 Dim Length As Integer
 Dim Buffer As String
 
 Length = Len(KeyStr)
 Select Case Length
 Case 13 //JSTR & STAR CD key: 0123-4567-8901
   Buffer = Mid(KeyStr, 1, 4) & "-" & Mid(KeyStr, 5, 5) & "-" & Mid(KeyStr, 10, 4)
 Case 16 //W2BN & D2DV & D2XP: 0123-ABCD-4567-EFGH
   Buffer = Mid(KeyStr, 1, 4) & "-" & Mid(KeyStr, 5, 4) & "-" & Mid(KeyStr, 9, 4) & "-" & Mid(KeyStr, 13, 4)
 Case 26 //WAR3 (& W3XP?): ABCDEF-0123-GHIJKL-4567-MNOPQR
   Buffer = Mid(KeyStr, 1, 6) & "-" & Mid(KeyStr, 7, 4) & "-" & Mid(KeyStr, 11, 6) & "-" & Mid(KeyStr, 17, 4) & "-" & Mid(KeyStr, 21, 6)
 Else
   Buffer = "Unsupported CD key length."
 End Select
End Function
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

hismajesty

Quote from: UnderCover on August 24, 2003, 09:34 AM
Well I use a random number to generate starcraft cd keys.  Im trying to figure out how to make it test my cd keys online.  Like test them through maybe sockets?  Does anyone know if that would work?

use a key tester?

Stealth

Quote from: tA-Kane@Texas on August 24, 2003, 10:40 AM
Function CreateDisplayKey(KeyStr As String) As String
 Dim Length As Integer
 Dim Buffer As String
 
 Length = Len(KeyStr)
 Select Case Length
 Case 13 //JSTR & STAR CD key: 0123-4567-8901
   Buffer = Mid(KeyStr, 1, 4) & "-" & Mid(KeyStr, 5, 5) & "-" & Mid(KeyStr, 10, 4)
 Case 16 //W2BN & D2DV & D2XP: 0123-ABCD-4567-EFGH
   Buffer = Mid(KeyStr, 1, 4) & "-" & Mid(KeyStr, 5, 4) & "-" & Mid(KeyStr, 9, 4) & "-" & Mid(KeyStr, 13, 4)
 Case 26 //WAR3 (& W3XP?): ABCDEF-0123-GHIJKL-4567-MNOPQR
   Buffer = Mid(KeyStr, 1, 6) & "-" & Mid(KeyStr, 7, 4) & "-" & Mid(KeyStr, 11, 6) & "-" & Mid(KeyStr, 17, 4) & "-" & Mid(KeyStr, 21, 6)
 Else
   Buffer = "Unsupported CD key length."
 End Select
 CreateDisplayKey = Buffer
End Function


Forgot to return the buffer. :)
- Stealth
Author of StealthBot

Maddox

#6
Instead of mid() you would use substr(), just remember it is 0 based.
asdf.

UnderCover

can anyone convert this to php lol im not that good with vb :)

Camel

Quote from: UnderCover on August 24, 2003, 04:32 PM
can anyone convert this to php lol im not that good with vb :)
How about you at least make an effort?

Banana fanna fo fanna

Why don't you give up...it won't be feasible.

UnderCover

im going ot start working on trying to convert this to make a good generator...

UnderCover

#11
What do you think of this code?  I think it may need some more randomizing....


<?
$refresh_rate = "20";

header( 'refresh: 20; url=http://www.saclans.com/d2kitems/cdkey/starcraftcdkeygen2.php' );

$tot = "0";

while ($tot < "100") {
$rand1 = rand(1000,5000);

$rand2 = rand(10000, 90000);

$rand3 = rand(1000, 9000);

$rand .= "<li>
$rand1-$rand2-$rand3</li>";

$add = $tot + 1;
$tot = $add;


}

?>

K

I think that there is an effective chance of 0% for you to generate a working battle.net key with that code.

UnderCover

wut code would you recommend :)

K

If you look at the CD Key decoding functions that are floating around or even a cd key generator for offline play, you'll at least have some idea of how the keys are chosen -- you won't just be shooting in the dark.  I still think it's not a very practical endevour, though -- even with a partially correct encoding function the chance to generate a working battle.net key (that isn't in use!) is very small.