AutoHotkey Community

It is currently May 27th, 2012, 11:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 290 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 20  Next
Author Message
 Post subject:
PostPosted: June 26th, 2007, 5:40 pm 
Offline

Joined: June 19th, 2007, 12:04 am
Posts: 174
it's just not working for me, lol


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2007, 8:36 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Describe in details, what you did and how it failed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2007, 9:42 pm 
Offline

Joined: June 19th, 2007, 12:04 am
Posts: 174
1. Got both scripts, and put them in their own script.

2. I have two emails, so i started the first script and sent my info, through email. Then i started the second script and put the data in. when i put the fingerprint id in and hit ok, the program just exited and that was it.

Where do i go from there?

By the way if this works, it'll be awesome!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2007, 9:50 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
You should see the result in the SafeSW.ini file, in the script's directory.
Something like this
Code:
[Registration]
User =username
Email =no@where.com
UnlockCode =56a37b308c63788b

The unlock code generation script should look like this:
Code:
; ... ...
IniFile = SafeSW.ini

InputBox User, User,  Enter the User's name,,   220,140
InputBox Email,Email, Enter the User's Email,,  220,140
InputBox FGprt,FGprt, Enter the PC Fingerprint,,220,140
Together = %User%%Email%%FGprt%
Auth := XCBC(Hex(Together,StrLen(Together)), 0,0, k0,k1,k2,k3, l0,l1, m0,m1)
IniWrite %User%, %IniFile%, Registration, User
IniWrite %Email%,%IniFile%, Registration, Email
IniWrite %Auth%, %IniFile%, Registration, UnlockCode

ExitApp

;---- End autoexecute secsion ... ...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2007, 10:34 pm 
Offline

Joined: June 19th, 2007, 12:04 am
Posts: 174
error in:

Code:
Auth := XCBC(Hex(Together,StrLen(Together)), 0,0, k0,k1,k2,k3, l0,l1, m0,m1)


call to non-existent function


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2007, 10:39 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
I did not copy the beginning and end of the script, only the part, which differs from the one in the first post. (The omissions are indicated by ... ...)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2007, 11:20 pm 
Offline

Joined: June 19th, 2007, 12:04 am
Posts: 174
what i am saying is whenever i start the second script that generates the lock code, i keep getting the error: call to non-existent function on this part of the code:

Code:
Auth := XCBC(Hex(Together,StrLen(Together)), 0,0, k0,k1,k2,k3, l0,l1, m0,m1)


it doesn't work becuase it keeps giving me that error.

Code:
     IniFile = SafeSW.ini

     InputBox User, User,  Enter the User's name,,   220,140
     InputBox Email,Email, Enter the User's Email,,  220,140
     InputBox FGprt,FGprt, Enter the PC Fingerprint,,220,140
     Together = %User%%Email%%FGprt%
-->  AuthData := XCBC(Hex(Together,StrLen(Together)), 0,0, k0,k1,k2,k3,l0,l1, m0,m1)
     IniWrite %User%, %IniFile%, Registration, User
     IniWrite %Email%,%IniFile%, Registration, Email
     IniWrite %Auth%, %IniFile%, Registration, UnlockCode

     ExitApp


problem at arrow


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2007, 12:23 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Laszlo wrote:
I did not copy the beginning and end of the script, only the part, which differs from the one in the first post. (The omissions are indicated by ... ...)
Here is the complete script #2, which you should have put together yourself
Code:
; AutoHotkey Version: 1.0.39+
; Language:  English
; Platform:  Win2000/XP
; Author:    Laszlo Hars <www.Hars.US>
; Function:  SW copy protection

k0 = 0x11111111                  ; 128-bit secret key (example)
k1 = 0x22222222
k2 = 0x33333333
k3 = 0x44444444

l0 = 0x12345678                  ; 64- bit 2nd secret key (example)
l1 = 0x12345678

m0 = 0x87654321                  ; 64- bit 3rd secret key (example)
m1 = 0x87654321

IniFile = SafeSW.ini

;;;;;; - here starts the modified part - ;;;;;;

