Extensions for hiding source

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Extensions for hiding source

Post by Ree »

I have downloaded a trial version of a PHP product. I found that all the files do nothing more than loading a custom extension and executing the only function that extension provides:

Code: Select all

// Load the extenion (.so file)
$stuff = 'KqhaSkZO5qbA...'; // long gibberish
the_custom_decode_function($stuff);
The only thing that differs among the files is (obviously) the $stuff string. Everything else is the same.

I found it interesting. I wonder if this is what people usually do to actually hide the source code? I imagine you cannot 'decompile' .so files (I think the equivalent on Windows is .dll)?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

they can be decompiled.. Getting back to the original source file isn't always a simple feat, but decompiling back to assembler is easily done.
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

So from what I posted, it seems that they (the creators) have implemented all the functionality in C (within the extension)?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

As long as it compiles to a compliant library (.so or .dll) it can be written in any language.
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

This is ineteresting. Then in theory, I could write my app completely in C and compile the source into PHP extensions. But what about the usual stuff like form processing, reserved PHP globals etc? Can it also be done within such extensions? For example, can I 'ask' PHP to provide me with $_GET vars so that these could be used in the extensions?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

I'm fairly certain you can. Good reading here: http://us2.php.net/manual/en/internals.php
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

I wonder if people often write whole apps in C and put them in extensions? Isn't it a good way to build a commercial, closed source, licensed product? It must be done pretty often I think, unless there are any significant disadvantages of doing it that way.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Ree wrote:I wonder if people often write whole apps in C and put them in extensions? Isn't it a good way to build a commercial, closed source, licensed product? It must be done pretty often I think, unless there are any significant disadvantages of doing it that way.
90% of web developers wouldn't know how to install it, or wouldn't have the level of server access required to install it. Unless it's something you can sell to hosting companies you'll be limited to people who run their own servers .. still not particularly common in the industry.
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

Install what? Extensions? Installing extensions is easy enough.

But yes, I imagine there are pretty much no shared hosts that would allow you to load your own extensions? In that case you really limit your potential customers...
Post Reply