LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-01-2008, 01:08 AM   #1
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Rep: Reputation: 31
php time bomb with php native functions


hi,

i'm wondering if anyone knows how to make a time bomb that destroys important bits of encrytped php (cached by turck or something) code...

to be an effective time bomb for trialware, it would have to use a php function, because if you used the exec() command or something, you can't be sure that the server is running linux or that the user has access to the commands you need in the script.


so, my question is, is there a php function that can destroy it's own code?
 
Old 02-01-2008, 03:34 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

I don't understand what you mean by "destroying" code. Deleting the PHP files doesn't work, at least not when it's cached, and people hopefully have backups anyway...

But if you just add something like this in your code:

PHP Code:
if (time() > strtotime('2008-03-01')) {
  die(
"Trial expired!<br>Please contact secretlydead for a license.");

Then the program simply doesn't work after the date specified. If you distribute the code encrypted, it will be almost impossible to remove this check. Of course, they can simply set the clock on the server to some old date and it will work. To prevent that, you could perhaps get the time from a different server, but that would slow down the script, and what would happen if the server you get the time from can't be reached?

Anyway I don't like timebombs like that. I try different programs a lot, and very often I install something, and then I have to do some other things, and when I get back to it, it's expired, so I just delete it.

I think a better solution is to add some text that doesn't prevent the software from working, but this text can't be removed from the output pages. If your program shows something like "This is a trial version of secretlydeads program - it's not licenced so you are not allowed to use it except for testing and evaluation.". I think any website using your program would pay to get rid of this message...
 
Old 02-01-2008, 08:47 AM   #3
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
good advice.
 
Old 02-01-2008, 06:10 PM   #4
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by Guttorm View Post
I think a better solution is to add some text that doesn't prevent the software from working, but this text can't be removed from the output pages. If your program shows something like "This is a trial version of secretlydeads program - it's not licenced so you are not allowed to use it except for testing and evaluation.". I think any website using your program would pay to get rid of this message...
Code:
<?php
ob_start();
include(trial code with message in it);
$out = ob_get_clean();
$out = str_replace("the trial message","",$out);
echo $out;
?>
Which explicitly shows the fundamental flaw in the "trial message" approach to shareware when PHP is the language.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help w/ doxygen and php functions 95se Programming 1 02-17-2006 09:53 AM
php and gd (image functions) devfreak Linux - Software 1 05-11-2005 05:17 PM
PHP about functions djgerbavore Programming 1 11-25-2004 07:14 PM
functions in PHP gaddargarson Programming 3 10-07-2004 02:02 PM
PHP -- How to execute a shell script from PHP using FTP functions?? zoonalex Programming 3 07-29-2004 11:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration