AutoHotkey Community

It is currently May 27th, 2012, 5:03 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 290 posts ]  Go to page Previous  1 ... 14, 15, 16, 17, 18, 19, 20  Next
Author Message
 Post subject:
PostPosted: April 29th, 2010, 10:58 pm 
TomT wrote:
guest3456 wrote:
TomT wrote:
does this have anything to do with the name / email address not being present ?


maybe. have you tried with a name+fingerprint?

Sorry being thick.. how do I do that ?
:)


well when you run the SWProtect-Gui, just put some name, leave email blank, put some fingerprint, and push button to generate the key

for the PHP, instead of str="fingerprint" make it str="namefingerprint"

FF wrote:
@guest3456: could you please put together all the working scripts needed for a PHP registration with matching keys and make a short and simple abc guide on how to use them?


yes i think i will have to do this when i get time. maybe later tonight otherwise prob wont get done until next week


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 29th, 2010, 11:01 pm 
FF wrote:
If someone downloaded your script and you do not have a internet connection, or you are on vacation, you would have to make him wait until you are able to provide the .ini
The automation of this process could spare a lot of work and time for lots of us.


also realize, if somehow your PHP script became public, then anyone could generate a key for themselves. usually this sw protection is to sell a shareware product. but if one person buys your software, your automation sends him to the PHP script, he can then tell his friend of the location of your PHP and his friend can just generate his own key without paying

unless you have a different idea in mind? i'm curious to discuss this


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2010, 12:37 am 
Thanks for the fast reply.
http://www.antssoft.com/htmlprotector/index.htm
HTML Protector offers protection by encrypting all of the links on your pages, so automated downloaders will be unable to analyze the deep links your pages contain
It freezes the html code received by your browser, so you are not able to right click, you are not able to save images from the server, you are not even able to select any text from that page if you set it up that way, as a developer. You are only able to click links.
I dont want to go offtopic with this subject.
Also, I did not saw the script in action to see if the end-user is forwarded to a specific web page to activate the product. I thought the process takes place in the background.
For a program that is not shareware, the steps would be:
1. customer downloads the product - meaning a download link was provided already after payment - can be done automatically with this script http://www.ngcoders.com/php/selling-digital-goods-with-paypal-ipn-and-php or the script was sent to the customer via e-mail
2. customer runs the program
3. MsgBox please enter a valid e-mail for validation,(customer enters e-mail)--> OK --> MsgBox Validating online, please wait... (OK and Cancel option, if OK then keep same MsgBox on screen)
4. the script gets the fingerprint, it sends it to the server
5. PHP script is processing the fingerprint and generates the .ini, records the fingerprint to avoid future activations for the same product from another puters
6. Customer receives a download window or a e-mail "Authentication complete, please save this file in the same folder with your script"
7. Customer saves the .ini and is pressing OK in the MsgBox
8. Program authenticated.

Advantages: no e-mails back and forth, no activations from another computers, no direct access links to the PHP script. Of course, some .ini stored on the server would be vulnerable, but they would be totally useless for another users since they dont contain private data about the customer.
Of course, I may talk S.F here since I did not saw your script in action. I only saw and tested the one from page 1 of this thread and is awesome, but it requires someone to stay there 24/24 if he wants to be a serious seller.
Another idiotic idea would be this: the script would read and store the fingerprint in the source code at the first run, but I dunno if compiled files can do that. I dunno if a code can be written to modify the data from inside a file that is compiled and encrypted already. To generate a .ini and hide it would be useless again since the program would do this again on a new puter.
Another idea would be auto generated links for the customer to access the PHP script, so each time a customer would have to access it, the link would be another and it would self delete after 5 minutes.
I do not want to write books about my ideas here, since I saw already awesome scripts here and others thought about this before me for sure. All I would want is somehow your scripts to be put together with some easy steps to follow so we could be able to have your script up and running.
Personally, I dont sell expensive scripts and I want to take the risk uploading the PHP script on the server, combined with that html protect program. Thanks again and sorry for the long post.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2010, 1:40 am 
no worries about the long post, i liked it.

i dont think you have to worry about people viewing your source. all the PHP code is in the background and run on the server. no user can view the code contained in the page, they can only view the result.

my idea is similar to yours. but i have a question for you, how does your validation fail? it seems like whoever downloads your product, the PHP will generate the .ini and send it back.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2010, 2:22 am 
here are the files. swp-internal i've fixed the bug and made it revision 0.12. usage at the bottom

SWProtect-Internal.ahk

