You are not logged in.
Pages: 1
I recently wrote a relatively simple program that imitates your standard installer program. There are four screens to it: the first one, where you have to enter the "CD Code", which is verified in a way that makes it very difficult to deduct, from the code, what the code is. The next window just displays a "Serial Number". The next one asks you what file you want to "modify", either by typing in the path, or by click on the "browse" button. The last part just has two progress bars that "fill up" at a random speed; the upper one moves at 1/100 of the speed of the other.
The part that is of most interest is the first one. the following is the code:
Private Sub Command1_Click()
Dim check As Variant
Dim checks As String
Dim fh As Integer
Dim countercheck As String
Dim filetext As String
On Error GoTo eh
fh = FreeFile
Open "C:\CDtest1.txt" For Input As #fh
Input #fh, filetext
Close #fh
Dim passer As Variant
For passer = 1 To Int(Len(filetext) / 5)
countercheck = countercheck & Int(Mid(filetext, (passer * 5) - 4, 2) - Asc(Mid(Text1.Text, Int(passer Mod Int(Len(Text1.Text) - 1) + 1), 1)))
Next
For check = 1 To 26
If IsNumeric(Mid(Text1.Text, check, 1)) = False Then
checks = checks & Asc(Mid(Text1.Text, check, 1))
Else
checks = checks & Mid(Text1.Text, check, 1)
End If
Next
If checks = filetext Then
Frame1.Visible = False
Frame2.Visible = True
Else
MsgBox "Incorrect code"
Text1.Text = ""
Command1.Enabled = False
End If
Exit Sub
eh:
MsgBox "Problem: " & Err.Description
Close #fh
End Sub
There is no longer a single key that will pass the test. Now, you need another program will both generate a key for you, and write an encrypted file containing the info that the above code needs in order to verify what you type in.
In case you were wondering, the frames are what I used to have multiple "screens". I simply superimposed them all.
Last edited by Laterally Speaking (2007-07-31 03:34:33)
"Knowledge is directly proportional to the amount of equipment ruined."
"This woman painted a picture of me; she was clearly a psychopath"
Offline
The key that is entered into text1 is "JVA6L9-XLB2M5-DFNQ7C1-633I"
Doesn't the key have to have 25 characters not 26? Because most keys on CD's that software installed have 25 characters instead of 26.
Last edited by Mathskido (2007-07-28 20:40:09)
High score in SAT's at the end of Year 6, Virgo, D'oh!, www.freewebs.com/roadster96
[img]C:\Documents and Settings\Alex\Desktop\Stuff\Pictures[/img]
Offline
Having codes like this directly in programs is dangerous. It is very easy to disassemble such a program and find such codes. It's much better to construct the codes from pieces, or even better, calculate the code using some form of operations.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
Offline
I wrote my program that generates and encrypts keys, then writes the result to a file, such that the above code may read it for comparison.
I chose to use 26 characters because it's a nice, round number.
I would upload the files, but I used some components that you're not likely to have (National Instruments UI 6.0). If anyone here does, say so and I'll post the links to the files. If not, I'll eventually save another version with the standard ones.
Last edited by Laterally Speaking (2007-08-03 05:47:50)
"Knowledge is directly proportional to the amount of equipment ruined."
"This woman painted a picture of me; she was clearly a psychopath"
Offline
Pages: 1