Announcement

Collapse
No announcement yet.

Software Unlock code autogeneration

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TJ_Tigger
    replied
    Re: Software Unlock code autogeneration


    Hopefully they will remember us when we are long gone as having *****ed a tough nut
    That would be you, I just played in it for a little while. I like to learn new things.

    I am waiting to see if anyone catches the columbia internet references I put in there.

    Leave a comment:


  • kaylward
    replied
    Re: Software Unlock code autogeneration

    Thank you for figuring out the build date problem. I like your solution and Lorne's suggestion about using the txt file. It also sounds like you tested the "encrypting" a little more than I did as to numeric uniqueness so I plan on using your mods in my project. I think with your post we are at a point where we have a pretty usable example of how to do software activation with AMS 4.0.

    Hopefully they will remember us when we are long gone as having *****ed a tough nut [img]/ubbthreads/images/icons/wink.gif[/img]...

    Leave a comment:


  • TJ_Tigger
    replied
    Re: Software Unlock code autogeneration

    That was my idea exactly. I have put this together from the earlier posts with a few testing functions in it. Like the ability to select the build of software used. This would need to be available on the tech support page, but is also in the customer page just for testing purposes. I also changed the coding for the unlock code. I found that during testing the four dates that I used produced the same value before the decimal point. So I truncated it after the decimal point six places and changed the decimal point to a hypen and added an second hypen to make it look like a code (e.g., 123-456-789). I hope that you don't mind me fiddling around with the code like this.

    Both pages are included in this one project, I have included a quick text link in the top left corner that will take you from one page to the next for testing purposes.

    To figure out the dates, I found a freeware program that does a date stat. The nice thing about it is that it calculates dates BC. Click Here to see the software. Using this software I built a text file with the %DaysSinceBuilt% variable for each build.

    Download the project file from my site if you would like to see what I did. I hope it works for you.

    Tigg

    Leave a comment:


  • Lorne
    replied
    Re: Software Unlock code autogeneration

    Idea to solve that: have the build date get written out to a text file whenever you build the client app, and have the tech support app read the date in from that file. That way you can rebuild the tech support app any time you need to (to fix bugs, add features, whatever).

    Anything along this line would work, though...you could make the build date a design-time constant, too, to eliminate the need for an external file. You'd have to set it manually whenever the client app's build date changed...but you could write an AutoPlay application to do that for you automatically, by editing the tech support app's project file (which is just XML text...).

    That's probably how I'd do it...write a third app (call it "timestamp.exe" or something) and just run it whenever you build the client app.

    Leave a comment:


  • kaylward
    replied
    Re: Software Unlock code autogeneration

    OK so I learned some lessons in trying to make the page for the tech support people. It appears that the calculations only work if the first two line of code below:

    %JulianDate% = System.GetDateTime ( "Date", "Julian Date")
    %DaysSinceBuilt% = Evaluate (%JulianDate% - #JulianDate#)
    // Use for day 0 testing... then disable
    %DaysSinceBuilt% = Evaluate (154)

    are in the Project.OnInitialize settings (the comment and last line are for testing - %DaysSinceBuilt% = 0 doesn't work so good :-) ). I tried to read a number out of a Global List that was the JulianDate for the build date, but the "math" functions just didn't work. It seems that the #JulianDate# makes everything work... Who knows why- I swear I had the same value in a variable but couldn't get the two variable math to work unless it all began with a constant.

    So the form has a box to enter the MAC address from the customer, then they click on the Product 1 button and the UnLock Code is shown in Text2.

    Here is the relevant code for the Product 1 button:

    Product 1 Button

    %TempInfo% = EditFieldObject[UnLockCodeBox].GetText
    %ALLNUMBERS% = String.Replace ("%TempInfo%", "f", "5")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "e", "4")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "d", "3")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "c", "2")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "b", "1")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "a", "0")
    %TMPDIV% = Evaluate (%ALLNUMBERS% / %DaysSinceBuilt%)
    %UnLockCalc% = Variable.FormatNumber (%TMPDIV%, 0, Truncate)
    TextObject[Text2].SetText ("%UnLockCalc%")

    Here is the
    page for download. Don't forget to add the two lines at the top to the Project.OnInitialize.

    The only downside to this approach is that the build date for this app and the client autorun have to be the same.

    Leave a comment:


  • kaylward
    replied
    Re: Software Unlock code autogeneration

    Thanks... I was aware of the MAC changing, as I recall older token ring cards were easily modifable.

    Being a PKI type person I was thinking hashes and encryption keys to solve this problem. Of course the items I had to work with are limited by the scope of the AMS product, so I started looking for a long number that would be unique per computer that I could "encrypt" with a key that my application and I knew, but the user did not. That's when I found the help file entries on "Expiring 30 days after building". From that I got my key value and an added bonus was that it would change every day. I figured a division operation would be as good a way as any of combining the two numbers into one value, but there are numerous other ways of "encrypting the MAC address with the date "key". The numeric substitution doesn't yield and exact translation of the MAC address, but it IS consistent.

    Leave a comment:


  • Lorne
    replied
    Re: Software Unlock code autogeneration

    Nice job! (I looked at it earlier but didn't have time to post anything. Put a smile on my face this afternoon, for sure. [img]/ubbthreads/images/icons/smile.gif[/img])

    One interesting point, is that the MAC address can actually be changed if you know how. (I actually was involved in writing a tool to change it, once.) But incorporating the time into the calculation makes that pretty moot.

    Leave a comment:


  • kaylward
    replied
    Re: Software Unlock code autogeneration

    You know I hadn't thought enough about the backend process yet since the app hasn't shipped, but AMS would be the natural choice to build the tech support page for doing the unlock code generation. I've been using notepad and calc to do the backend, but that doesn't scale too well.

    I don't have the AMS page for the engineers yet, but I will by tomorrow. I'll post it in this thread.

    Leave a comment:


  • TJ_Tigger
    replied
    Re: Software Unlock code autogeneration

    Yes, yes it is.

    Do the engineers at XYZ company have a page also build with AMS that contains the build numbers of version numbers of the software sent to the customers. They can then select that build from a list on their AMS app and with the code from the customer have it correctly generate the code for them to give back to the customer?

    Leave a comment:


  • kaylward
    replied
    Re: Software Unlock code autogeneration

    Here is the relavant code for AMS 4.0 in case you don't want to get the full page. You can do the same kind of thing with SF60. See my post here on how it works...

    - The install button does this OnClick
    %UnlockText% = EditFieldObject[UnLockCodeBox].GetText
    %ALLNUMBERS% = String.Replace ("%Info%", "f", "5")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "e", "4")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "d", "3")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "c", "2")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "b", "1")
    %ALLNUMBERS% = String.Replace ("%ALLNUMBERS%", "a", "0")
    %TMPDIV% = Evaluate (%ALLNUMBERS% / %DaysSinceBuilt%)
    %UnLockCalc% = Variable.FormatNumber (%TMPDIV%, 0, Truncate)

    IF (%UnlockText% = %UnLockCalc%)
    File.Copy ("%SrcDir%\RES.GBL", "%TEMPDIR%\SETUP.EXE")
    File.SetAttributes ("%TEMPDIR%\SETUP.EXE", "")
    File.Execute ("%TEMPDIR%\SETUP.EXE", "", Wait)
    ELSE
    %Result% = Dialog.MessageBox ("Unlock Code Does Not Match", "Your unlock code does not matc...", Ok, Information)
    END IF

    - The Page Show does this
    %Info% = System.GetInformation ( "MAC Address")
    IF (%Info% = "UNKNOWN")
    %Info% = "00010274fac9"
    END IF
    TextObject[Text2].SetText ("%Info%")

    - The Project Initialize does this
    %JulianDate% = System.GetDateTime ( "Date", "Julian Date")
    %DaysSinceBuilt% = Evaluate (%JulianDate% - #JulianDate#)
    // %Result% = Dialog.MessageBox ("Debug Information", "Days Since Built: %DaysSinceB...", Ok, Question)

    Leave a comment:


  • Corey
    replied
    Re: Software Unlock code autogeneration

    Interesting...

    Corey Milner
    Creative Director, Indigo Rose Software

    Leave a comment:


  • kaylward
    started a topic Software Unlock code autogeneration

    Software Unlock code autogeneration

    I linked to PG4 page which builds on an example from the help file in showing a unique code for telephone software activation. The page shows the users their MAC address (If the page can't find a MAC address it uses a pre-designated MAC address).

    The addition I made is a process to convert the MAC address into a number by substituting 0 for A, 1 for B... through 5 for F. This leaves a numeric string. At that point you divide the number by the number of days since the app was built (Also from the examples) and truncate the result to integers.

    This unlock code is unique to the computer the user is calling from and changes every day. This cuts the likelihood of abuse dramatically.

    Basically you do the calculation and read them the result as the Unlock Code. They type in the Unlock Code in an edit box, then if the program comes up with the same value as they entered the installation can proceed. I actually have code in the screen for copying the setup program (which has a non executable extension on the CD) to the TEMP directory, renaming it to and EXE, then deleting it on close.

    I've seen something like this asked for occasionally. The advantages to this approach is that no external DLL is required, and the seed value (days since build) is ever changing.

    The logic will work in SF60 as well, but the constant for build date has a different name.

    Download PG4 Page
Working...
X