Code:
; SWProtect-Internal.ahk
;-------------------------------------------------------------------------------
;
; Software Protection Library 0.12
;
; This library contains a set of functions to generate a registration key
; based on a user fingerprint.
; To be used separately or together with the GUI library - SWProtect-GUI.ahk
;
; Original Code:    Laszlo Hars <www.Hars.US>
; Library Version:  Icarus
; modifications:    guest3456          (see changelog at bottom)
;
; Original proof of concept by Laszlo, taken from AutoHotkey Forum at
; http://www.autohotkey.com/forum/viewtopic.php?t=5763&postdays=0&postorder=asc&start=0
;
;
; Functions in this version
;
;   SWP_Initialize( [ secret1, secret 2, ... , secret 8 ] )
;   Fingerprint := SWP_GetPcFingerprint()
;   UserOK      := SWP_IsUserAuthenticated( username, email, key )
;   Key         := SWP_GenerateKey( username, email, fingerprint )
;
;-------------------------------------------------------------------------------


#NoEnv





;-------------------------------------------------------------------------------
; TESTER - Comment or delete this tester when including the file
;

/*

; Initialize the required globals
;----------------------------------------
SWP_Initialize()        ; May be called with up to 8 secret keys


; Get a hardware fingerprint
;----------------------------------------
Fingerprint := SWP_GetPcFingerprint()
MsgBox 32,,Your computer ID is`n%Fingerprint%


; Generate a license key for this user
;----------------------------------------
Username    := "Icarus"
Email       := "Icarus@Sky.com"
Key         := SWP_GenerateKey( Username, Email, Fingerprint )
MsgBox 32,,Your registration details are:`nUser:`t%Username%`nEmail:`t%Email%`nKey:`t%Key%


; Check if a user's registration code is ok
;----------------------------------------
;Key := "some invalid key by the user"                      ; Uncomment to test
UserOK      := SWP_IsUserAuthenticated( Username, Email, Key )
If( UserOK )
    MsgBox 32,OK,User is authenticated
Else
    MsgBox 16,INVALID,User is NOT authenticated`n%Username%`n%Email%`n%Key%
   
   
Return


*/

;
; END OF TESTER
;-------------------------------------------------------------------------------




;-------------------------------------------------------------------------------
; API Functions
;-------------------------------------------------------------------------------
;
; SWP_Initialize( [ secret1, secret 2, ... , secret 8 ] )
; Fingerprint := SWP_GetPcFingerprint()
; UserOK      := SWP_IsUserAuthenticated( username, email, key )
; Key         := SWP_GenerateKey( username, email, fingerprint )
;
;-------------------------------------------------------------------------------
SWP_Initialize( mk0=0x11111111, mk1=0x22222222, mk2=0x33333333, mk3=0x44444444
    ,ml0=0x12345678, ml1=0x12345678, mm0=0x87654321, mm1=0x87654321 ) {
   
    Global

    k0 := mk0                  ; 128-bit secret key (example)
    k1 := mk1
    k2 := mk2
    k3 := mk3
   
    l0 := ml0                  ; 64- bit 2nd secret key (example)
    l1 := ml1
   
    m0 := mm0                  ; 64- bit 3rd secret key (example)
    m1 := mm1

}


SWP_GetPcFingerprint() {
    EnvGet, COMPUTERNAME, COMPUTERNAME
    EnvGet, HOMEPATH, HOMEPATH
    EnvGet, USERNAME, USERNAME
    EnvGet, PROCESSOR_ARCHITECTURE, PROCESSOR_ARCHITECTURE
    EnvGet, PROCESSOR_IDENTIFIER, PROCESSOR_IDENTIFIER
    EnvGet, PROCESSOR_LEVEL, PROCESSOR_LEVEL
    EnvGet, PROCESSOR_REVISION, PROCESSOR_REVISION

    PCdata = %COMPUTERNAME%%HOMEPATH%%USERNAME%%PROCESSOR_ARCHITECTURE%%PROCESSOR_IDENTIFIER%
    PCdata = %PCdata%%PROCESSOR_LEVEL%%PROCESSOR_REVISION%%A_OSType%%A_OSVersion%%Language%

    Fingerprint := XCBC(Hex(PCdata,StrLen(PCdata)), 0,0, 0,0,0,0, 1,1, 2,2)
    Return Fingerprint
}