InputBox User, User,  Enter the User's name,,   220,140
InputBox Email,Email, Enter the User's Email,,  220,140
InputBox FGprt,FGprt, Enter the PC Fingerprint,,220,140
Together = %User%%Email%%FGprt%
Auth := XCBC(Hex(Together,StrLen(Together)), 0,0, k0,k1,k2,k3, l0,l1, m0,m1)
IniWrite %User%, %IniFile%, Registration, User
IniWrite %Email%,%IniFile%, Registration, Email
IniWrite %Auth%, %IniFile%, Registration, UnlockCode

;;;;;; - here ends the modified part - ;;;;;;

ExitApp

;---- End autoexecute secsion ----;

CheckAuth:
   IniRead User, %IniFile%, Registration, User
   IniRead Email,%IniFile%, Registration, Email
   IniRead Code, %IniFile%, Registration, UnlockCode
   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)
   Together = %User%%Email%%Fingerprint%
   AuthData := XCBC(Hex(Together,StrLen(Together)), 0,0, k0,k1,k2,k3, l0,l1, m0,m1)
   If (User="Error" || Email="Error" || Code <> AuthData)
   {
      S =
      (  LTrim
         To: Registration@MyOwn.com
         Username = <enter your full name here>
         Your email address = <where you want the unlock code sent>
         PC Fingerprint = %Fingerprint%
      )
      ClipBoard = %S%
      MsgBox Please Register! Email the following information`n`n%S%`n`n(it has been copied to the ClipBoard)
      ExitApp
   }
Return

;---- Crypto functions ----;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2007, 12:48 am 
Offline

Joined: June 19th, 2007, 12:04 am
Posts: 174
YAHOOOOOOOOOOOOOOO!!!!! :lol:

After two long days, it WORKS!!!!!!!!!!!!!!!!!!!!!!!!!

WOOOOOOT!

Thank You!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2007, 1:25 am 
Offline

Joined: June 19th, 2007, 12:04 am
Posts: 174
Now that we got that part figured out, how would i go about adding this to an already made script?

can i get an example please?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2007, 2:39 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Script #2 has only one function, to create SafeSW.ini, with the registration/copy protection information. The original script #1 (in the first post) is what you extend with the desired functionality, compile with a password and offer the .exe for download (or distribute the way you like).

Locate the two lines in the script #1:
Code:
MsgBox OK   ; add your code here
Sleep 10000 ; add your code here
They are Line 28 and 29. Remove these lines and add the code you write and want to protect in their place. The MsgBox/Sleep lines represent an example.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2007, 3:16 am 
Offline

Joined: June 19th, 2007, 12:04 am
Posts: 174
Thank you very much, works!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 30th, 2007, 8:41 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
nice work Laszlo!
i was wondering... what'd be the best way for a registration routine if the app is supposed to be used portably (on a usb disk) mainly/always.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 30th, 2007, 7:52 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
You could tie the program to the USB disk. When it was formatted it got an ID number, which can be checked. You could also include the physical address of the program file, its time stamp when it was installed, the creation time of its directory, the root directory, the disk size, etc. You could try to hide information on the USB disk:
- create hidden, system files (could be found an copied)
- use some NTFS extended file attributes (but most of the USB sticks are formatted as FAT32, which don't have such)
- hide keys in the unused end of a data block: Create a file of size 508 bytes. The 4 bytes to 512 (the default sector size) is not used by Windows, so you can hide information there. (The storage management system might move the file without the slack.)
- In the partition table or in the master boot record (if there is one) there are unused bytes, where you can hide secrets, which are hard to find and copy over.

These steps need a more complex installation function (which hides data and emails it encrypted to the registration site, as part of the registration info), and the result is quite fragile: some legitimate user actions or background disk management invalidate the registration. I have not tried these, so you could encounter some unpleasant surprises.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2007, 8:16 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
i thought so too... it'd be difficult to implement it.
the best bet IMO is still drive id of usb stick and the drive size... the biggest downside is re-regn reqmt after a format.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 290 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 20  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: nomissenrojb and 59 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