ioncube加密與解密 php程式碼

ioncube_encoder用於php程式碼的加密
ioncube_loaders用戶php程式碼的解密,經ioncube_encoder加密後的程式碼,不經 ioncube_loaders解密是運行不了的!
ioncube_encoder分免費和收費的兩種,以免費版本做測試,加密軟件是收費的,解密軟件是免費的!
下載ioncube_encoder_evaluation.tar.gz
tar zxvf ioncube_encoder_evaluation.tar.gz
mv ioncube_encoder /usr/local
cd /usr/local
ln -s  ioncube_encoder  encoder
我已經配置好了lnmp環境,/data/www為為的web目錄,該目錄下有一個a.php文件
內容如下:
[root@haproxy1 php encode]# cd /data/www/
[root@haproxy1 www]# cat a.php
phpinfo();
?>
測試解密該文件如下:
[root@haproxy1 www]# /usr/local/encoder/ioncube_encoder54  a.php  -o b.php

[root@haproxy1 www]# cat a.php

phpinfo();

?>

[root@haproxy1 www]# cat b.php

// IONCUBE ENCODER 8.1 EVALUATION

// THIS LICENSE MESSAGE IS ONLY ADDED BY THE EVALUATION ENCODER AND

// IS NOT PRESENT IN PRODUCTION ENCODED FILES



if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');if(function_exists('dl')){@dl($__ln);}if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}if(function_exists('dl')){@dl($__ln);}}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file '.__FILE__.' requires the ionCube PHP Loader '.basename($__ln).' to be installed by the website operator. If you are the website operator please use the ionCube Loader Wizard to assist with installation.');exit(199);

?>

HR+cPzNENtYUAQH/StJAMngoAH8Jzces/1y0iBUiJVBFnCx/UUx3bGSrC/fWB8QbKM4Xsd+HAg/5

AxDEAa5jhFePt2RdJbVlIy3mU1nuw5fYoaVaXLh5747OEBv1LeW8DcUCwnaUdm3yhNnn0BwY+Kci

uVjsrhrn+L/9cJhqGhOLoyPOIV+cRtHyBIEPWt5imx77j75JaPcj0ya98nYwSHunAB3jVHdlU6TP

X7r4TVeEk4PS5/A+4TuD81y9FMmTocLoLUp74ntyeg1XXkaVy7tryCOBva59ZCiPMBXkKZBERf8S

BcqXGcLgVzBMhdh3fZtJqsDr254125x2TX+EpAnoatso8JXzpR0z+yDfrCf7h+9tnLwGyRryuzJU

EDajQqPPsuynW1gv2iyb8bYNgoAZy7kPlmuNdiSYta5LNruPJbiGXdHzaEvAlIF1Ewwyd3WH1W==
測試執行b.php,如下提示:
顯然解密後的文件,直接是執行不了的!
安裝ioncube_loaders即可解決該文件!安裝方法如下:
我下載的是 ioncube_loaders_lin_x86.tar.bz2, 我的虛擬機是x86平台的,如果是x86_64平台,則需要下載ioncube_loaders_lin_x86-64.tar.gz
如果在x86 平台上,使用了x86_64上的軟件,則會有如下的提示:
    The necessary zend_extension line could not be found in the configuration.
    The loader file found at /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20100525/ioncube_loader_lin_5.4.so is not the correct one for your system.
    You have the wrong loader for your machine architecture. Your system is x86 but the loader you are using is for x86-64.

[root@haproxy1 php encode]# tar jxvf ioncube_loaders_lin_x86.tar.bz2

ioncube/

ioncube/ioncube_loader_lin_4.3_ts.so

ioncube/ioncube_loader_lin_5.2_ts.so

ioncube/LICENSE.txt

ioncube/loader-wizard.php

ioncube/ioncube_loader_lin_4.4_ts.so

ioncube/ioncube_loader_lin_5.1_ts.so

ioncube/ioncube_loader_lin_5.0.so

ioncube/ioncube_loader_lin_5.1.so

ioncube/ioncube_loader_lin_5.3_ts.so

ioncube/ioncube_loader_lin_5.4.so

ioncube/ioncube_loader_lin_5.2.so

ioncube/ioncube_loader_lin_4.2.so

ioncube/README.txt

ioncube/ioncube_loader_lin_5.4_ts.so

ioncube/ioncube_loader_lin_5.0_ts.so

ioncube/ioncube_loader_lin_4.3.so

ioncube/ioncube_loader_lin_4.4.so

ioncube/ioncube_loader_lin_4.1.so

ioncube/ioncube_loader_lin_5.3.so
先確認php的版本,
[root@haproxy1 www]# /usr/local/webserver/php/bin/php -v
PHP 5.4.11 (cli) (built: Sep  3 2013 09:55:22)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

[root@haproxy1 php encode]# cp ioncube/ioncube_loader_lin_5.4.so  /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20100525/
[root@haproxy1 php encode]# cp  ioncube/loader-wizard.php          /data/www

在php.ini文件中加入;

zend_extension = /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20100525/ioncube_loader_lin_5.4.so
然後重啟php-fpm和nginx
/etc/init.d/php-fpm restart
/etc/init.d/nginx restart
測試是否ioncube_loader  見附件!






留言

這個網誌中的熱門文章

c語言-關於#define用法

CMD常用網管指令

使用windows CMD 時間自動校正