SWP_GenerateKey( username, email, fingerprint ) {
    Global k0,k1,k2,k3,l0,l1,m0,m1
   
    If( not k0 ) {
        MsgBox 16,Error,Error in SWP_GenerateKey - values are not initialized.`nPlease call SWP_Initialize() first.
        Return false
    }
       
    Together = %username%%email%%fingerprint%
    Auth := XCBC(Hex(Together,StrLen(Together)), 0,0, k0,k1,k2,k3, l0,l1, m0,m1)
    Return Auth
}


SWP_IsUserAuthenticated( username, email, key ) {
    Global k0,k1,k2,k3,l0,l1,m0,m1
   
    If( not k0 ) {
        MsgBox 16,Error,Error in SWP_IsUserAuthenticated - values are not initialized.`nPlease call SWP_Initialize() first.
        Return false
    }

    Fingerprint := SWP_GetPcFingerprint()
    Together = %username%%email%%Fingerprint%

    AuthData := XCBC(Hex(Together,StrLen(Together)), 0,0, k0,k1,k2,k3, l0,l1, m0,m1)
   
    Return Key=AuthData
}




;-------------------------------------------------------------------------------
; Internal Functions by Laszlo
;-------------------------------------------------------------------------------

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; TEA cipher ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Block encryption with the TEA cipher
; [y,z] = 64-bit I/0 block
; [k0,k1,k2,k3] = 128-bit key
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

