Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting expiration date in perl script. 1

Status
Not open for further replies.

dmazzini

Programmer
Jan 20, 2004
480
US
Hi

I would like to set expiration date for a perl application, executable created using PDK Active State. Platform is Win32.

The following code works well, the problem is that if user change Date and time from windows, it will not work.

Code:
BEGIN {
    return unless defined $PerlApp::VERSION;
    my $expire = PerlApp::get_bound_file("expire") or return;
    print "Expire:$expire\n";
    my($y,$m,$d) = (localtime)[5,4,3];
    my $today = sprintf("%04d-%02d-%02d", $y+1900,$m+1,$d);
    print "Today:$today\n";
    return if $today le $expire;
    print "expired\n";
    exit;
}
print "ok\n";

My application as well reads a single xml license file per user which contains (username, macaddres, hostname etc), But if I add "encrypted expiration date inside that I will have same problem if user changes the date.

What would you suggest? Is it possible to get the current date for another source, like web site?.

How some apps detect that user has changed the date?

Thanks


More info about active state PerlApp::get_bound_file function:

Code:
[URL unfurl="true"]http://community.activestate.com/tags/perlapp[/URL]



dmazzini
GSM/UMTS System and Telecomm Consultant
 
You could query a ntp server and see what the current date/time is. You could also check the date/time of your file creation date to see when it was put on the server.

Do you please on encrypting this code or obfusicating it?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
There is no fool proof way to do what you want, just look at all the cracked programs you can download where the expiration date has been removed to make programs work forever.

Even if you find a fairly good way of doing it, the entire expiration date checking routine could be removed from the program.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Travs69, The perl script is encrypted, it is an executable file. The "expiration file" is encrypted as well within executable file.

KevinADC you're right, it's quite difficult to keep the expiration date, even me I have cracked few programs...jejjee!

The users that are manipulating the programs are not really experts in IT, they are regular users, it's an advantage...

I was thinking to have at the beginning of the script a routine to create a hidden file in the user pc with the "expiration date" and script version.

Then, first time that user run this "script version", script will create a file in the pc, then next time when user runs tool, the file will exist, it means that tool was used before, then the tool will compare date in the file against the date found in the file "expire" used by Perl PDK ( PerlApp::get_bound_file("expire")".

Another idea that I have is write an entry with (expiration date)i n the windows registry, then compare the "hidden date" in the registry against date saved in the "expire" file. The problem that I can see with it is that it might be dangerous to manipulate registries...






dmazzini
GSM/UMTS System and Telecomm Consultant

 
Hey Kevin

Regarding this:

Code:
Even if you find a fairly good way of doing it, the entire expiration date checking routine could be removed from the program.


Users wont be able to do it since it's an binary file (executable file created with Active State PDK)

Cheers

dmazzini
GSM/UMTS System and Telecomm Consultant

 
dmazzini:

They can circumvent it using good old fashion binary manipulation, the kind of cracks that circumvent similar restrictions in other binary apps (Photoshop, etc...)

Somebody who knows their way around binary and can hack in assembly can disassemble the program, find the part in assembly that does an expiration date test, add the equivalent of a "goto" at the beginning to make it jump to the end, therefore completely skipping all the expiration checking logic, and then recompile the executable. With the two almost-identical executables, a binary diff can be done to get the offsets to modify in the binary, which can be distributed in a crack program so that others can have a one-click hack of the executable that "fixes" it so that expiration dates are never tested.

The same could be theoretically done with a compiled Perl executable.

Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Kirsle

Nice comments man, I am happy that current users dont have your knowledge and programming skills :).

All you guys are right, always there is way around to crack a program.

Not sure if you guys have used a program called "ultracompare".
Code:
[URL unfurl="true"]http://www.ultraedit.com/[/URL]

This program is really very useful to get differences between 2-3 files that might be text or binary. Actually ultraedit editor works very well as well, it even support perl regex and it is very fast, specially compared against komodo...

Cheers and thanks






dmazzini
GSM/UMTS System and Telecomm Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top