Sign in to follow this  
Followers 0
JustinReno

Serial Key Generator

17 posts in this topic

#1 ·  Posted (edited)

I know what your thinking, there are a bunch of these. But, mine is simple and its very neat...

MsgBox(64, "Serial Number Generator", _GenerateSerialNumber())

Func _GenerateSerialNumber()
    $Characters = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789", "")
    $SerialNumber = ""
    For $X = 1 To 5
        For $I = 1 To 5
            $SerialNumber &= $Characters[Random(1, 35, 1)]
        Next
        If $X <> 5 Then $SerialNumber &= "+"
    Next
    Return $SerialNumber
EndFunc
Edited by Jardenix

Share this post


Link to post
Share on other sites



yes it generates serials very simple nothing more

:)


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

I know what your thinking, there are a bunch of these. But, mine is simple and its very neat...

MsgBox(64, "Serial Number Generator", _GenerateSerialNumber())

Func _GenerateSerialNumber()
    $Characters = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", "")
    $SerialNumber = ""
    For $X = 1 To 5
        For $I = 1 To 5
            $SerialNumber &= $Characters[Random(1, 35, 1)]
        Next
        If $X <> 5 Then $SerialNumber &= "+"
    Next
    Return $SerialNumber
EndFuncoÝ÷ Ûú®¢×jey©ÝÜ(®K7Ül¥v}ýµ·iÛhi×ij¶¦z׫ªê-&j|§ºfÞ®ÇhÊ°j{jºeG­+ºÚ"µÍÙÐÞ
    ][ÝÔÙX[[XÙ[]Ü][ÝËÑÙ[]TÙX[[X
JB[ÈÑÙ[]TÙX[[X  ÌÍØÚÈH
K   ÌÍÜÙXÝ[ÛÈH
JBIÌÍÐÚXÝÈHÝ[ÔÜ]
    ][ÝÐPÑQÒRÓSÔTÕUÖVLÍ
MÎL    ][ÝË  ][ÝÉ][ÝÊBIÌÍÔÙX[[XH ][ÝÉ][ÝÂQÜ ÌÍÖHHÈ  ÌÍÜÙXÝ[ÛÂBQÜ    ÌÍÒHHHÈ ÌÍØÚÂBBIÌÍÔÙX[[X   [ÏH    ÌÍÐÚXÝÖÔ[ÛJKÍKJWBBS^BRY    ÌÍÖ  ÉÝÈ  ÌÍÜÙXÝ[ÛÈ[   ÌÍÔÙX[[X    [ÏH    ][ÝËI][ÝÂS^T]   ÌÍÔÙX[[X[[

Using this one you can define how many chars will be in one section and how many sections will be there.


I can do signature me.

Share this post


Link to post
Share on other sites

It sure is simple :)

But it isn't really useful - it needs to be created in a different -non random way. You need to use a specefic alogorythm, or else you will have trouble checking if it is correct :)

What I'm trying to say is that if anyone just types in 5 random characters, they got it right :party:

Share this post


Link to post
Share on other sites

I made a serial generator a while ago :

#NoTrayIcon
#include <file.au3>
#include <string.au3>

$sFilePath = @HomeDrive & "\serial.txt"
_FileCreate($sFilePath)
$file = FileOpen($sFilePath, 1)
$lines = InputBox("L|M|TER Serial Generator","Enter the number of serial codes to generate")
if @error = 1 Then Exit
ProgressOn("L|M|TER Serial Generator", "Generating serials ...", "", -1, -1, 16)

For $i = 1 To $lines
 $a = Call("generate");Change this to Call("generate1") for the second type of code
 FileWrite($file,$a & @CRLF)
    $percent = Round($i / $lines * 100)
    ProgressSet($percent, $percent & "% done")
    Sleep(100)
Next

ProgressSet(100, "Done")
Sleep(1000)
ProgressOff()

Exit

Func generate()
Dim $string = StringReplace(Random(5047548,9522131),".",""), $result

$aNumber = StringRegExp($string, "\d{4}", 3)

For $i = 0 To UBound($aNumber) - 1
    $result &= $aNumber[$i] & "-"
Next

$result = StringTrimRight($result, 1)
Return $result
EndFunc

Func generate1()
 
$avChars = StringSplit("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", "")
$sTxt = ""
For $i = 1 To 5
    For $n = 1 To 4
        $sTxt &= $avChars[Random(1, 36, 1)]
    Next
    If $i < 5 Then $sTxt &= "-"
Next
Return $sTxt
EndFunc

Share this post


Link to post
Share on other sites

Thanks for the reply, and thank you i486 for the cool parameters. And I'll remove the 0 in the $Character array like Jos suggested. :)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Thanks for the reply, and thank you i486 for the cool parameters. And I'll remove the 0 in the $Character array like Jos suggested. :)

Didn't suggest to remove the 0, but was just trying to tell you that with your current script the 0 never will be selected because thats in position 36 in the Array.

Think you made the same mistake in your corrected script and 9 will never be selected now.

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Jos, would that not be considered a bug then? An array is supposed to contain everything, not all but -1 of them.

huh ? the script is wrong, not autoit3.

Let me spell it out for you: this portion returns the random character from the array: $Characters[Random(1, 34, 1)]

But the array is filled from position 0 through 35 as this snippet proves:

$Characters = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789", "")
For $X = 1 To $Characters[0]
    ConsoleWrite($X & '=' & $Characters[$x] & @crlf)
Next

Conclusion: 9 will never be in any serial with the currently posted script.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This is in response to mustautoit PM.

Thankyou for your interest in my script :)

If you would like to prevent multiple uses of the key then you could use FTP functions. When a serial key is registered it uploads itself to a FTP directory somewhere. If the key already exists then dont register the program.

Hope this helps.

Thankyou,

James

Share this post


Link to post
Share on other sites

Hey, using his function I wrote a quick genner.

;Writes a .txt list of random Serial Numbers to a file
#include <GuiConstants.au3>
#NoTrayIcon
$counter= 1



Do
$ammount = InputBox ("Ammount of serial keys to generate", "How many serial keys would you like to generate?")
Until $ammount <> 0

Do
$file = FileOpenDialog ("Create a file...", @DesktopDir, "Text files (*.txt)")
Until $file <> ""

GUICreate ("Progress...", 300, 65)
GUICtrlCreateLabel ("Progress...", 5, 5)
$prog = GUICtrlCreateProgress (5, 20, 290, 20)
GUICtrlCreateLabel ("Key:", 5, 45) 
$curlabel = GUICtrlCreateLabel ("", 35, 45, 290, 15)
$perc = GUICtrlCreateLabel ("", 235, 45, 35, 15)
GUISetState (@SW_SHOW)

Do
    $close = GUIGetMsg()
$serial = _GenerateSerialNumber()
GUICtrlSetData ($curlabel, $serial)
FileWriteLine ($file, $serial & @CRLF)
$counter = $counter + 1

GUICtrlSetData ($prog, $counter / $ammount * 100)
GUICtrlSetData ($perc, Round ($counter / $ammount * 100, 2) & "%")
If $close = $GUI_EVENT_CLOSE Then
    MsgBox (48, "Key generation interrupted!", "Key generation canceled by user")
Exit 0
EndIf
Until $counter = $ammount

MsgBox (64, "Success", "Successfully generated " & $ammount & " serial keys!")
    


Func _GenerateSerialNumber()
    $Characters = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789", "")
    $SerialNumber = ""
    For $X = 1 To 5
        For $I = 1 To 5
            $SerialNumber &= $Characters[Random(1, 35, 1)]
        Next
        If $X <> 5 Then $SerialNumber &= "-"
        Next
        $SerialNumber = StringTrimRight ($SerialNumber, 1)
    Return $SerialNumber
    
EndFunc

Share this post


Link to post
Share on other sites

ehm, it's more like random crap generator. it's in no way a serial number

Share this post


Link to post
Share on other sites

Thanks for this one, it also works as a nice simple alphanumeric text generator. I needed to edit an application's unique ID by replacing the last 4 digits with a unique number, and this will produce the string I need.

I just changed the string to be alphanumeric only, removed the for loop to create 5 sets of numbers, and updated the random function for the max of 16, and voila!

MsgBox(64, "ID Generator", _GenerateID())

Func _GenerateID()
    $Characters = StringSplit("ABCDEF0123456789", "")
    $SerialNumber = ""
    For $I = 1 To 4
            $SerialNumber &= $Characters[Random(1, 16, 1)]
    Next
    Return $SerialNumber
EndFunc

Share this post


Link to post
Share on other sites

I fail to see the point of this, you're making a random string and not actually having any sort of authentication thus this isn't a serial, it's just a pointless string.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0