 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Francis Guest
|
Posted: Fri Feb 19, 2010 11:30 am Post subject: Idea ! - 5 Day Limiter |
|
|
Please be nice to me. First Post
I've spent a few days reading and playing and have come up with , what I hope is a 5 day trial limiter.
First !!
I fully understand that no software protection is faultless, that anything relying on registry entries or ini files etc can be hacked. Turning back the time on the PC, leaving it running, deleting the files etc..
But I'm hoping this will offer a bit of protection against a casual pirate, as others have pointed out if the application is any good, people will register it !
Please don't flame me or criticise just for the sake of it. If this is coded wrong, please explain how to improve and amend it.
OK, the idea !!
When the script is first run, create a new ini file, that is hidden, has it's date changed to look like it been there for a while and add today's A_YDAY to it.
Instead of just writing A_YDAY, multiple this by a figure specified in the script.. (just to make it look a bit more obscure)
Then do the same with a registry entry. Write it to an area that is not the application name, and again obscure A_YDAY by multiplying it by another number.
Each time the script is run compare both the ini & the registry entries. Works out the correct A_YDAY by dividing the numbers back
If reg entry is not like ini entry then something is wrong and exit !
If upto this point all is OK, then work out the difference between the stored A_YDAY and Today.
Report back to the user you have x days left.
If the 5 day period has expired warn the user and exitapp.
If the user changes there clock, re write the ini file with an obscure amount so ini & reg will never match.. rendering the app useless.
That's the basic idea
I've got this far by reading on the forum, trying code, deleting and rebooting and so on. Thanks to everyone else who has posted code that I've used. (I only found some of it yesterday.. so not tested this fully)
So here is some code... But please be nice
| Code: | ConfigFile=%A_MyDocuments%\hiddin.ini
IniRead, Estate, %ConfigFile%, View, Estate, %A_SPACE%
if (!Estate) {
ins_date = %A_YDay%
ins_date := ins_date * 457
IniWrite, %ins_date%, %ConfigFile%, View, Estate
FileSetTime, 20040122, %ConfigFile%
FileSetAttrib +RH, %ConfigFile%
}
RegRead, Flatron, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Dev, Flatron
if (!Flatron) {
ins_date = %A_YDay%
ins_date := ins_date * 443725
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Dev, Flatron, %ins_date%
}
FileGetTime, file_time, %ConfigFile%, C
FormatTime, file_time, %ConfigFile%, YDay
If (file_time != %A_YDay%)
{
ini_value := Estate / 457
reg_value := Flatron / 443725
Transform, ini_value, Round, ini_value
Transform, reg_value, Round, reg_value
if (ini_value != reg_value)
{
MsgBox,,Your Trial Period Has Expired, `nPlease buy the full version, contact sales@xxxxx.com
ExitApp
}
}
ConfigRead:
IniRead, Estate, %ConfigFile%, View, Estate
Estate := Estate / 457
Transform, Estate, Round, Estate
Check:=A_YDay-Estate
DaysLeft:=5-Check
If DaysLeft = 0
{
MsgBox,,Your Trial Period Expires Today, `nYour Trial Period Expires Today`nPlease buy the full version, contact sales@xxxxx.com
}
If DaysLeft > 5
{
MsgBox,,Your Trial Period Has Expired, `nPlease buy the full version, contact sales@xxxxx.com
FileSetAttrib -RH, %ConfigFile%
IniWrite, 64357883646, %ConfigFile%, View, Estate
FileSetTime, 20070322, %ConfigFile%
FileSetAttrib +RH, %ConfigFile%
ExitApp
}
else
{
If Check > 5
{
MsgBox,, Your Trial Period Has Expired, `n Please buy the full version, contact sales@xxxxx.com
FileSetAttrib -RH, %ConfigFile%
IniWrite, 64357883646, %ConfigFile%, View, Estate
FileSetTime, 20070322, %ConfigFile%
FileSetAttrib +RH, %ConfigFile%
ExitApp
}
else
{
if DaysLeft !=0
{
MsgBox, %DaysLeft% days left in your Trial Period
}
}
}
Midnight := SubStr( A_Now, 1, 8 ) . "000000"
Midnight += 1, days
Midnight -= A_Now, seconds
Sleep, %Midnight%000
Reload
return |
|
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Fri Feb 19, 2010 3:33 pm Post subject: |
|
|
Cool!
The difficulty is to catch the user setting the system time back, in the BIOS, that is, before Windows or any AHK script has a chance to prevent it. You can look for special Windows system file, like "c:\Windows\WindowsUpdate.log" in Windows 7. If its date or one of the logged entries in it point to the future, we know something has changed with the time. Be careful with daylight saving!
You can also look at the registry: some keys could contain the time and date of a few recent logged events, or make a snapshot at each run of your script of the directory "c:\Windows\System32\LogFiles\Scm". If you find any date in the future, you caught the user changing system time. |
|
| Back to top |
|
 |
Francis Guest
|
Posted: Fri Feb 19, 2010 3:41 pm Post subject: |
|
|
Laszlo - Thank You.
Cool is better than I thought I'd get
Any comments or suggestions on the code would be great. |
|
| Back to top |
|
 |
Francis Guest
|
Posted: Fri Feb 19, 2010 9:03 pm Post subject: |
|
|
Hi
anyone else got any comments about this ?
Will it work ? Is it a good way to do it ?
Any suggestions ! ?
Thanks  |
|
| Back to top |
|
 |
Carcophan
Joined: 24 Dec 2008 Posts: 1308 Location: :noitacoL
|
Posted: Fri Feb 19, 2010 10:38 pm Post subject: |
|
|
I have been reviewing the code. I like the idea a lot. It is basic but still complex enough to get past the 'casual' pirate.
| Quote: | | Turning back the time on the PC, leaving it running, deleting the files etc.. |
| Quote: | | If the user changes there clock, re write the ini file with an obscure amount so ini & reg will never match.. rendering the app useless |
Is anything left behind though, as in, what is stopping someone from 'installing' the program a second time, after the 5th day? I didn't see a 'delete' type command anywhere.
If I were to install a second time, it should create a new 5 day counter, no? |
|
| Back to top |
|
 |
Francis Guest
|
Posted: Sat Feb 20, 2010 9:42 am Post subject: |
|
|
Hi
Thanks for the comments. As you've mentioned I've kept it simple, to deter the casual hacker, I'm sure some one determined would sort it !!
There is no delete function in the script, the idea being the registry and ini entries will still be inplace, rendering the app useless if reinstalled.
I have thought of added a 'run, http://mysite.com/buyme.html' after the expired message, so the user is told the program is expired and then presented with a 'Buy Me' page !!
One concern I have after re reading another thread is the sleep feature, which would be used to reload the script every evening. With out this feature I can't see how we check the day of usage..
Reloading each night would sort that.. but is this the best way ??
| Code: |
Midnight := SubStr( A_Now, 1, 8 ) . "000000"
Midnight += 1, days
Midnight -= A_Now, seconds
Sleep, %Midnight%000
Reload |
I noted the comments on settimer causing issues on one user PC, so decided to avoid that !
I'd be grateful of comments , advice on this !!
please let me know if you use this idea  |
|
| Back to top |
|
 |
Francis Guest
|
Posted: Sun Feb 21, 2010 9:33 pm Post subject: |
|
|
No other comments about this ?
Any advise on the timing ?
Thanks |
|
| Back to top |
|
 |
Francis Guest
|
Posted: Tue Feb 23, 2010 10:08 am Post subject: |
|
|
Quick update
Timed reload seems to be working fine on a locked workstation.  |
|
| Back to top |
|
 |
doyle
Joined: 14 Nov 2007 Posts: 325 Location: London, England
|
Posted: Tue Feb 23, 2010 1:32 pm Post subject: |
|
|
How about getting the script to submit its CPU ID, and a timestamp to an online database when it is loaded?
Then check each time it is reloaded to see is an entry exists.
That way if the user resets their clock, it wont make any difference as the check would run off the server time.
If your script is worth it, then going down a route like this seems best. |
|
| Back to top |
|
 |
Francis Guest
|
Posted: Tue Feb 23, 2010 4:19 pm Post subject: |
|
|
| doyle wrote: | How about getting the script to submit its CPU ID, and a timestamp to an online database when it is loaded?
Then check each time it is reloaded to see is an entry exists.
That way if the user resets their clock, it wont make any difference as the check would run off the server time.
If your script is worth it, then going down a route like this seems best. |
Thanks for the idea.
I'd read a few other threads, that had suggested against doing this as some users wouldn't like the script 'calling home'.
Personally I think it's a good idea !
Do you fancy writing it ! ?  |
|
| Back to top |
|
 |
jpjazzy
Joined: 16 Feb 2010 Posts: 799 Location: SciTE
|
Posted: Tue Feb 23, 2010 7:04 pm Post subject: |
|
|
Seems like a good idea, I actually implemented a kind of fake "Key" in one of my programs just to fool people who were not real tech savy. It only takes one key and not a special key per person but I think this would go nicely with your time trial. I do have one question. How would someone go about getting the time trial to be released if they did actually buy it?
My key:
| Code: |
IfExist, C:\OPW\MyKey.txt
{
FileRead, theKey, C:\OPW\MyKey.txt
IfNotEqual, theKey, GLZYY983YIIE5U8EWFKX3IQYZ
{
FileDelete, C:\OPW\MyKey.txt
}
}
Suspend
IfNotExist, C:\OPW\MyKey.txt
{
InputBox, myKey, Key, Please insert your OMGPOP writer key.
FileAppend, %myKey%, C:\OPW\MyKey.txt ;savekey
If ( myKey = "GLZYY983YIIE5U8EWFKX3IQYZ" )
Msgbox, 0, Key Validated, Thank you for your contribution and enjoy your program. In case anyone tries to scam you just know the original program maker is "Bob S". Thank you again and enjoy!
Reload
}
IfNotEqual, theKey, GLZYY983YIIE5U8EWFKX3IQYZ
{
MsgBox Your program seems to be using a wrong key. Program will now exit.
ExitApp
}
Suspend
|
|
|
| Back to top |
|
 |
Francis Guest
|
Posted: Wed Feb 24, 2010 12:06 am Post subject: |
|
|
| jpjazzy wrote: | How would someone go about getting the time trial to be released if they did actually buy it?
|
Couple of options I suppose..
Some form of registration code is entered into the script and this bypasses the time trial code.
Or have 2 copies of your software. One with the time trail the other fully working.
It would be good if this code would work with SW_Protect.
5 day count down, followed by please register and enter your key.
Anyone up for doing that ? |
|
| Back to top |
|
 |
jpjazzy
Joined: 16 Feb 2010 Posts: 799 Location: SciTE
|
Posted: Wed Feb 24, 2010 10:49 pm Post subject: |
|
|
I did a little bit of editing at work to throw this together and make it look somewhat working. This is untested. The key is "GLZYY983YIIE5U8EWFKX3IQYZ". Key destination is where ever you specify in the beginning. Hopefully something like this will work. Making two programs would render this useless because if someone bought it then gave it to someone else, bam... your programming becomes obsolete and the key is no longer needed.
Here is my code
| Code: | KeyDestination = "C:\Users\Jeremy\Desktop\Bens Music" ;insert the path to the key .txt file here. Make sure your directories are already created or made earlier in the programmer to get the key path. Example: "C:\OPW\MyKey.txt"
IfExist, %KeyDestination%
{
FileRead, theKey, %KeyDestination%
IfEqual, theKey, GLZYY983YIIE5U8EWFKX3IQYZ
{
Goto, SkipSecurity
}
IfNotEqual, theKey, GLZYY983YIIE5U8EWFKX3IQYZ
{
FileDelete, %KeyDestination%
}
}
Suspend
IfNotExist, %KeyDestination%
{
InputBox, myKey, Key, Please insert your program key.
{
If ErrorLevel
MsgBox, 4, ALERT, Would you like to close the application?
IfMsgBox, YES
{
ExitApp
}
}
FileAppend, %myKey%, %KeyDestination% ;savekey
If ( myKey = "GLZYY983YIIE5U8EWFKX3IQYZ" )
{
Msgbox, 0, Key Validated, Thank you for your contribution and enjoy your program.
Reload
}
IfNotEqual, theKey, GLZYY983YIIE5U8EWFKX3IQYZ
{
MsgBox Your program seems to be using unregistered software. Please consider buying the program.
}
}
Suspend
ConfigFile=%A_MyDocuments%\hiddin.ini
IniRead, Estate, %ConfigFile%, View, Estate, %A_SPACE%
if (!Estate) {
ins_date = %A_YDay%
ins_date := ins_date * 457
IniWrite, %ins_date%, %ConfigFile%, View, Estate
FileSetTime, 20040122, %ConfigFile%
FileSetAttrib +RH, %ConfigFile%
}
RegRead, Flatron, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Dev, Flatron
if (!Flatron) {
ins_date = %A_YDay%
ins_date := ins_date * 443725
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Dev, Flatron, %ins_date%
}
FileGetTime, file_time, %ConfigFile%, C
FormatTime, file_time, %ConfigFile%, YDay
If (file_time != %A_YDay%)
{
ini_value := Estate / 457
reg_value := Flatron / 443725
Transform, ini_value, Round, ini_value
Transform, reg_value, Round, reg_value
if (ini_value != reg_value)
{
MsgBox,,Your Trial Period Has Expired, `nPlease buy the full version, contact sales@xxxxx.com
ExitApp
}
}
ConfigRead:
IniRead, Estate, %ConfigFile%, View, Estate
Estate := Estate / 457
Transform, Estate, Round, Estate
Check:=A_YDay-Estate
DaysLeft:=5-Check
If DaysLeft = 0
{
MsgBox,,Your Trial Period Expires Today, `nYour Trial Period Expires Today`nPlease buy the full version, contact sales@xxxxx.com
}
If DaysLeft > 5
{
MsgBox,,Your Trial Period Has Expired, `nPlease buy the full version, contact sales@xxxxx.com
FileSetAttrib -RH, %ConfigFile%
IniWrite, 64357883646, %ConfigFile%, View, Estate
FileSetTime, 20070322, %ConfigFile%
FileSetAttrib +RH, %ConfigFile%
ExitApp
}
else
{
If Check > 5
{
MsgBox,, Your Trial Period Has Expired, `n Please buy the full version, contact sales@xxxxx.com
FileSetAttrib -RH, %ConfigFile%
IniWrite, 64357883646, %ConfigFile%, View, Estate
FileSetTime, 20070322, %ConfigFile%
FileSetAttrib +RH, %ConfigFile%
ExitApp
}
else
{
if DaysLeft !=0
{
MsgBox, %DaysLeft% days left in your Trial Period
}
}
}
;;;;;;;; Edited this chunk out because it stops the program from acutally reaching the programming.;;;;;;
;Midnight := SubStr( A_Now, 1, 8 ) . "000000"
;Midnight += 1, days
;Midnight -= A_Now, seconds
;Sleep, %Midnight%000
;Reload
;Return
SkipSecurity:
;;;;;;;;;;;;PROGRAMMING CODE AFTER THIS POINT;;;;;;;;;;;;;;;;;;;;;;;;;;
MsgBox, 0, Congratulations, You made it to the main programming. :) |
Edit: Tested it at home and it seems to work now after I fixed a few corks however I still don't like how it uses one key to register consistently because people can just give theirs out and their would be no stopping the program from running.
Perhaps we could look at the initial time stamp and generate an extra piece on the end of the key using that and then when people register, you could make them click a certain key combination to automatically copy a random segment of numbers followed by the 3-4 digit code followed by more numbers so it looks like they are sending for us to process and then automatically launch a run mailto:.... I don't know. just an idea |
|
| Back to top |
|
 |
JoMa Guest
|
Posted: Thu Feb 25, 2010 7:53 am Post subject: |
|
|
This seems to be a great idea.
Has anyone actually tried linking it with SW Protect ?
http://www.autohotkey.com/forum/topic5763.html
That way you get xx day trial, followed by regsitration.
@jpjazzy - is that something you could do ?
@Laszlo & Icarus
Any chance ??? |
|
| Back to top |
|
 |
Francis Guest
|
Posted: Thu Feb 25, 2010 12:36 pm Post subject: |
|
|
| Quote: | reaching the programming.;;;;;;
;Midnight := SubStr( A_Now, 1, 8 ) . "000000"
;Midnight += 1, days
;Midnight -= A_Now, seconds
;Sleep, %Midnight%000
;Reload
;Return |
That return should be at the end of your auto exec in your script ! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|