mirror of
https://github.com/php/pecl-php-blenc.git
synced 2026-03-24 01:02:13 +01:00
New package.xml description, BLENC now display version in phpinfo.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2013-06-12
|
||||
--
|
||||
Some fix on config.m4, new package.xml description, BLENC now display version in phpinfo.
|
||||
|
||||
|
||||
2013-05-31
|
||||
--
|
||||
Renamed blenc_protect.h.dist to blenc_protect.h in order to permit automatic installation with "pecl install" command.
|
||||
|
||||
1
blenc.c
1
blenc.c
@@ -212,6 +212,7 @@ PHP_MINFO_FUNCTION(blenc)
|
||||
else
|
||||
php_info_print_table_row(2, "Blenc support", "Enabled");
|
||||
|
||||
php_info_print_table_row(2, "Blenc version", BLENC_VERSION);
|
||||
php_info_print_table_row(2, "Blenc expire date", BL_G(expire_date));
|
||||
|
||||
php_info_print_table_end();
|
||||
|
||||
113
blencode.php
113
blencode.php
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* blenc_protect.php file.php
|
||||
*/
|
||||
function usage($prg)
|
||||
{
|
||||
echo "Usage : php -f $prg SOURCE ";
|
||||
echo "\n".
|
||||
"It will create a encoded version of SOURCE with extension .php.enc \n".
|
||||
"and will replace the code in SOURCE with a include request for the \n".
|
||||
"new encoded file.\n".
|
||||
"$prg also will create some other files:\n".
|
||||
" blenc.key with the unencrypted blowfish encryption key\n".
|
||||
" key_file.blenc with the encrypted version of blowfish key, in order to\n".
|
||||
" redistribute them with your encoded sources.\n".
|
||||
" ./backup directory where original SOURCE files will be saved\n\n";
|
||||
|
||||
}
|
||||
|
||||
function minify($fname)
|
||||
{
|
||||
$retval = '';
|
||||
$fdata = file($fname);
|
||||
|
||||
foreach($fdata as $row) {
|
||||
|
||||
$retval .= ' '.trim($row).' ';
|
||||
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
ini_set("output_buffering", "16000");
|
||||
|
||||
if($argc < 2) {
|
||||
|
||||
usage(basename($argv[0]));
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
$B1=@system('tput smso');
|
||||
$B0=@system('tput rmso');
|
||||
|
||||
if(!file_exists($argv[1])) {
|
||||
|
||||
echo "$B1 BLENC $B0 file $argv[1] not found.\n";
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
if(file_exists('blenc.key'))
|
||||
$key_prev = $key = file_get_contents('blenc.key');
|
||||
else {
|
||||
|
||||
$key_prev = $key = md5(time());
|
||||
file_put_contents('blenc.key', $key);
|
||||
}
|
||||
|
||||
echo "$B1 BLENC $B0 blenc_protect starts...\n";
|
||||
echo "$B1 BLENC $B0 blowfish unencrypted key: $key\n";
|
||||
echo "$B1 BLENC $B0 file to encode: ".$argv[1]."\n";
|
||||
|
||||
if(file_exists($argv[1])) {
|
||||
|
||||
if(!is_dir('backup')) {
|
||||
|
||||
mkdir('backup');
|
||||
|
||||
}
|
||||
|
||||
if(!file_exists('backup/'.basename($argv[1]))) {
|
||||
|
||||
$backup_file = 'backup/'.basename($argv[1]);
|
||||
|
||||
} else {
|
||||
|
||||
$backup_file = 'backup/'.basename($argv[1]).'.'.date('Y_m_d_H_i_s', time());
|
||||
|
||||
}
|
||||
|
||||
copy($argv[1], $backup_file);
|
||||
echo "$B1 BLENC $B0 backup file : $backup_file\n";
|
||||
|
||||
$contents = php_strip_whitespace($argv[1]);
|
||||
file_put_contents('/tmp/blencode-txt', $contents);
|
||||
$contents = minify('/tmp/blencode-txt');
|
||||
$aS = array('<?php', '?>', '<?');
|
||||
$aR = array('', '', '');
|
||||
$contents = trim(str_replace($aS, $aR, $contents));
|
||||
echo "$B1 BLENC $B0 size of content: ".strlen($contents)."\n";
|
||||
echo "$B1 BLENC $B0 MD5: ".md5($contents)."\n";
|
||||
file_put_contents('/tmp/blencode-log', "---\nFILE: $argv[1]\nSIZE: ".strlen($contents)."\nMD5: ".md5($contents)."\n", FILE_APPEND);
|
||||
|
||||
if($key != '')
|
||||
$key = blenc_encrypt($contents, $argv[1].'enc', $key);
|
||||
else
|
||||
$key = blenc_encrypt($contents, $argv[1].'enc');
|
||||
|
||||
echo "$B1 BLENC $B0 redistributable key: $key\n";
|
||||
|
||||
file_put_contents('key_file.blenc', $key."\n", FILE_APPEND);
|
||||
|
||||
unlink($argv[1]);
|
||||
symlink($argv[1].'enc', $argv[1]);
|
||||
|
||||
$result = @system('sort -k1 -u -o key_file.blenc key_file.blenc');
|
||||
echo "$B1 BLENC $B0 redistributable key file key_file.blenc updated.\n";
|
||||
echo "$B1 BLENC $B0 done.\n";
|
||||
|
||||
}
|
||||
?>
|
||||
21
package.xml
21
package.xml
@@ -5,14 +5,11 @@ http://pear.php.net/dtd/package-2.0
|
||||
http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<name>blenc</name>
|
||||
<channel>pecl.php.net</channel>
|
||||
<summary>Transparent PHP Script Encryption using Blowfish</summary>
|
||||
<description>BLENC is an extension which hooks into the Zend Engine, allowing for
|
||||
transparent encryption and execution of PHP scripts using the blowfish
|
||||
algorithm. It is not designed for complete security (it is still
|
||||
possible to disassemble the script into op codes using a package such
|
||||
as XDebug), however it does keep people out of your code and make
|
||||
reverse engineering difficult.
|
||||
|
||||
<summary>BLowfish ENCryption for PHP Scripts</summary>
|
||||
<description>
|
||||
BLENC is an extension that permit to protect PHP source scripts with Blowfish Encription.
|
||||
BLENC hooks into the Zend Engine, allowing for transparent execution of PHP scripts previously encoded with BLENC.
|
||||
It is not designed for complete security (it is still possible to disassemble the script into op codes using a package such as XDebug), however it does keep people out of your code and make reverse engineering difficult.
|
||||
</description>
|
||||
<lead>
|
||||
<name>John Coggeshall</name>
|
||||
@@ -26,11 +23,11 @@ reverse engineering difficult.
|
||||
<email>gchiesa@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2013-05-31</date>
|
||||
<time>11:22:00</time>
|
||||
<date>2013-06-12</date>
|
||||
<time>19:11:00</time>
|
||||
<version>
|
||||
<release>1.1.1b</release>
|
||||
<api>1.1.1b</api>
|
||||
<release>1.1.2b</release>
|
||||
<api>1.1.2b</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define ZEND_ENGINE_2_1
|
||||
#endif
|
||||
|
||||
#define BLENC_VERSION "1.1.1b"
|
||||
#define BLENC_VERSION "1.1.2b"
|
||||
#define BLENC_IDENT "BLENC"
|
||||
#define BLENC_BUFSIZE 4092
|
||||
|
||||
|
||||
Reference in New Issue
Block a user