TEA(ByRef y,ByRef z, k0,k1,k2,k3)
{                                   ; need  SetFormat Integer, D
   s = 0
   d = 0x9E3779B9
   Loop 32                          ; could be reduced to 8 for speed
   {
      k := "k" . s & 3              ; indexing the key
      y := 0xFFFFFFFF & (y + ((z << 4 ^ z >> 5) + z  ^  s + %k%))
      s := 0xFFFFFFFF & (s + d)  ; simulate 32 bit operations
      k := "k" . s >> 11 & 3
      z := 0xFFFFFFFF & (z + ((y << 4 ^ y >> 5) + y  ^  s + %k%))
   }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; XCBC-MAC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; x  = long hex string input
; [u,v] = 64-bit initial value (0,0)
; [k0,k1,k2,k3] = 128-bit key
; [l0,l1] = 64-bit key for not padded last block
; [m0,m1] = 64-bit key for padded last block
; Return 16 hex digits (64 bits) digest
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

XCBC(x, u,v, k0,k1,k2,k3, l0,l1, m0,m1)
{
   Loop % Ceil(StrLen(x)/16)-1   ; full length intermediate message blocks
      XCBCstep(u, v, x, k0,k1,k2,k3)

   If (StrLen(x) = 16)              ; full length last message block
   {
      u := u ^ l0                   ; l-key modifies last state
      v := v ^ l1
      XCBCstep(u, v, x, k0,k1,k2,k3)
   }
   Else {                           ; padded last message block
      u := u ^ m0                   ; m-key modifies last state
      v := v ^ m1
      x = %x%100000000000000
      XCBCstep(u, v, x, k0,k1,k2,k3)
   }
   Return Hex8(u) . Hex8(v)         ; 16 hex digits returned
}

XCBCstep(ByRef u, ByRef v, ByRef x, k0,k1,k2,k3)
{
   StringLeft  p, x, 8              ; Msg blocks
   StringMid   q, x, 9, 8
   StringTrimLeft x, x, 16
   p = 0x%p%
   q = 0x%q%
   u := u ^ p
   v := v ^ q
   TEA(u,v,k0,k1,k2,k3)
}

Hex8(i)                             ; 32-bit integer -> 8 hex digits
{
   format = %A_FormatInteger%       ; save original integer format
   SetFormat Integer, Hex
   i += 0x100000000                 ; convert to hex, set MS bit
   StringTrimLeft i, i, 3           ; remove leading 0x1
   SetFormat Integer, %format%      ; restore original format
   Return i
}

Hex(ByRef b, n=0)                   ; n bytes data -> stream of 2-digit hex
{                                   ; n = 0: all (SetCapacity can be larger than used!)
   format = %A_FormatInteger%       ; save original integer format
   SetFormat Integer, Hex           ; for converting bytes to hex

   m := VarSetCapacity(b)
   If (n < 1 or n > m)
       n := m
   Loop %n%
   {
      x := 256 + *(&b+A_Index-1)    ; get byte in hex, set 17th bit
      StringTrimLeft x, x, 3        ; remove 0x1
      h = %h%%x%
   }
   SetFormat Integer, %format%      ; restore original format
   Return h
}


;-------------------------------------------------------------------------------
; Revision History
;-------------------------------------------------------------------------------
/*

    0.12  2010-04-29
        - guest3456: changed script to use #NoEnv and GetFingerprint to use EnvGet
          to solve this bug: http://www.autohotkey.com/forum/post-347395.html#347395


    0.11  2007 09 04
        - Fixed  : IsUserAuthenticated returned -1 in case of an uninitialized
                   globals, now returning false.
       
    0.10  2007 09 03
        - First version



*/





SWProtect-GUI.ahk

Code:
; SWProtect-GUI.ahk
;-------------------------------------------------------------------------------
;
; Software Protection Library - GUI Implementation 0.11
;
; This library contains a simple set of GUI functions to allow easy
; implementation of a software protection, using a registration code and a
; computer fingerprint.
;
; Requires: SWProtect-Internal.ahk
;
; Original Code:        Laszlo Hars <www.Hars.US>
; Library/GUI Version:  Icarus
;
; AutoHotkey Forum Thread:
; http://www.autohotkey.com/forum/viewtopic.php?t=5763&postdays=0&postorder=asc&start=0
;
; USAGE 1:
;   1. Include this file in your script
;   2. In your loading sequence, call SWP_Initialize() then
;      SWP_CheckRegistration( "AppName", "DeveloperEmail" )
;      to check/ask for a valid registration.
;
; USAGE 2:
;   1. Include this file in a new script
;   2. Call SWP_Initialize() then SWP_ShowKeyGen() to activate a KeyGen dialog
;
; TODO:
;   - See if there is a way to use less global variables
;   - See if there is a way to avoid using a fixed GUI ID (currently, 20) and
;     instead pass it as an optional parameter. The reason why this is not
;     implemented like this is because we need to have 20GuiEscape: labels
;
;-------------------------------------------------------------------------------
#Include SWProtect-Internal.ahk

;-------------------------------------------------------------------------------
; TESTER - Comment or delete this tester when including the file
;

/*

#SingleInstance Force
SetWorkingDir %A_ScriptDir%

; USAGE 1: Add this in a separate file, to have your own keygen
;-------------------------
SWP_Initialize( 0x81645732, 0x19573549 )   ; Up to 8 secret keys,
SWP_ShowKeyGen()
Return
;-------------------------


; USAGE 2: Add this in your loading sequence to check/ask for a valid registration
;-------------------------
;SWP_Initialize( 0x81645732, 0x19573549 )    ; Up to 8 secret keys,
;SWP_CheckRegistration( "My Application", "software@developer.com" )     
;-------------------------



Msgbox The program continues here`n`n`n`n`n`n`n`n
Return

*/

;
; END OF TESTER
;-------------------------------------------------------------------------------

;-------------------------------------------------------------------------------
; Main GUI Function
;-------------------------------------------------------------------------------

SWP_CheckRegistration( appName, developerEmail, iniFilename="Reg.ini" ) {
;
; Checks for the existence of a valid registration file.
; If registration is valid, it will return the control to the caller, otherwise
; it will show a registration GUI (with an option to the user to ask for a
; registration key) and will only resume normal operation if a valid
; registration code is entered.
;
; When a valid key is entered, the registration details will be saved in an INI
; file (default: Reg.ini) so that next time this function is called, it will be
; able to find the registration code on its own.
;
;-------------------------------------------------------------------------------
    Global SWP_AppName, SWP_IniFilename, SWP_DeveloperEmail, SWP_LicenseOK
   
    SWP_AppName        := appName
    SWP_IniFilename    := iniFilename
    SWP_DeveloperEmail := developerEmail
    SWP_LicenseOK      := false
   
    If( Not FileExist( iniFilename ) ) {
        SWP_ShowRegisterDialog( appName )
        Loop
            If( SWP_LicenseOK )     ; Loop will be broken by a valid license
                Break

    }
    Else {                          ; File exists, read registration data and validate
        SWP_ReadRegFile( iniFilename )
        Sleep 1000      ; This is here since the Reload in SWP_ReadRegFile
                        ; seem to still give the application to continue running
                        ; before it actually reloads.
                        ; Deleteing this launches the "The program continues"
                        ; msgbox
                        ; *** TODO: Can be fixed?

    }

}

SWP_ShowKeyGen() {
;
; This function shows a simple generator for registration numbers.
; Once the user has sent you his Computer ID, use this function to generate
; a valid registration key for this user+computer.
;
; The proper use of this function, is to create a separate ahk code, including
; this library, then calling this function.
;
; Note that you need to call SWP_Initialize with the same seed keys as in your
; SWP_CheckRegistration function BEFORE you call this function.
;
;-------------------------------------------------------------------------------
    Global SwpGuiVal_Name, SwpGuiVal_Email, SwpGuiVal_Key, SwpGuiVal_Fingerprint
        ,SWP_GuiID
   
    SWP_GuiID := 20
    GuiID := SWP_GuiID
   
    Gui %GuiID%:Margin, 10, 10

    ; Top introduction text
    Gui %GuiID%:Font, s10 bold
    Gui %GuiID%:Add, Text, x10 y10 w352 h22 center, Please enter user details:
    Gui %GuiID%:Font, s10 norm

    ; Text labels
    Gui %GuiID%:Add, Text, xp y+15 w135 h22 right section, % "Name/Company: "
    Gui %GuiID%:Add, Text, xp y+2  wp   hp  right        , % "Email Address: "
    Gui %GuiID%:Add, Text, xp Y+2  wp   hp  right        , % "Computer ID: "
    Gui %GuiID%:Add, Text, xp Y+2  wp   hp  right        , % "Key: "
   
    ; Edit fields
    Gui %GuiID%:Add, Edit, xs+137 ys  wp+64 hp vSwpGuiVal_Name
    Gui %GuiID%:Add, Edit, xp     y+2 wp    hp vSwpGuiVal_Email
    Gui %GuiID%:Add, Edit, xp     y+2 wp    hp vSwpGuiVal_Fingerprint
    Gui %GuiID%:Font, s10 bold
    Gui %GuiID%:Add, Edit, xp     y+2 wp    hp readonly center vSwpGuiVal_Key
    Gui %GuiID%:Font, s10 norm
    Gui %GuiID%:Add, Groupbox, xs ys-20 w352 h126
   
    ; Buttons
    Gui %GuiID%:Add, Button, xs  y+10 w109   h24 gSWP_RegisterDialogCancel  , E&xit
    Gui %GuiID%:Font, s10 bold
    Gui %GuiID%:Add, Button, x+2    yp   wp+20 hp  default gSWP_KeygenGenerate  , &Generate
    Gui %GuiID%:Font, s10 norm
    Gui %GuiID%:Add, Button, x+2    yp   wp-20 h24 gSWP_KeygenOk, &Copy && Exit
   
    Gui %GuiID%:Show, w372, Registration Key Generator
}

;-------------------------------------------------------------------------------
; Other GUI Functions (you should generally avoid calling these functions)
;-------------------------------------------------------------------------------

SWP_ShowRegisterDialog( appName ) {
    Global SWP_GuiID        ; *** TODO: See if there is a way to have a dynamically
                            ; created 20GuiEscape labels, so we can pass GuiID as
                            ; an optional parameter to the function

    Global SWP_AppName, SwpGuiVal_Name, SwpGuiVal_Email, SwpGuiVal_Key
   
    SWP_GuiID := 20
    GuiID := SWP_GuiID
   
    Gui %GuiID%:Margin, 10, 10

    ; Top introduction text
    Gui %GuiID%:Font, s10 bold
    Gui %GuiID%:Add, Text, x10 y10 w352 h22 center, %appName% is not registered.
    Gui %GuiID%:Font, s10 norm
    Gui %GuiID%:Add, Text, xp y+0 wp hp center, Please enter your registration details:

    ; Text labels
    Gui %GuiID%:Add, Text, xp y+15 w135 h22 right section, % "Name/Company: "
    Gui %GuiID%:Add, Text, xp y+2  wp   hp  right        , % "Email Address: "
    Gui %GuiID%:Add, Text, xp Y+2  wp   hp  right        , % "Registration Code: "
   
    ; Edit fields
    Gui %GuiID%:Add, Edit, xs+137 ys  wp+64 hp vSwpGuiVal_Name
    Gui %GuiID%:Add, Edit, xp     y+2 wp    hp vSwpGuiVal_Email
    Gui %GuiID%:Add, Edit, xp     y+2 wp    hp vSwpGuiVal_Key
    Gui %GuiID%:Add, Groupbox, xs ys-20 w352 h102
   
    ; Buttons
    Gui %GuiID%:Add, Button, xs  y+10 w168 h24 gSWP_RegisterDialogGetKey    , &Get a Registration Key
    Gui %GuiID%:Add, Button, x+2 yp   w90  h24 gSWP_RegisterDialogCancel    , E&xit
    Gui %GuiID%:Font, s10 bold
    Gui %GuiID%:Add, Button, x+2 yp   w90  h24 default gSWP_RegisterDialogOk, Register
   
    Gui %GuiID%:Show, w372, %appName% Registration
}

20GuiEscape:
20GuiClose:
SWP_RegisterDialogCancel:
    ExitApp
Return

SWP_RegisterDialogOk:
    Gui %SWP_GuiID%:Submit, NoHide
    If( SwpGuiVal_Name = "" or SwpGuiVal_Email = "" or SwpGuiVal_Key = "" )
        MsgBox 16,Invalid Registration, Invalid Registration.`nPlease check your input.`t
    Else If( Not SWP_IsUserAuthenticated( SwpGuiVal_Name, SwpGuiVal_Email, SwpGuiVal_Key ) ) {
        MsgBox 16,Invalid Registration, Invalid Registration.`nPlease check your input.`t
    }
    Else {
        ; Registration ok, write to ini file and exit happily
        IniWrite %SwpGuiVal_Name%, %SWP_IniFilename%, Registration, Name
        IniWrite %SwpGuiVal_Email%, %SWP_IniFilename%, Registration, Email
        IniWrite %SwpGuiVal_Key%, %SWP_IniFilename%, Registration, Key
        MsgBox 64,Registration Accepted, Your registration was accepted and saved.`t`nThank you for using %SWP_AppName%.
        SWP_LicenseOK := true
        Gui %SWP_GuiID%:Destroy
    }   
Return

SWP_RegisterDialogGetKey:
    SWP_ShowGetKeyDialog()
Return

SWP_ShowGetKeyDialog() {
    Global SWP_GuiID, SWP_AppName, SwpGuiVal_Fingerprint, SwpGuiButton_Ok
        ,SWP_DeveloperEmail

    ; Destroy
    Gui %SWP_GuiID%:Destroy
   
    ; Then rebuild
    SwpGuiVal_Fingerprint := SWP_GetPcFingerprint()
   
    GuiID := SWP_GuiID
    Gui %GuiID%:Margin, 10, 10

    ; Middle box
    Gui %GuiID%:Font, s10 norm
    Gui %GuiID%:Add, Text, x20   y20  w332  h44 center section, Please send us this Computer ID together with your name and email address.
    Gui %GuiID%:Font, s12 bold
    Gui %GuiID%:Add, Edit, xp+10 y+2  wp-20 h24 r1 ReadOnly center vSwpGuiVal_Fingerprint, %SwpGuiVal_Fingerprint%
    Gui %GuiID%:Font, s10 bold
    Gui %GuiID%:Add, Text, xp    y+2  wp    h24 center, Send to %SWP_DeveloperEmail%
    Gui %GuiID%:Font, s10 norm
    Gui %GuiID%:Add, Groupbox, xs-10 ys-15 w352 h128
   
    ; Buttons
    Gui %GuiID%:Add, Button, xs-10  y+10 w90 h24 gSWP_RegisterDialogCancel  , E&xit
    Gui %GuiID%:Font, s10 bold
    Gui %GuiID%:Add, Button, x+2 yp w259  h24 default vSwpGuiButton_Ok gSWP_GetDialogOk, Copy to Clipboard && Exit
   
    GuiControl %GuiID%:Focus, SwpGuiButton_Ok       ; To avoide the selection of the fingerprint
   
    Gui %GuiID%:Show, w372, %SWP_AppName% Registration
}

SWP_GetDialogOk:
    Gui %SWP_GuiID%:Submit
    Clipboard := "Computer ID: " SwpGuiVal_Fingerprint
    MsgBox 64,Copied to Clipboard, Your Computer ID was copied to the clipboard.`nPlease send it along with your name and email address to`t`n%SWP_DeveloperEmail%.
    ExitApp
Return


SWP_ReadRegFile( iniFilename ) {
    Global SWP_LicenseOK
    IniRead Name, %iniFilename%, Registration, Name
    IniRead Email, %iniFilename%, Registration, Email
    IniRead Key, %iniFilename%, Registration, Key
    SWP_LicenseOK := false
    If( Not SWP_IsUserAuthenticated( Name, Email, Key ) ) {
        MsgBox 16,Invalid Registration, Your registration details seem to be invalid.`t`n
        FileDelete %iniFilename%
        Reload
    }
    SWP_LicenseOK := true
}

SWP_KeygenGenerate:
    Gui %SWP_GuiID%:Submit, NoHide
    SwpGuiVal_Key := SWP_GenerateKey( SwpGuiVal_Name, SwpGuiVal_Email, SwpGuiVal_Fingerprint )
    GuiControl ,%SWP_GuiID%:,SwpGuiVal_Key,%SwpGuiVal_Key%
Return

SWP_KeygenOK:
    Gui %SWP_GuiID%:Submit, NoHide
    Clipboard =
        ( LTRIM
            -----------------------------------
            Username: %SwpGuiVal_Name%
            Email:    %SwpGuiVal_Email%
            Key:      %SwpGuiVal_Key%
            -----------------------------------
        )
    Gui %SWP_GuiID%:Destroy

Return


;-------------------------------------------------------------------------------
; Revision History
;-------------------------------------------------------------------------------
/*

    0.11  2007 09 04
        - Added  : Keygen
        - Changed: Initialize function (secret seeds) now needs to be called
          separately prior to calling any of the other main GUI functions.
          This is done to allow different key generation for every software
          you develop.
          If this is not a requirement, the Initialize function can be put
          back into the two main GUI functions (only make sure you are using
          the same seeds)
       
    0.10  2007 09 03
        - First version



*/




yourname.php

Code:
<?php


SWP_Initialize(0x81645732,0x19573549);

$str = "UsernameEmailFingerprint";



$key=XCBC($str);
echo "key: ".$key."<br />";


function XCBC($str)
   {
   global $str,$u,$v,$l0,$l1,$m0,$m1;
   $u=0;
   $v=0;
   $str = bin2hex($str);


   // full length intermediate message blocks
   $flimbs = ceil(strlen($str)/16)-1;

   for($i=0; $i<$flimbs; $i+=1)
      {
      XCBCstep();
      }
     

   if (strlen($str)==16)
      {
      $u = $u ^ $l0;               
      $v = $v ^ $l1;

      XCBCstep();
      }else{
      $u = $u ^ $m0;               
      $v = $v ^ $m1;

      $str = $str."100000000000000";

      XCBCstep();
      }


$u = dechex($u);
$v = dechex($v);
while (strlen($u) < 8) { $u='0'.$u; }
while (strlen($v) < 8) { $v='0'.$v; }

return $u.$v;




}

function XTEA()
   {
   global $u,$v,$key;
   $s = 0;
   $d = 0x9e3779b9;
   for($i=0; $i<32;$i++)
      {
      $u = _add($u ,_add($v << 4 ^ _rshift($v,5), $v) ^ _add($s,$key[$s & 3] ) );
      $s =  ($s + $d) ;
      $s= 0xffffffff & $s ;
      $v = _add($v ,_add($u << 4 ^ _rshift($u,5), $u) ^ _add($s,$key[_rshift($s, 11) & 3]));
      }
   return;
   }



function XCBCstep()
   {
   global $u,$v,$str;
   $p = substr($str,0,8);
   $q = substr($str,8,8);
   $str = substr($str,16);
   $p=hexdec($p);
   $q=hexdec($q);
   $u = $u ^ $p;
   $v = $v ^ $q;
   XTEA();
   return;
   }



function _add($i1, $i2) {
        $result = 0.0;
        foreach (func_get_args() as $value)
      {
           if (0.0 > $value) {
                $value -= 1.0 + 0xffffffff;
               }
               $result += $value;
           }


           // convert to 32 bits
           if (0xffffffff < $result || -0xffffffff > $result) {
                  $result = fmod($result, 0xffffffff + 1);
              }

           // convert to signed integer
           if (0x7fffffff < $result) {
               $result -= 0xffffffff + 1.0;
           } elseif (-0x80000000 > $result) {
                  $result += 0xffffffff + 1.0;
           }

           return $result;
          }


function hex2bin($h)
   {
     if (!is_string($h)) return null;
     $r='';
     for ($a=0; $a<strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); }
     return $r;
     }


function _rshift($integer, $n) {
        // convert to 32 bits
        if (0xffffffff < $integer || -0xffffffff > $integer) {
            $integer = fmod($integer, 0xffffffff + 1);
        }

        // convert to unsigned integer
        if (0x7fffffff < $integer) {
            $integer -= 0xffffffff + 1.0;
        } elseif (-0x80000000 > $integer) {
            $integer += 0xffffffff + 1.0;
        }

        // do right shift
        if (0 > $integer) {
            $integer &= 0x7fffffff;                     // remove sign bit before shift
            $integer >>= $n;                            // right shift
            $integer |= 1 << (31 - $n);                 // set shifted sign bit
        } else {
            $integer >>= $n;                            // use normal right shift
        }

        return $integer;
    }

function SWP_Initialize($mk0=0x11111111, $mk1=0x22222222, $mk2=0x33333333, $mk3=0x44444444 ,$ml0=0x12345678,$ml1=0x12345678,$mm0=0x87654321, $mm1=0x87654321)
{
   
    global $l0,$l1,$m0,$m1 ,$key;

    $key[0] = $mk0;                 
    $key[1] = $mk1;
    $key[2] = $mk2;
    $key[3] = $mk3;

   
    $l0 = $ml0;                 
    $l1 = $ml1;
   
    $m0 = $mm0;                 
    $m1 = $mm1;


return;

}

?>



to test that the AHK and PHP generate the same key, heres what you do:

as you can see on the top of the PHP file, there is an Initialize with two keys and a str="UsernameEmailFingerprint". upload the PHP to your webserver and navigate to the page. it will show you the key generated.

use SWProtect-GUI.ahk and uncomment the TESTER section and use USAGE1 which will show you the keygen window. simply put in "Username", "Email", and "Fingerprint" in the respective fields, and click generate. it should show the same key as the PHP in your browser.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2010, 9:56 pm 
Got my original PHP page to work.

changed
$str = "fingerprint"

to

$str = "useremailfingerprint"

Thanks for all of your help :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2010, 3:43 pm 
Tom, great to hear

FF, have you got it working?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2010, 5:40 pm 
@guest3456 Thanks for taking the time to help :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 3rd, 2010, 6:18 pm 
guest3456 - is it possible to create a user/email/fingerprint that match the AHK version, but using PHP ?


Thanks :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 5th, 2010, 2:51 am 
guest3456 thank you for your time and explanations
I think I will stick with the e-mail activation so far, because:
1. I will have over 200+ scripts for sale and it would be a mess to change the passwords for each script
2. I do not know my buyers yet. I may have 5 buyers per day for the same script or I may have zero. Each script will be available for download after paypal payment and they could share the scripts after this. In order for the php script to work, each script should have it's own ID so the php will not generate a key if the same script is asking for activation again.
...messy
I dont see a good idea of automation yet for selling over the internet. Will keep thinking, though. The process of selling the same product to hundreds of users and making that same script not working on another puters after it is downloaded is elaborated.
Maybe I am a bit paranoid but as you know, it is better to have control over things, cause once u let it go, is gone and theres no way back.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 5th, 2010, 10:49 am 
Well put.
While I don't have hundreds of scripts, I do have one.
I thought very long about this. Because it was impacting the rest of my life.
I went the other direction. Open source. Once you let it go you can't go back - becomes liberation.

I was using email, received, scraping the text of email for name, email address and computer id. I also had the keygeneration script automatically send gmail email. Seemed to work fine.
Now I am working on my house instead.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2010, 4:11 am 
Tom, you do it the same way. i dont know what youre having a problem with. are you using SWProtect-Gui for the key generator?

FF, likewise, i am not sure of the best way to do automated activation. i will probably stick with email responses, unless...

like Guest, i just give up on selling commercial completely, and instead go open source. too much time has been wasted considering all of this shit.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2010, 4:12 am 
oh, Tom, if you are asking if its possible to generate the PC fingerprint using PHP, i wouldn't know. i don't know much about PHP, i've just modified a script another user posted earlier in the thread


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2010, 6:13 pm 
@ guest3456 - Thanks - I have it working fine, was wondering how to create a fingerprint in PHP.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2010, 11:44 pm 
Currently SWProtect-GUI.ahk is used to create the fingerprint and allow the user to enter their name and email address.
The fingerprint is then copied to the clipboard.

Could this be adapted so instead of copying the fingerprint to the clipboard, It launches the default email client and creates a basic email.

The TO Address would be mine, the FROM address would be the email address the user entered.

The Subject what ever we set it as and the body would be like:

User: TOM TOM
Email: TOM@TOM.COM
Fingerprint: 1234567890

Anyone any ideas on doing this ??

I have a found a small app that can monitor a mail box and extract this information and store it automatically in a mysql DB...

add a quick php page that checks the DB for a new entry, reads the values and then created the keys..

Just a thought, if some one can help with SWProtect-GUI.ahk !!


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 290 posts ]  Go to page Previous  1 ... 14, 15, 16, 17, 18, 19, 20  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Stigg and 8 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group