hogg Posted June 20, 2006 Share Posted June 20, 2006 (edited) how can i make this so the clock cannot be changed to be in the window of the 7 day trial? any ideas? I was thinking of a internet time server or just a hiddin way to grab the time off the web.. #include <Date.au3> ;author hogg $firstdate = _NowCalcDate() $today = _NowCalcDate() $RegRead = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\", "date") $diff = _DateDiff("d", ($RegRead), ($today)) IF $RegRead = "" Then ;MsgBox( 4096,"test1", "REG DOES NOT EXIST") ;Entry does not exist - install reg key RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\", "date", "REG_SZ", ($firstdate)) Else ;MsgBox( 4096,"test2", "REG KEY EXISTS") EndIf $daysleft = $diff -7 $daysleft3 =Abs($daysleft) $daysleft2 = ($daysleft3 & " DAYS") IF $diff < 7 Then MsgBox( 4096,"", "SOFTWARE WILL EXPIRE IN " & $daysleft2) ;script runs Else MsgBox( 4096,"test2", "YOU CAN PURCHASE THE FULL VERSION @ www.script.com") ;script does not run..... EndIf Edited June 20, 2006 by hogg Link to comment Share on other sites More sharing options...
Matthy Posted June 20, 2006 Share Posted June 20, 2006 yust say chance clock to this dat run program when program is closed chance the date back sow the date is only chanced when you run the programm and it doesnt bother you at all other programms like mail ect, Link to comment Share on other sites More sharing options...
james3mg Posted June 20, 2006 Share Posted June 20, 2006 how can i make this so the clock cannot be changed to be in the window of the 7 day trial?I'm sure there exists a way to get the time from an internet time server. Unfortunately for you, I don't know it. However, short of making sure that the clock is never changed, you could severely limit the ability to change it - each time the timestamp is checked, store an encrypted version of the date in an .ini file - shut down the program completely if the .ini file does not exist. (let's say that your program stores the decrypted timestamp it was last checked in $lastchecked). Then do a double-timestamp check - make sure that the current time is AFTER $lastchecked, then make sure that they're still within the 7-day window. That way, even if they change their computer date, the time (hours and minutes) is unlikely to be changed also, so they'd constantly have to set it further and further ahead. Also, if they are found to be launching the program when their computer reads a time before $lastchecked, set the program to never run again (delete the .ini file, or set the "last time" timestamp to sometime in the year 2050). That way, it's likely the first time they set their clock back, it will catch them and never run again. "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
Uten Posted June 20, 2006 Share Posted June 20, 2006 Use system time and compare to created, modified and accessed time on some (random) files in the system. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
nfwu Posted June 21, 2006 Share Posted June 21, 2006 (edited) Or, you can store the current time. If the next time the user runs the program, and the current time is before the stored time, then delete your application off his system and (somehow) prevent re-installation. #) edited for clarity Edited June 21, 2006 by nfwu TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted June 21, 2006 Share Posted June 21, 2006 just use a encrypt UDF to encrypt the time and stuff and just pop a .ini somewhere in his windows folder, no one ever knows Link to comment Share on other sites More sharing options...
w0uter Posted June 21, 2006 Share Posted June 21, 2006 not exactly 7 days but it isnt easy to bypass afaik. use timerinit() and timerdiff() too see how long your program has actually run and add it to an encrypted registry each time. then if you want to re-install check that key and see if it has 7 days already. this gives a more 'fair' usage then just 7 days after installation My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
hogg Posted June 21, 2006 Author Share Posted June 21, 2006 well i did come up with a simple way to get the real time from the internet. here it is... you could use encryption on the dates stored for further protection... #include <Date.au3> $RegRead = RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\", "date4", "REG_SZ") $fileexist = FileExists (@SystemDir & "\kdf2.qrf") $file =InetGet("http://www.google.com/index.php", @SystemDir & "\sdlfnzslkdf.qrf", 1, 0) $filetime = FileGetTime (@SystemDir & "\sdlfnzslkdf.qrf",1,1) $fileexist2 = FileExists (@SystemDir & "\sdlfnzslkdf.qrf") $year = StringTrimRight ( $filetime, 10 ) $month = StringMid ( $filetime, 5 , 2 ) $day = StringMid ( $filetime, 7 , 2 ) $currentdate = ($year &"/"& $month &"/"& $day) if $RegRead = "" Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\", "date4", "REG_SZ", ($currentdate)) EndIf if $fileexist = 0 Then FileCopy (@SystemDir & "\sdlfnzslkdf.qrf", @SystemDir & "\kdf2.qrf", 0) EndIf if $fileexist2 = 0 Then MsgBox( 4096,"", "Internet Connection is Down") Exit EndIf FileDelete (@SystemDir & "\sdlfnzslkdf.qrf") $filetime2 = FileGetTime (@SystemDir & "\kdf2.qrf",1,1) $year2 = StringTrimRight ( $filetime2, 10 ) $month2 = StringMid ( $filetime2, 5 , 2 ) $day2 = StringMid ( $filetime2, 7 , 2 ) $filedate2 = ($year2 &"/"& $month2 &"/"& $day2) $regdate = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\", "date4") $diff = _DateDiff("d", ($filedate2), ($regdate)) if $diff = 0 Then Else MsgBox (4096,"HACKER", "YOU HAVE BEEN CAUGHT") Exit EndIf $diff2 = _DateDiff("d", ($regdate), ($currentdate)) + 1 if $diff2 < 7 Then MsgBox( 4096,"", "your on day " & $diff2 & " of your 7 day trial") Else MsgBox( 4096,"", "You may purchase this software @ www.anywhere.com") Exit EndIf Link to comment Share on other sites More sharing options...
McGod Posted June 21, 2006 Share Posted June 21, 2006 I would use OnExitFunc Use it to get the date\time. Then When you start up have it compare that to the current date. Or have it use sync before getting dates. [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
Uten Posted June 21, 2006 Share Posted June 21, 2006 (edited) If you really want to go the internet route why not do somthing like this: expandcollapse popup#Region Compiler directives section #compiler_compression = 4 #compiler_OutFile_Type=a3x #compiler_run_after= %out% ;#compiler_run_after=del /F %out%;NOTE: This is a include file! So delete "executable" if test compiled! #endregion #include <array.au3> testGetInternetTime() exit Func testGetInternetTime() Local $file = @TempDir & "\delete.txt" Local $hfile, $data, $arr if InetGet("http://www.worldtimeserver.com/current_time_in_NO.aspx",$file, 1, 0 ) then $data = FileRead($file) $arr = StringRegExp($data, "(\<\w*\>, \<\w*\> \d*, \d*)|(DST \+?\d\d\d\d UTC)|(\d\d?:\d\d?)", 3) dumpStringRegexpResult($arr, @extended, @error) Else msgbox(16, "ERROR", "InetGet faield") EndIf EndFunc Func dumpStringRegexpResult(ByRef $arr, $extended, $error) Select Case $error = 1 ConsoleWrite(' Error. Flag is bad. $arr = ""' & @LF) Case $error = 2 ConsoleWrite(' Error. The pattern was invalid. $arr =' & $arr & ', position in $sPattern where error occurred.' & @LF) Case $error = 0 if $extended Then ConsoleWrite(' Success. Pattern matched. $arr has the text from the groups or true (1), depending on flag. ' & @LF) if IsArray($arr) then _ArrayDisplay($arr, "DATA IS") Else msgbox(0, "$arr:=" , "[" & $arr & "]") EndIf Else ConsoleWrite(' Failure. Pattern not matched. $arr = "" or false (0), depending on flag.' & @LF) EndIf EndSelect EndFunc EDIT: Added relod flag to InetGet call to awoid cached content. Edited June 22, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
hogg Posted June 21, 2006 Author Share Posted June 21, 2006 well by just downloading small php file and getting the file date & time from that I think it uses the servers time for the the file creation date. it seems to work extremly fast. and the users computer clock has no effect on time changes. what your doing does the same thing in a diff manner but it doesnt look as fast... and google is always up... If you really want to go the internet route why not do somthing like this: expandcollapse popup#Region Compiler directives section #compiler_compression = 4 #compiler_OutFile_Type=a3x #compiler_run_after= %out% ;#compiler_run_after=del /F %out%;NOTE: This is a include file! So delete "executable" if test compiled! #endregion #include <array.au3> testGetInternetTime() exit Func testGetInternetTime() Local $file = @TempDir & "\delete.txt" Local $hfile, $data, $arr if InetGet("http://www.worldtimeserver.com/current_time_in_NO.aspx",$file ) then $data = FileRead($file) $arr = StringRegExp($data, "(\<\w*\>, \<\w*\> \d*, \d*)|(DST \+?\d\d\d\d UTC)|(\d\d?:\d\d?)", 3) dumpStringRegexpResult($arr, @extended, @error) Else msgbox(16, "ERROR", "InetGet faield") EndIf EndFunc Func dumpStringRegexpResult(ByRef $arr, $extended, $error) Select Case $error = 1 ConsoleWrite(' Error. Flag is bad. $arr = ""' & @LF) Case $error = 2 ConsoleWrite(' Error. The pattern was invalid. $arr =' & $arr & ', position in $sPattern where error occurred.' & @LF) Case $error = 0 if $extended Then ConsoleWrite(' Success. Pattern matched. $arr has the text from the groups or true (1), depending on flag. ' & @LF) if IsArray($arr) then _ArrayDisplay($arr, "DATA IS") Else msgbox(0, "$arr:=" , "[" & $arr & "]") EndIf Else ConsoleWrite(' Failure. Pattern not matched. $arr = "" or false (0), depending on flag.' & @LF) EndIf EndSelect EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 21, 2006 Moderators Share Posted June 21, 2006 Are you saying this is a google php file for time? If so do you have the link? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
hogg Posted June 21, 2006 Author Share Posted June 21, 2006 Are you saying this is a google php file for time? If so do you have the link?no this is just a random php file.. snice its dynamic it is created when the page is loaded... that gives us the creation date that I am finding with the FileGetTime function. Link to comment Share on other sites More sharing options...
Uten Posted June 22, 2006 Share Posted June 22, 2006 Hi @hogg, I forgot to turn my clock back to the correct date after testing your function yesterday. To my supprice now it returns 21, as in yesterdays date as in my system time. I was suppriced yesterday because it seemed that you way of doing it worked against how I thought it should work. And I did not manage to dupe your function yesterday. I just adjusted the date in windows. I suppose InetGet sets the filetimes. It does not get it from the server providing the page as fare as I can understand. Tested with some really old pages. My own code missed the reload flag in the InetGet call so InetGet loaded the page from some cache and got it wrong to. Adding 1 to the flag solved it. I will update my code in my previous post. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
hogg Posted June 23, 2006 Author Share Posted June 23, 2006 you were right about about the filetime method not working... I did something like yours that parses a page for the current time & date.. thanks for all the help. I added another file besides the registry to encrypt the date... now they just have to find both reg key & file and delete them... wish there was a better way. #include <Array.au3> #include <Date.au3> #include<string.au3> #include <File.au3> $filelocation = @SystemDir & "\kdf2.qrf" $internetfile = InetGet("http://www.xav.com/time.cgi", $filelocation, 1, 0) $file = FileOpen($filelocation, 0) $readfile = FileRead($filelocation) $asResult = StringRegExp($readfile, '(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)', 1) Dim $MyD Dim $MyT _DateTimeSplit($asResult[0], $MyD, $MyT) $s = _ArrayToString($MyD, "/") $date = StringTrimLeft($s, 2) FileClose($filelocation) $fileexist = FileExists($filelocation) If $fileexist = 0 Then MsgBox(4096, "", "Internet Connection is Down") Exit EndIf If RegRead("HKCU\Software\Microsoft\Windows\Current Version", "MenuTabz") = "" Then RegWrite("HKCU\Software\Microsoft\Windows\Current Version", "MenuTabz", "REG_SZ", _StringEncrypt(1, $date, @ComputerName)) SetError(0) EndIf FileDelete($filelocation) $startdate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", "MenuTabz"), @ComputerName) If _DateDiff("D", $startdate, $date) > 7 Then MsgBox(0, "", "You're registration period has expired. You may register at www.anywhere.com") Exit EndIf MsgBox(0, "", $startdate) $FilePath2 = @WindowsDir & "\rtcfb.bin" If FileExists(@WindowsDir & "\rtcfb.bin") = 0 Then _FileCreate($FilePath2) FileWrite($FilePath2, _StringEncrypt(1, $date, @WindowsDir, 2)) EndIf FileOpen($FilePath2, 0) $filedate = _StringEncrypt(0, FileRead($FilePath2), @WindowsDir, 2) If _DateDiff("D", $filedate, $startdate) = 0 Then Else MsgBox(0, "Hacker Trap", "You're registration period has expired. You may register at www.anywhere.com") Exit EndIf Link to comment Share on other sites More sharing options...
Valuater Posted June 23, 2006 Share Posted June 23, 2006 from AutoIt Wrappers ( in my sig below ) ; 30 Day Trial ; Author MSLx Fanboy #include<date.au3> #include<string.au3> If RegRead("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu") = "" Then RegWrite("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu", "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName)) SetError(0) EndIf $startdate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu"), @ComputerName) If _DateDiff("D", $startdate, _NowCalc()) > 30 Then MsgBox(0, "*XPClean Menu*", "You're registration period has expired.") Exit EndIf 8) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now