PHP: Protecting your code (Zend Encoder/IonCube/SourceCop)

SourceCop Decoder

Personally, I have never found need to encode/encrypt/obfuscate any PHP. I do however know that there is a large audience of developers and/or organizations out there that do rely on such obfuscation to protect their works. Not being sure if it has hit the news or not, as I have been too busy of late to even open up my RSS aggregator to skim the headlines, know that there is at least one service in the wild that can successfully decode Zend Encoder and IonCube encoded files. It’s not perfect by any means, as it is reconstructing the code based on the opcodes, but it does return it in a format that is true to the original as far as execution and reasonably easy for a human to parse.

I wrote this little number the other day after running across a script I was wanting to use, in which one component was obviously dependant upon register_globals. My gosh, if I only had the code I could fix that! Fortunately it was obfuscated with an application called SourceCop, which provides very little in the way of protection. Come on guys, you could at least obfuscate the code itself first, munging whitespace, variable and function names. As it was, it took a mere 20 minutes to write a script that would replace an encoded file with a pristine copy of the original. At any rate, here is the script, do note that it was a quick hack and as such it may or may not work for you. It will also simply overwrite any SourceCop encoded files fed to it, so you will want to create a backup first, you have been warned.
Update: 2/23/2006, revised script

17 Replies to “PHP: Protecting your code (Zend Encoder/IonCube/SourceCop)”

  1. How do you get your Sourcecop script to actually work? Whatever I tried I was unable to get this script to even attempt to spit out de-sourcecop’ed code…

  2. Hi there, I too am having difficulty operating your code, could you possible post how to feed a file to it.

    thanks

  3. That is great work! I think that those who use these methods to protect their work should actually support that work if they want it to continue to have value.
    If they leave customers high and dry they should expect necessity to drive the need for change and modification with their help or in spite of the lack of it. Bravo!

  4. How can I get the getopt() function to work on a windows machine, or even run it on a hosted linux server?

  5. All is correct – thanks a lot!

    We got some trouble – not all encoded scripts can be decoded.
    There are some “sourcecop’ed” scripts that after decoding return an empty string.

    Dear Author – help us!

  6. I don’t think this is for windows based systems linux only

    I have tried but get can read file all the time

  7. hey can you please explain me how to use this script please? im having troubles with a client website and i dont know where to get help, ill apreciate any help from yours! God Bless you!

  8. the script did not work.

    PHP Notice: Undefined offset: 0 in /srv/www/htdocs/super-domain.net/login/decode.php on line 46

    – no output.

  9. Dummy solution for windows platforms:

    replace
    $options = getopt(‘f:’);
    with
    // $options = getopt(‘f:’);
    $options[‘f’]=’file.php’;
    // where file.php is the file you want to decode.

    Damn, i’m gettin busy searching for a good encoder, belive or not, the “best” (no decoder found yet)TrueBug PHP Encoder, is http://www.truebug.com/. I’m 100% sure that is not decodable yet because nobody really tried to decode it.

  10. Simply change the last line eval to highlight_string and the souce code will be shown to you.

    for example:

    change:

    eval(y0666f0acdeed38d4cd9084ade1739498(‘0B4D11779BA2E22C 7’,$REXISTHEDOG4FBI));

    to

    highlight_string(y0666f0acdeed38d4cd9084ade1739498(‘0B4D11779BA2E22C 7’,$REXISTHEDOG4FBI));

  11. Look for something similar like this, and put this one its own line and commend it out, and change the last line eval to highlight_string as described in previous post, you will get the souce code.

    // g0666f0acdeed38d4cd9084ade1739498(f0666f0acdeed38d4cd9084ade1739498(__FILE__));

  12. Look for something similar like this, and put this one its own line and commend it out, and change the last line eval to highlight_string as described in previous post, you will get the souce code.

    g0f0ade1739498(f0666f498(__FILE__));
    (line was shorten so it will appear on the post)

  13. Look for something similar like this, and put this one its own line and commend it out, and change the last line eval to highlight_string (or simply use echo) as described in previous post, you will get the souce code.

    g0f0ade1739498(f0666f498(__FILE__));
    (line was shorten so it will appear on the post)

  14. I couldn’t figure this out…Can you post where to place the file that will be decoded.

  15. tks for ur share,it worked for me 🙂
    and have anyone code by php to decode php lockit ?

  16. what program are you using to decode the text…………eval(y0666f0acdeed38d4cd9084ade1739498(‘103B1F6CAAA9E82C38’,$REXISTHEDOG4FBI));?>

Comments are closed.